From 19e9943d697c20c9e8da71fd9edc3d18168ddbb5 Mon Sep 17 00:00:00 2001 From: minuszka Date: Tue, 15 Sep 2026 12:06:35 +0200 Subject: [PATCH] test(e2e): wait for the h2 sections before snapshotting headings The Overview page's h1 (.page-title) renders unconditionally on first paint; the h2 cards render only after a second, data-dependent pass. A cold CI start can catch the gap between the two: the CI run of #184 (2026-09-14) saw the h1 638ms in with 0 h2 sections, while the same commit's push run was 299/299 green. Reproduced locally against an unfixed copy of the assertions with a 300ms-delayed chainlocks stub (h2 count 0, matching the CI failure); the same delayed stub passes 10/10 once the wait is added. Waits for the first h2 to be visible before taking the heading snapshot; no assertion is weakened. Verified: 90/90 (repeat-each=5) and 359/360 (repeat-each=20, one unrelated pre-existing flake in a different test) on this fix, full e2e suite 299/299. --- client/e2e/accessibility.spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/e2e/accessibility.spec.ts b/client/e2e/accessibility.spec.ts index d82b639..e45c824 100644 --- a/client/e2e/accessibility.spec.ts +++ b/client/e2e/accessibility.spec.ts @@ -80,6 +80,10 @@ test.describe('semantics and focus', () => { app.stub(overviewStubs()); await app.goto('/'); await expect(page.locator('.page-title')).toHaveText('Overview'); + // The h2 cards render after a second, data-dependent pass; a cold start + // can catch the h1 alone, which is what made this test flaky in CI (#184, + // 2026-09-14). Wait for the sections before taking the heading snapshot. + await expect(page.locator('h2').first()).toBeVisible(); const list = await headings(page); const h1s = list.filter((h) => h.level === 1);