fix(e2e): handle the OIDC consent screen in loginViaSpa (PMS-521) #365
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-521-loginviaspa-consent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes PMS-521: the e2e
setuplogin (and therefore the whole suite) was failing because the staging OP now routes the post-2FA authorize through/oauth2/consent.Root cause
The SPA requests
scope=openid email offline_access profile, but the E2E account never grantedprofile, so the OP 302s authorize to/oauth2/consent?missing=profile.loginViaSpahad no consent step, so the flow looped (authorize -> consent -> app shell -> authorize -> consent),/oauth2/tokennever fired, andsetupcaptured no bearer.setupfailing fails everything (auth-ui,form-ui, and everyapispec depend on its login/bearer).Diagnosed from e2e run #2522 (PR #364):
postLoginUrl=/oauth2/consent?missing=profile,scope=...profile, "OIDC token exchange never fired".Fix
loginViaSpa's post-login navigation wait now clicks Allow whenever the page lands on/oauth2/consent. The grant POSTs to bunyip-api and persists, so subsequent authorize calls skip consent and the token exchange fires. Any/login*path is still treated as in-flow; a 30s deadline throws a clear message naming the consent markup if the selector ever moves.Selector mirrors bunyip's own e2e
driveConsentandbunyip-web/src/handlers/consent.rs:button[name="action"][value="allow"], with agetByRole('button', { name: /allow|authorize|approve/i })fallback.Verification
This PR's e2e run against staging is the verification -
setupshould now log in (look for[setup] captured bearer from ...) and theapispecs should run. (Theauth-ui+form-uispecs staytest.fixmeonmain; re-verifying those is PMS-519, on #364, once this lands.)npx playwright test --listcompiles clean.