test(e2e): wait for the document title before scanning the handover screens

The decision screen is reached by a client navigation, during which the old
route's title unmounts and the new one mounts from a suspended metadata
boundary that can reveal after the body has painted. Under load the scan ran
in that stretch and reported document-title. The helper now asserts the
title first, so a screen that never gets one still fails.

Refs #959
This commit is contained in:
Marc-André Bombeck committed 2026-10-17 10:43:59 +02:00
1 parent b254814bae
commit d67032db96
1 file changed
+12 -1
+12 -1
View File
@@ -30,8 +30,19 @@ function connect(): pg.Pool {
return new pg.Pool({ connectionString: url });
}
/** WCAG 2.1 AA on the screen as it stands. */
/**
* WCAG 2.1 AA on the screen as it stands.
*
* The decision screen is reached by a client navigation, and during one the
* framework unmounts the old route's `<title>` and mounts the new one from a
* suspended metadata boundary, which can reveal after the page body has
* painted. Measured under CPU throttling: the decision is on screen for about
* 200 ms before the title arrives. A scan in that stretch audits the
* navigation, not the screen, so the title is waited for first, and asserted:
* a screen that never gets one still fails here.
*/
async function expectNoAxeViolations(page: Page): Promise<void> {
await expect(page).toHaveTitle("HealthLog");
const result = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
.analyze();