test(auth): Playwright E2E coverage for the Spring Session login flow #613
Reference in New Issue
Block a user
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?
Context
Follow-up to #523 / PR #612. Sara's review flagged that the new login/logout/idle-timeout flow has Vitest unit coverage on the SvelteKit server actions and the userGroup hook, plus Java unit/slice/integration tests on the backend, but no end-to-end Playwright coverage of the full user journey. The manual checklist in PR #612 is not regression coverage — it will not run on the next deploy.
This issue lands a small Playwright spec that exercises the real browser ↔ SvelteKit ↔ Spring Boot stack.
Scope
Add a single E2E spec covering the four happy-path beats:
Login + cookie shape. Navigate to
/login, fill the form with admin creds, submit. After redirect to/:fa_sessioncookie is present, HttpOnly, SameSite=Strictauth_tokencookie is absent/api/*route through the dev proxy returns 200 (i.e. the session authenticates subsequent requests)Session-expired banner. After login, programmatically set the
fa_sessioncookie's Max-Age to 0 viacontext.addCookies, then navigate to a private route. Expect:/login?reason=expiredaxe-playwrightcheck passes on the expired-banner state (Sara's concern #3)Logout clears server + client state. From a logged-in state, submit the logout form. Expect:
/api/auth/logoutreturns 204 (verify via response interception)fa_sessioncookie is gone/api/*route returns 401Login banner at 320px width. Visual-regression check that the new banner with icon does not break layout at the smallest mobile width (Leonie's suggestion in PR #612).
Acceptance criteria
Implementation hints
e2eprofile admin seed (admin@familienarchiv.local / admin123) — already configured.fa_sessionbetween specs via the existing fixture (or add abeforeEachthat calls/api/auth/logoutto wipe state).await context.cookies()returns the full attribute set includinghttpOnly,sameSite,secure,expires.await checkA11y(page)after navigation; existing tests infrontend/e2e/already use this pattern.await page.setViewportSize({ width: 320, height: 800 })thenawait expect(page).toHaveScreenshot('login-expired-banner-320.png').Out of scope
Priority & sizing
References
docs/ARCHITECTURE.md— test-pyramid expectations— Filed as follow-up while implementing PR #612 feedback.