#54947: test: capture corner-smoothing pages until a frame matches
Description of Change
The -electron-corner-smoothing reference-image tests fail intermittently. Most failures are on Linux ASan; there are a few on Windows.
The test loads the page, shows the window, waits one requestAnimationFrame and calls capturePage().
The window paints while it is still hidden and loading the page.
The frame painted for that animation frame can reach the compositor after the capture is taken. On a slow renderer, the capture then returns a frame from mid-load.
Every capture uploaded by failing CI runs shows such a frame:
- 9 from
linux-x64-asan: a partly parsed page with fewer rows. - 2 from Windows: the image partly or fully unpainted.
Their average difference from the reference ranges from 7.6 to 216, against a tolerance of 2.5. The corner shapes in those captures are correct.
This change captures a new frame, one animation frame apart, until the page matches the reference or 5 seconds pass.
The page is static, so the captures converge on its final rendering.
The tolerance and the reference images are unchanged:
- A page rendered with the feature in the wrong state differs from the reference by 5.73 and still fails.
- The tolerance comment gave 7.3 for that difference. It now gives the real figure.
- The failure message now reports the measured difference and the number of captures taken.
Before and after on Linux, with an injected slow renderer paint and a stale frame in the surface:
- The old recipe failed 11 of 18 tests.
- The new one passed all 18, recovering from 6 stale captures on the next frame.
🤖 Generated with Claude Code
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
- tests are changed or added
Release Notes
Notes: none
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron