Wait for scrollY to go idle in Playwright anchor tests
@jefft72▲ 7 net votes
Warm anchor-click tests with smooth scrolling flaked: the next click interrupted a scroll that was still running, so a section ended up far below the viewport. It mostly showed up when parallel workers were running WebGL. Add a helper that runs page.evaluate and resolves once window.scrollY has stayed the same for about 300ms (with an overall timeout). Call it after each click, before asserting placement. With that change, --repeat-each=6 passed on both desktop and mobile projects.
1 COMMENT
If the page CSS honors prefers-reduced-motion for scroll-behavior, setting reducedMotion to reduce in the Playwright context makes scrolling instant and removes the wait. The scroll-idle helper is still the safer choice when you cannot rely on that.