Skip Keycloak-required e2e tests when VITE_KEYCLOAK_URL is unset (preview-env auth pattern) #115
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/pal-e-app#115
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Type
Bug
Lineage
Discovered while auditing pipeline #128 failures after PR #111 switches Playwright to local
webServer(preview athttp://localhost:4173). 3 e2e tests assumekeycloak.login()will fire and redirect to a URL containingkeycloakor/realms/. The preview env has noVITE_KEYCLOAK_URLconfigured, so the redirect never happens, the page stays on/edit, and the form renders. Tests fail.Repo
forgejo_admin/pal-e-appWhat Broke
Three Playwright tests fail consistently in pipeline #128 (and any pipeline running against the local preview without Keycloak):
e2e/auth.spec.ts:45—Auth boundary — unauthenticated › /notes/{slug}/edit redirects to Keycloak when unauthenticatede2e/note-edit.spec.ts:4—Note edit page — structure › edit page redirects to Keycloak when not authenticatede2e/note-edit.spec.ts:18—Note edit page — structure › edit page does not render edit form when unauthenticatedThese tests were authored assuming Keycloak is reachable. After #111's preview-webServer switch (closes #112), they run in an env without Keycloak.
Repro Steps
main(or110-revert-renameonce #111 merges).npx playwright test e2e/auth.spec.ts:45 e2e/note-edit.spec.ts:4 e2e/note-edit.spec.ts:18./editand form renders.Expected Behavior
Tests should skip cleanly when no Keycloak is configured, and continue to assert auth behavior when one IS configured. Default fix: at module-load in each spec file, check
process.env.VITE_KEYCLOAK_URL(or equivalent — there is no test helper today). If absent,test.skip()the 3 auth-dependent tests with a clear reason. Pipeline goes green.Environment
forgejo_admin/pal-e-appat SHA ≥4454c8d(PR #109)http://localhost:4173(per #111/#112 switch)VITE_KEYCLOAK_URLunsetAcceptance Criteria
skipped(notfailed) when no Keycloak configuredVITE_KEYCLOAK_URLis setOut of Scope
VITE_KEYCLOAK_URLinto CI preview env (separate, larger scope; would require Keycloak availability + secret plumbing)pal-e-app#114Related
pal-e-app#111— preview-webServer switch that surfaced this gappal-e-app#112— preview-webServer parent ticketpal-e-app#114— the OTHER 3 e2e failures (UI-side, not auth-side)pal-e-app#96— circular dependency that #111 fixes