summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-03-12 16:15:20 -0600
committermo khan <mo@mokhan.ca>2025-03-12 16:15:20 -0600
commit9b267c499709472cd20d95df76b53fc6c571e797 (patch)
tree695d20441792f97bdc374196c8f6d98ba89ca9a7 /test
parentf62507b993e42c1d3fc96b2cafdcac51259b7ab0 (diff)
feat: require a login before authorizing an auth grant
Diffstat (limited to 'test')
-rw-r--r--test/e2e_test.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/e2e_test.go b/test/e2e_test.go
index 12e28edd..b465d764 100644
--- a/test/e2e_test.go
+++ b/test/e2e_test.go
@@ -43,6 +43,7 @@ func TestAuthx(t *testing.T) {
}
t.Run("GET http://ui.example.com:8080/saml/new", func(t *testing.T) {
+ assert.NoError(t, page.Context().ClearCookies())
x.Must(page.Goto("http://ui.example.com:8080/saml/new"))
action := x.Must(page.Locator("#idp-form").GetAttribute("action"))
assert.Equal(t, "http://idp.example.com:8080/saml/new", action)
@@ -61,8 +62,15 @@ func TestAuthx(t *testing.T) {
t.Run("OIDC", func(t *testing.T) {
t.Run("GET http://ui.example.com:8080/oidc/new", func(t *testing.T) {
+ assert.NoError(t, page.Context().ClearCookies())
x.Must(page.Goto("http://ui.example.com:8080/oidc/new"))
- assert.Contains(t, page.URL(), "http://idp.example.com:8080/oauth/authorize")
+
+ assert.Contains(t, page.URL(), "http://idp.example.com:8080/sessions/new")
+ page.Locator("#username").Fill("username1")
+ page.Locator("#password").Fill("password1")
+ assert.NoError(t, page.Locator("#login-button").Click())
+
+ assert.Contains(t, page.URL(), "http://idp.example.com:8080/oauth/authorize/continue")
assert.NoError(t, page.Locator("#submit-button").Click())
assert.Contains(t, page.URL(), "http://ui.example.com:8080/oauth/callback")
@@ -177,7 +185,13 @@ func TestAuthx(t *testing.T) {
oauth2.SetAuthURLParam("response_type", "code"),
oauth2.SetAuthURLParam("response_mode", "fragment"),
)
+ assert.NoError(t, page.Context().ClearCookies())
x.Must(page.Goto(authURL))
+
+ page.Locator("#username").Fill("username1")
+ page.Locator("#password").Fill("password1")
+ assert.NoError(t, page.Locator("#login-button").Click())
+
assert.NoError(t, page.Locator("#submit-button").Click())
uri := x.Must(url.Parse(page.URL()))