Skip to content

test(e2e): the wheel fling settles on a rest within a pixel of a row and is released inside one task - #574

Merged
arrzdev merged 1 commit into
mainfrom
test/wheel-fling-settle
Nov 17, 2026
Merged

arrzdev merged 1 commit into
mainfrom
test/wheel-fling-settle

Conversation

@arrzdev

@arrzdev arrzdev commented Nov 17, 2026

Copy link
Copy Markdown
Owner

wheel-column.spec.ts "a fast mouse fling coasts past where the pointer let go" failed on CI (plain cell, chromium) with expect.poll(...).toBeLessThanOrEqual(1) receiving 29 after the 10 s timeout. Two timing weaknesses in the test, no component bug:

  1. settle() read a legal rest as unsettled. WheelColumn.commit() only rolls to the row when the drum is more than 1px off it, so a coast that ends 1px short of a row (scrollTop = 30k - 1) is left there. settle() checked scrollTop % 30 <= 1, which reads that rest as 29 and polled to the timeout. It now takes the distance to the nearest row.
  2. The fling's release could land outside the 80 ms velocity window. The wheel reads the release speed from the last 80 ms of moves; the test spaced them with setTimeout(16). On a loaded machine a timer runs 100 ms+ late, one move is left in the window, the drag reads as stopped and does not coast. I hit this locally at load average ~30 (top stayed at 330, Expected: > 330). The fling is now played in one task with the gaps spun on performance.now(), so nothing can land between events.

A new test pins (1) without needing the race: a scrollTop write 1px short of a row must stay put and count as settled.

Reproduce: with the old settle(), pnpm --dir playground test:e2e:plain --project=chromium --grep "rest 1px short" fails with Received: 29.

Verify:

  • old settle() + the new rest test: fails, Expected: <= 1 Received: 29
  • pnpm --dir playground test:e2e:plain --project=chromium --grep "fast mouse fling" --repeat-each 10: 10 passed
  • --grep "fast mouse fling|rest 1px short" --repeat-each 30: 60 passed (load average ~30 on the machine)
  • pnpm --dir playground test:e2e:plain --project=chromium e2e/wheel-column.spec.ts: 10 passed, 1 skipped (the WebKit-only test)
  • biome check and tsc --noEmit in playground/: clean

Tested on: chromium, plain cell. Not tested: webkit (the fling tests skip there), the sw cells; CI gate.

@arrzdev
arrzdev marked this pull request as ready for review November 17, 2026 06:18
@arrzdev
arrzdev merged commit a335abe into main Nov 17, 2026
4 checks passed
@arrzdev
arrzdev deleted the test/wheel-fling-settle branch November 17, 2026 06:21
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