| 18 | await page.evaluate( |
| 19 | async ({ maxFrames, minFrames, stableFrames }) => { |
| 20 | const getSnapshot = () => { |
| 21 | const scrollPositions = Array.from( |
| 22 | document.querySelectorAll( |
| 23 | '[data-testid="scroller"], [role="grid"], [role="list"]' |
| 24 | ) |
| 25 | ).map((element) => `${element.scrollLeft},${element.scrollTop}`); |
| 26 | |
| 27 | return [ |
| 28 | window.scrollX, |
| 29 | window.scrollY, |
| 30 | ...scrollPositions, |
| 31 | document.body.innerHTML |
| 32 | ].join("|"); |
| 33 | }; |
| 34 | |
| 35 | // WebKit on Linux (in CI) sometimes stops running animation frames; |
| 36 | // don't wait for more than a frame's worth of time (at a low frame rate) |