Skip to content

fix: calculate pixel ratio based on actual screenshot data in case of oopif - #1331

Merged
shadowusr merged 1 commit into
masterfrom
users/shadowusr/INFRADUTY-30514.fix-v3
Oct 14, 2026
Merged

shadowusr merged 1 commit into
masterfrom
users/shadowusr/INFRADUTY-30514.fix-v3

Conversation

@shadowusr

Copy link
Copy Markdown
Member

What's done?

This is a second iteration of out-of-process-iframe fix. In the first fix, we relied on the fact that after screenshot pixel ratio should be correct. However, it turned out that there are race conditions possible when a page has iframe appearing in between capturing screenshot and getting pixelRatio value.

The new logic computes pixel ratio by dividing physical pixel screenshot width by css viewport width. This one should be 100% reliable.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T22:02:54.125541Z 064716e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

✅ Testplane browser-env run succeed

Report

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

✅ Testplane E2E run succeed

Report

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48c022db88

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/browser/screen-shooter/validation/index.ts Outdated
@pkg-pr-new

pkg-pr-new Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/testplane@1331

commit: 064716e

@KuznetsovRoman KuznetsovRoman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suggest adding some kind of comment to "css pixels" x "png pixels" comparison so at least it would be clear trade-off.

Besides, /ok

@shadowusr
shadowusr force-pushed the users/shadowusr/INFRADUTY-30514.fix-v3 branch from e79f7ce to 1f4d00b Compare September 30, 2026 19:25
@shadowusr
shadowusr force-pushed the users/shadowusr/INFRADUTY-30514.fix-v3 branch from 1f4d00b to 064716e Compare October 14, 2026 21:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 064716e69a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +18 to +20
const pixelRatio = imageSize.width / viewportSizeInCss.width;
if (Math.abs(imageSize.height - viewportSizeInCss.height * pixelRatio) > 1) {
throw new Error(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate against the cropped viewport dimensions

When screenshotMode is fullpage (or auto detects a full-page bitmap), Camera.captureViewportImage stores the document-sized calibrated area in uncroppedSize before cropping the returned image to the viewport. Comparing that height with the CSS viewport here therefore always exceeds the tolerance on scrollable pages and throws the generic consistency error, so mobile-emulated viewport and element captures fail without reaching the DPR retry. The validation needs dimensions representing the viewport before user margins, rather than the raw full-page dimensions.

Useful? React with 👍 / 👎.

@shadowusr
shadowusr merged commit 63bf133 into master Oct 14, 2026
7 of 9 checks passed
@shadowusr
shadowusr deleted the users/shadowusr/INFRADUTY-30514.fix-v3 branch October 14, 2026 23:16
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.

2 participants