Skip to content

test(e2e): three assertions that fail on a busy runner no longer do - #290

Open
connorburgess wants to merge 1 commit into
spacesheep-dev:mainfrom
connorburgess:fix/e2e-flaky-assertions
Open

connorburgess wants to merge 1 commit into
spacesheep-dev:mainfrom
connorburgess:fix/e2e-flaky-assertions

Conversation

@connorburgess

Copy link
Copy Markdown
Contributor

What

Three end-to-end assertions that fail now and then on CI, on main and on unrelated branches, are changed to ask for what each test is about. No product code changes; only test/e2e/split.spec.ts, test/e2e/mobile.spec.ts and test/e2e/pool-surfaces.spec.ts.

Why

Of the last 300 CI runs, 70 failed, 10 of them on main. These three tests account for a good share of the ones I looked at (every failed run since 2026-11-30):

  • split.spec.ts:662, "…restores window.scrollY on close". Failed both attempts on main in run 46543174302, and in 47453784345, 47453784594, 47453783730 and 47498578403, on branches that change only server or docs files. The test scrolls the board to 120, opens the panel so that it covers the page, closes it, and expects window.scrollY to be 120 again. Under the covering panel the pointer is no longer on the list, so holdBoard does not hold the board. When a demo session adds a card above, the page keeps what is on screen in place by scrolling on by the card's height (52 px), and window.scrollY comes back as 172. That is the page behaving well, and the test failing. The test now records where each card sits in the window just before Esc, and asks that a card on the board before and after the close is where it was (within 2 px), and that the page is not back at the top.
  • mobile.spec.ts:1050, "Discard draft is an action in the tint, 44 tall". Failed both attempts on main in run 47396304100 and run 47470694290, each time with a height of 43.999969482421875 against >= 44. The assertion now allows 0.01 px for float rounding.
  • pool-surfaces.spec.ts, fromFirstTurn. Failed both attempts at pool-surfaces.spec.ts:188 in run 47497357272 and run 47453783586, at the helper's line if (await older.count()) await expect(page.locator("[data-swap]")).toHaveCount(0), with a count of 1. The pooled session grows through the run. For a while its newest page both still holds the switch and already has older turns behind it, so "Older turns" is shown and the switch row is on the page. The helper no longer asks for that; it only loads the older turns, which is what the tests that call it need.

Proof

On macOS, Node 22.23.2, against a build of this branch:

  • split.spec.ts:662 on main (e8bfe999), with --repeat-each=8 --retries=0: 6 failed, 2 passed, each failure Received: 52. Logging the page showed window.scrollY 172 and one more card on the board in each failing run.
  • The same test on this branch, with --repeat-each=30 --retries=0: 30 passed.
  • The changed test still catches what it is for. With window.scrollTo(0, y) taken out of the close branch in web/src/components/Shell.tsx, 4 of 4 runs failed.
  • npx playwright test test/e2e/mobile.spec.ts test/e2e/pool-surfaces.spec.ts test/e2e/split.spec.ts --retries=0: 77 passed, 34 skipped.
  • npm run typecheck exits 0. npx biome check on the three files reports no new diagnostics.

I could not make the mobile.spec.ts and pool-surfaces.spec.ts failures happen locally. Those two changes follow from the CI logs linked above.

Checklist

  • Every commit is signed off (git commit -s).
  • npm run typecheck passes; the three changed e2e files pass (the whole npm test and npm run test:e2e were not run locally).
  • No new source files.
  • No secret, real address, hostname or home path in code or fixtures.
  • No change to shared/*.
  • No line in CHANGELOG.md: tests only, nothing a person running the GUI would notice.

…he test is about

split.spec.ts:662 compared window.scrollY after the covering panel closed
with the number it had before it opened. Under the covering panel the
pointer is off the list, so the board is not held, and a demo session that
adds a card scrolls the page on by its height. The test now asks that a
card on the board before and after the close is where it was in the window.

mobile.spec.ts:1050 asked for a height of at least 44 and got
43.999969482421875 on the CI runner. It now allows for float rounding.

pool-surfaces.spec.ts fromFirstTurn asked for no switch row whenever
"Older turns" was shown. For a while the newest page both holds the
switch and has older turns behind it. The helper now only loads them.

Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant