test(web): give the horizontal-wheel reading a smooth-scroll settle

The 0 the shipped column reports cannot be reached by polling for a settled
value, so the read is a fixed wait; make that wait cover a smooth-scroll
animation on any engine the lane runs on. Identical on both sides of the
mutation control, which is what keeps the 0 evidence rather than a race won.
This commit is contained in:
creatixchu
2026-08-04 15:08:36 +08:00
parent d7a162fc66
commit 21148232f5
@@ -125,12 +125,13 @@ async function wheelHorizontally(page: Page): Promise<number> {
}) })
await page.mouse.move(origin.x, origin.y) await page.mouse.move(origin.x, origin.y)
await page.mouse.wheel(300, 0) await page.mouse.wheel(300, 0)
// Two frames: the scroll applies during the frame the wheel is dispatched // A fixed settle, then two frames. Polling for a settled value cannot be
// into, and is readable in the next. Polling for a settled value cannot be
// used here — the value under test is 0, which a poll starting at 0 accepts // used here — the value under test is 0, which a poll starting at 0 accepts
// before the gesture has had any chance to move it. The timing is the same // before the gesture has had any chance to move it — so the wait is
// on both sides of the mutation control below, which is what makes a 0 // generous enough to cover a smooth-scroll animation on any engine the lane
// reading evidence rather than a race won. // runs on. The timing is identical on both sides of the mutation control
// below, which is what makes a 0 reading evidence rather than a race won.
await page.waitForTimeout(400)
return page.evaluate(() => new Promise<number>((resolve) => { return page.evaluate(() => new Promise<number>((resolve) => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
requestAnimationFrame(() => { requestAnimationFrame(() => {