fix(e2e): accept login-form as page readiness marker

31-auth-sessions:36 (Refresh token expiré) calls navigateTo('/dashboard')
expecting the auth guard to redirect to /login. The rc1-day2 widening
accepted `main / [role=main] / app-sidebar / data-page-root` — none
of which render on /login. Result: 20s timeout on a test that's
actually working (the redirect happens, the helper just doesn't
recognise the destination as "rendered").

Extend the accepted set with `[data-testid="login-form"]`, present
on LoginPage.tsx since v1.0.x. The login page was the only
authenticated-redirect destination not covered.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
senke 2026-04-18 20:19:33 +02:00
parent f904e7baf3
commit 941dabdc97

View file

@ -153,12 +153,16 @@ export async function navigateTo(page: Page, path: string): Promise<void> {
// networkidle can legitimately timeout on pages with websockets/polling — not a test failure
});
// App must render some substantive root content. v1.0.7-rc1-day2:
// widened from `main, [role="main"]` to also accept the app sidebar
// (rendered on every authenticated route, and stable against layout
// refactors that may or may not use semantic <main>) and any
// element marked `data-page-root` for explicit opt-in pages.
// widened from `main, [role="main"]` to also accept:
// * the app sidebar (rendered on every authenticated route)
// * `data-page-root` (explicit opt-in)
// * the login form (for navigations that are expected to
// redirect to /login — token-expiry tests, unauthenticated
// probes)
// Pages that render none of these are still treated as broken and
// fail at 20s.
await page.locator(
'main, [role="main"], [data-testid="app-sidebar"], [data-page-root]',
'main, [role="main"], [data-testid="app-sidebar"], [data-page-root], [data-testid="login-form"]',
).first().waitFor({
state: 'visible',
timeout: 20_000,