Skip to content

test(desktop): deflake mid-scroll older-history spinner smoke test#1632

Merged
wesbillman merged 1 commit into
mainfrom
pinky/fix-scroll-history-flake
Jul 8, 2026
Merged

test(desktop): deflake mid-scroll older-history spinner smoke test#1632
wesbillman merged 1 commit into
mainfrom
pinky/fix-scroll-history-flake

Conversation

@wesbillman

Copy link
Copy Markdown
Collaborator

Why

main CI is intermittently red on Desktop Smoke E2E (4): the scroll-history.spec.ts test "older-history spinner stays visible in viewport while fetching mid-scroll" fails expect(scrollTop).toBeGreaterThan(8) with 0 on all 3 retries (runs 28915175821, 28891719863). The test file hadn't changed since #1533 and the failing commits didn't touch scroll code — it's test flake, not a product regression.

What

The test drove the timeline with three mouse.wheel gestures separated by fixed 100ms sleeps, then asserted the timeline ended up mid-scroll. Wheel delta handling varies across CI environments, so the net position sometimes landed at scrollTop 0 — the one position the test must avoid.

Replaced the wheel choreography with deterministic scrollTop writes:

  1. park at scrollTop = 150 to trigger the older-history fetch (same pattern the sibling "never overlap" test uses),
  2. wait for the spinner,
  3. jump one viewport down while the 2s-delayed fetch is still in flight,
  4. assert the spinner is still visible, pinned within the viewport, and the reader is away from the top.

Same assertion targets as before — only the flaky input choreography changed.

Verification

  • --repeat-each=10 on the target test: 10/10 pass
  • Full scroll-history.spec.ts smoke suite: 15/15 pass
  • pnpm typecheck, pnpm lint, pnpm check: clean

(Note: two other recent red runs on main were runner-infra apt failures installing Playwright deps — packages.microsoft.com clearsign errors — self-healing, not addressable in-repo.)

The "older-history spinner stays visible in viewport while fetching
mid-scroll" smoke test drove the timeline with three mouse.wheel
gestures and fixed 100ms sleeps, then asserted scrollTop > 8. Wheel
delta handling varies across CI runners, so the final net position
sometimes landed at scrollTop 0 — failing the assertion on all
retries and intermittently breaking main (e.g. runs 28915175821,
28891719863) with no related code change.

Replace the wheel choreography with direct scrollTop writes: park at
150 to trigger the older fetch, wait for the spinner, then jump one
viewport down while the fetch is still in flight. Deterministic
mid-scroll position, same assertion targets (spinner visible + pinned
within the viewport away from the top).

Verified locally: 10/10 repeats pass; full scroll-history smoke suite
passes.

Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: Wes <wesbillman@users.noreply.github.com>
@wesbillman wesbillman merged commit 7ff58d9 into main Jul 8, 2026
25 checks passed
@wesbillman wesbillman deleted the pinky/fix-scroll-history-flake branch July 8, 2026 14:27
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