Skip to content

browser: fix flaky TestPageScreenshotFullpage - #5985

Merged
mstoykov merged 1 commit into
masterfrom
fix-page-screenshot-fullpage-flake
Jun 8, 2026
Merged

browser: fix flaky TestPageScreenshotFullpage#5985
mstoykov merged 1 commit into
masterfrom
fix-page-screenshot-fullpage-flake

Conversation

@mstoykov

Copy link
Copy Markdown
Contributor

What?

After injecting the gradient <div> in TestPageScreenshotFullpage, wait for two requestAnimationFrames before taking the full-page screenshot, so Chromium is guaranteed to have laid out and painted the new content.

Why?

The test intermittently fails on CI with the bottom pixel coming back white (e.g. R: 65535, B: 65535) instead of the expected dominant blue. The Evaluate call resolves as soon as the JS returns, but the appended gradient node is not guaranteed to have been painted before the subsequent Page.captureScreenshot CDP call. On a slow/contended runner the screenshot can race the first paint and capture the still-white background. Awaiting two rAFs ensures a frame has been committed before the screenshot is requested.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Related PR(s)/Issue(s)

🤖 Generated with Claude Code

Wait for the browser to commit a frame after injecting the gradient div
so the screenshot captures the painted gradient instead of racing the
first paint and getting a white background on slow CI runners.
@mstoykov
mstoykov requested a review from a team as a code owner May 14, 2026 10:45
@mstoykov
mstoykov requested review from inancgumus and oleiade and removed request for a team May 14, 2026 10:45
@mstoykov
mstoykov temporarily deployed to azure-trusted-signing May 14, 2026 10:51 — with GitHub Actions Inactive
@mstoykov
mstoykov temporarily deployed to azure-trusted-signing May 14, 2026 10:54 — with GitHub Actions Inactive

@inancgumus inancgumus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤞

@mstoykov mstoykov added this to the v2.1.0 milestone May 14, 2026
@mstoykov
mstoykov merged commit 2bdb71f into master Jun 8, 2026
52 checks passed
@mstoykov
mstoykov deleted the fix-page-screenshot-fullpage-flake branch June 8, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants