Contribution Date
Contribution Project
Contribution Details
A click that lands before hydration does nothing, and says so 30s later
The browser suite's flakiness had one cause. Playwright's `click()` waits for an
element to be actionable — attached, visible, stable, unobscured — and cannot wait for
a Svelte handler to be attached, because the DOM does not expose that. A click landing
between first paint and hydration hits a button that looks completely ready and does
nothing at all. No request goes out, no panel opens, and the failure appears later as
`element(s) not found` on whatever the click was supposed to produce.
**The distribution is what proved it.** No settling pattern existed anywhere in the
suite, and 85 places navigate and then immediately click or fill — 30 of them in
`browse.e2e.ts`. That file appeared in every failure list while passing 52 of 52 in
isolation, three times running. Failures tracked unsettled navigations rather than any
particular test, which is why five observations named five different tests.
Fixed at the fixture. `page.goto` settles before it returns, so the guarantee is a
property of navigation rather than a line somebody remembers to write. Eighty-five
`waitForLoadState` calls would have fixed the eighty-five that exist and none of the
ones written next month.
**One test opts out, and it found itself.** `branding.e2e.ts` asserts that a customer's
header never flashes the vendor's name *while branding is still loading* — visible only
before the load completes. Settling unconditionally made it watch the settled page and
fail, correctly. An explicit `waitUntil` now means the test knows which moment it wants
and the fixture stands aside.
**Measured rather than declared.** Before: `--workers=4` failed two tests reliably, and
three default runs lost 4, 3 and 1 of 410 with no test failing twice. After: three
`--workers=4` runs clean at 410, one failure across three default runs. That is a large
reduction and not a cure, so the CI retries stay — covering a rare residue now instead
of masking a systematic race.
Contribution Issue Link
Files count
0
Patches count
1