Repository navigation
test(e2e): wait for the h2 sections before snapshotting headings - #190
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the flaky
accessibility.spec.ts:79test ("a page names itself in one h1, with its sections under it"): the CI run of #184 (2026-09-14) saw it red once on a cold start, green on the push run of the same commit (299/299).Cause
The Overview page's h1 (
.page-title) renders unconditionally on the first paint. The h2 section cards render only after a second, data-dependent render pass (two chainedPromise.allfetches indd-page-overview.ts's_load). The test snapshotted headings right after the h1 text resolved, so a slow-enough cold start could catch the gap: h1 present, 0 h2s,list.filter(h.level === 2).lengthfailstoBeGreaterThan(0)-- exactly the CI failure signature.Fix
One line: wait for the first h2 to be visible before taking the heading snapshot. No assertion weakened; the "no h3 or deeper" check still runs on the post-wait snapshot.
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);Diff sha256:
f045bc90a1e98d8de16a55fa2e331f04014b049ce1b4ce4080c464fe7fdd0b57.The other accessibility test that only checks h1 (
every public page carries exactly one h1) does not race the same way: on every page type, the h1 is.page-titleitself and renders unconditionally, so its presence never depends on the async data that gates the h2 cards.Proof
Negative control: a scratch copy of the unfixed assertions against
overviewStubs()with/api/v1/chainlocksdelayed 300ms (delays the profile-dependent second fetch phase, so the h2 cards render later while the h1 does not) reproduced the exact CI failure --h2 count 0-- deterministically. Control file sha256:64730e33d7c7c56adb3f6c7046071dc8d10214abe443b3170c8fc0df948d0a11(scratch copy, not committed). Adding the same one-line wait to that copy: 10/10 green under the induced delay.With the fix, real file:
npx playwright test e2e/accessibility.spec.ts --repeat-each=5: 90/90 passed.npx playwright test e2e/accessibility.spec.ts --repeat-each=20: 359/360 passed -- the one failure is a different, pre-existing test (the header poll does not take the focus, line 207, usespage.clock.install/fastForward), reproduced in isolation at 1/20 with--workers=1. Unrelated to this change (different locators, different mechanism, fails before the focus assertions even run) and out of scope here; flagging it, not fixing it in this PR.npx playwright test: 299/299 passed.Not part of this change: A8 (
feature_llmq_q60_proto_floor.py, Core) -- a separate, unrelated CI flake.🤖 Generated with Claude Code