chore: fix flaky scroll test#13063
Conversation
|
| await page.goto('/anchor'); | ||
| await page.evaluate(() => window.scrollTo(0, 1000)); | ||
| // wait for the scroll to be processed before jumping to the next page | ||
| await page.waitForTimeout(1000); |
There was a problem hiding this comment.
do we need a full second here or should we reduce it to 100ms or sth? Also is the same needed after the second scroll? A nicer way could be to await the fact that scrollY is 1000 🤔
There was a problem hiding this comment.
Perhaps you could use page.waitForFunction to avoid a timeout and instead wait for the page position to make it to 1000 pixels?
|
I implemented this directly in #12270 using |
|
Thanks! I'm going to close this in favor of #12270 since that PR is green now |
This PR adds a timeout to ensure the initial scroll has occurred in the browser. It should help with the consistent failures when running the test in vite-ecosystem-ci where the test is too quick and the initial scroll is skipped.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits