From 737b25c27cd32cc92e4f6faaa227a692ff5a7701 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 15:58:35 +1100 Subject: [PATCH] test(e2e): wait for the settled document title before axe checks A client-side navigation can render the new page's heading before Next.js commits its . expectAccessible ran axe as soon as the heading was visible, so on a slow runner it could sample an empty title and report a serious document-title violation. The onboarding setup project then failed and every dependent project lost its stored admin session. Wait for a non-empty title first. A page with no title still fails, now with a precise toHaveTitle message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJyn1D52aa77MxSKQGKQYp --- tests/e2e/support.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/e2e/support.ts b/tests/e2e/support.ts index 403fcac..d18fe9d 100644 --- a/tests/e2e/support.ts +++ b/tests/e2e/support.ts @@ -16,6 +16,9 @@ export const SAMPLE_ROOT = process.env.E2E_STACK_ROOT ?? ''; * switching the scheme is instant and axe never measures a colour halfway through a transition. */ export async function expectAccessible(page: Page) { + // A client-side navigation can show the new page's heading before Next.js commits its <title>, so wait for + // the settled title rather than let axe sample that gap (document-title). A page with no title still fails. + await expect(page).toHaveTitle(/\S/); for (const colorScheme of ['light', 'dark'] as const) { await page.emulateMedia({ colorScheme, reducedMotion: 'reduce' }); const { violations } = await new AxeBuilder({ page })