mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-07 03:15:56 +00:00
The bespoke `taiga login and logout` test always failed with a 60s
Keycloak-username-field timeout because `page.goto(baseUrl + "/")`
auto-redirects to `/discover` (a public showcase that exposes a top-
of-page `Login` link but NOT the SSO button). The detector matched the
discover-page `Login` link, classified the page as `taiga-login-page`,
clicked it, then immediately waited for the Keycloak username field —
never re-detecting the OIDC entry on `/login`. Trace from the live
stack confirmed: no request to `/oidc/authenticate/` was ever made.
Two-part fix in the OIDC login flow:
- `page.goto(baseUrl + "/login")` directly so the SSO button is on
the first navigated view and the Angular `tg-oidc-login-button`
directive has bound its click handler by the time we click.
- In the `taiga-login-page` branch, re-detect via
`waitForTopLevelLoginRequirement` after the Login-link click so the
SSO entry can be clicked before we expect the Keycloak URL.
Verified empirically against the live taiga stack via `make run` —
the test now passes in 4s and the trace shows the full Keycloak
round-trip (POST `/login-actions/authenticate?session_code=...` →
302 `/oidc/callback/?code=...` → 200 `/login?id=…&username=…`).
Also splits the spec into one file per test scenario, mirroring the
pixelfed layout (a66fb1d48):
- `playwright.spec.js` orchestrator: `test.use` + `beforeEach` +
`require()`
- `_shared.js` env, locator helpers, OIDC + native login/
logout flows, `beforeEach`
- `test-login-oidc.js` OIDC/oauth2 round-trip; skipped when both
services are off
- `test-login-native.js` NEW — drives Taiga's stock `/login` form
(LDAP federation when `loginFormType=ldap`,
local DB otherwise) against the same
`loginUsername` + `loginPassword` env;
skipped when either OIDC or oauth2 is on
(the OIDC test owns that journey)
- `test-public-discover.js`
- `test-themed-routes.js`
- `test-guest-persona.js`
- `test-biber-persona.js`
- `test-administrator-persona.js`
Gating logic on the two login tests is complementary: variant 0
(OIDC on) runs the OIDC test and skips the native one; variant 1
(everything off) does the inverse. Together they cover both auth
flavours without duplication.
The deploy's existing `with_fileglob: "*.js"` copies every companion
module into `tests/`; Playwright's testMatch only discovers
`playwright.spec.js`, so the `test-*.js` modules are pure `require()`
targets, not auto-discovered specs. The persona-naming and
service-env-gate lints already glob the role's playwright dir (set up
in a66fb1d48), so the split layout passes both without further
changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8 lines
196 B
JavaScript
8 lines
196 B
JavaScript
const { test } = require("@playwright/test");
|
|
|
|
exports.register = function (shared) {
|
|
test("biber: app → universal logout", async ({ page }) => {
|
|
await shared.runBiberFlow(page);
|
|
});
|
|
};
|