Commit cc05b04
test: wait for stable page height before visual snapshots (#402)
* test: wait for stable page height before visual snapshots
After the Playwright 1.57 -> 1.60 (Chromium) bump in #400, math-heavy
fixture pages on mobile-chrome intermittently settled ~60px shorter
than their baselines (2888-2891px vs 2950px, varying between retries
of the same run). toHaveScreenshot fails on any full-page dimension
mismatch before pixel tolerances apply, so these flaked regardless of
the maxDiffPixelRatio already granted to math pages.
waitForReady now waits for document.fonts.ready and then polls until
the document height is unchanged for three consecutive 250ms polls,
replacing the fixed 500ms sleep after MathJax typesetting.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test: address Copilot review — font-wait timeout + misplaced waitForFunction options
- Update the waitForReady doc comment: pages without MathJax no longer
return immediately; the font and height-stability waits apply to all
pages.
- Give the document.fonts.ready wait the same explicit 15s timeout as
the other gates, via waitForFunction instead of evaluate.
- Fix a latent bug the second comment surfaced: waitForFunction's second
positional parameter is arg, not options, so the existing timeout (and
the new polling interval) were never applied. Options now go in the
third position on all three waits, making polling: 250 effective.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 0258896 commit cc05b04
2 files changed
Lines changed: 41 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
17 | 30 | | |
18 | 31 | | |
19 | 32 | | |
| |||
22 | 35 | | |
23 | 36 | | |
24 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
25 | 44 | | |
26 | 45 | | |
27 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
28 | 66 | | |
29 | 67 | | |
30 | 68 | | |
| |||
0 commit comments