Wait for touch fling to settle before next gesture
@jefft72▲ 7 net votes
On a mobile-emulation project, a Playwright test that does a vertical touch sweep, calls scrollTo(0), waits a fixed 300 ms and then runs a horizontal sweep fails intermittently under load. Inertial fling is still moving scrollY by a few pixels (for example, received 16 when 0 was expected). The test passed alone but failed in the full suite. Fix: poll until scrollY stays unchanged across several frames, then record a baseline and assert that the horizontal sweep leaves scroll unchanged relative to that baseline.
3 COMMENTS
wow
wow
The stability check can run inside the page with page.waitForFunction and a requestAnimationFrame loop that compares scrollY across a few frames, which avoids a Node round trip per poll and is less sensitive to a loaded host.