Skip to content

fix: fix pixel ratio mismatch on pages with out of process iframes - #1313

Merged
shadowusr merged 11 commits into
masterfrom
users/shadowusr/TESTPLANE-1098
Aug 25, 2026
Merged

fix: fix pixel ratio mismatch on pages with out of process iframes#1313
shadowusr merged 11 commits into
masterfrom
users/shadowusr/TESTPLANE-1098

Conversation

@shadowusr

@shadowusr shadowusr commented Aug 17, 2026

Copy link
Copy Markdown
Member

What's done?

  • Migrated to a new cross-platform chromium image, that supports headful mode
  • Implemented a e2e test that exposes an issue with out of process iframes
  • Implemented a fix for this behavior

The bug reproduces in headful chrome with pixel ratio emulation, when page has iframe on different origin that creates an iframe on the original origin. In this case, window.devicePixelRatio gets overridden by value inside that iframe (without emultation, because pixel ratio in iframes is not emulated)

@pkg-pr-new

pkg-pr-new Bot commented Aug 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 3694ab6

@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: e618a3c95a

ℹ️ 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 test/e2e/tests/dpr-oopif.testplane.js
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

✅ Testplane browser-env run succeed

Report

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

✅ Testplane E2E run succeed

Report

@shadowusr shadowusr changed the title test: add e2e test exposing out of process iframe device pixel ratio bug and migrate to new chromium image fix: fix pixel ratio mismatch on pages with out of process iframes Aug 18, 2026

@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: 73c0cdb205

ℹ️ 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 .github/workflows/standalone-e2e.yml
Comment thread .github/workflows/e2e.yml Outdated

@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: 90b9fa95ef

ℹ️ 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/client-scripts/screen-shooter/operations.ts Outdated
@shadowusr
shadowusr force-pushed the users/shadowusr/TESTPLANE-1098 branch from 90b9fa9 to bd5cbca Compare August 18, 2026 21:51

@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: bd5cbcac1f

ℹ️ 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/elements-screen-shooter.ts Outdated
Comment thread src/browser/commands/assert-view/index.js
@shadowusr
shadowusr force-pushed the users/shadowusr/TESTPLANE-1098 branch from bd5cbca to 16d24bd Compare August 20, 2026 16:08

@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: 16d24bd261

ℹ️ 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/elements-screen-shooter.ts
@shadowusr
shadowusr force-pushed the users/shadowusr/TESTPLANE-1098 branch from 16d24bd to 0acdf51 Compare August 25, 2026 19:29

@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: 9cba322d63

ℹ️ 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/elements-screen-shooter.ts

@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: e81ae56cd1

ℹ️ 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 +205 to +206
isHeadless: isHeadlessBrowser(chromeOptions),
emulatedPixelRatio: getEmulatedPixelRatio(chromeOptions),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply the DPR workaround to viewport captures

When headful mobile-emulated Chrome enters the same nested-OOPIF state and assertView is called without selectors, this capability-derived ratio is only passed to ElementsScreenShooter; the viewport path still calls prepareViewportScreenshot, which uses the incorrect live window.devicePixelRatio. With DPR 3 reported as 1, camera auto-detection sees the physical viewport screenshot as larger than the supplied viewport, treats it as full-page, and crops it to roughly one third of the expected dimensions. Propagate the preferred ratio through ViewportScreenShooter as well.

Useful? React with 👍 / 👎.

@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: 5f69156236

ℹ️ 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/elements-screen-shooter.ts Outdated

@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: 58e93eb16d

ℹ️ 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/commands/assert-view/index.js
@shadowusr
shadowusr force-pushed the users/shadowusr/TESTPLANE-1098 branch from 7832a65 to 3694ab6 Compare August 25, 2026 23:07

@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: 3694ab60ea

ℹ️ 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".

this._browserProperties.estimatedPixelRatioFromCapabilities,
);

opts.pixelRatioOverride = this._browserProperties.estimatedPixelRatioFromCapabilities;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the inferred DPR out of caller options

When the same options object is reused across browser sessions, this assignment persists the Chrome capability-derived DPR on the caller's object because getDefaultOpts mutates and returns that object, and a successful capture never removes the property. A subsequent capture in Firefox or a non-emulated browser then forwards the stale pixelRatioOverride even though DPR validation is disabled, causing computePixelRatio to scale all screenshot geometry with the previous browser's ratio. Store the override locally or clone the options before adding it.

Useful? React with 👍 / 👎.

@shadowusr
shadowusr merged commit f8f25d6 into master Aug 25, 2026
9 checks passed
@shadowusr
shadowusr deleted the users/shadowusr/TESTPLANE-1098 branch August 25, 2026 23:15
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