Skip to content

fix: find app iframe by selector in chrome-remote-debugging hover task#937

Merged
mschile merged 1 commit into
masterfrom
mschile/fix-hover-pseudo-reporter-iframe
Jul 16, 2026
Merged

fix: find app iframe by selector in chrome-remote-debugging hover task#937
mschile merged 1 commit into
masterfrom
mschile/fix-hover-pseudo-reporter-iframe

Conversation

@mschile

@mschile mschile commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Problem

In examples/fundamentals__chrome-remote-debugging, the activateHoverPseudo CDP task assumed the application-under-test was the first iframe in the flattened document:

const filtered = allRootNodes.nodes.filter(isIframe)
// The first IFrame is our App
const root = filtered[0].contentDocument

Cypress PR #34242 (reporter-in-iframe) renders the Cypress reporter/command-log into its own same-origin #reporter-frame iframe, which sorts before the AUT iframe (#unified-runner) in document order. That makes filtered[0] the reporter frame, so DOM.querySelector finds nothing, nodeId is undefined, and CSS.forcePseudoState throws Error: Could not find node with given id.

This currently fails the test-binary-against-recipes-chrome CI job on that Cypress PR (spec spec.cy.js, test "Hover pseudo element is active").

Fix

Search each same-origin iframe for the target selector rather than assuming a fixed position. This is robust to the reporter iframe, the app iframe, and any nesting/ordering.

Verification

Ran the recipe locally against Cypress 15.17.0 — all 6 tests pass, including "Hover pseudo element is active":

✓ Printable div is not visible normally
✓ Printable div is visible with 'print' media query
✓ Hover pseudo element is inactive normally
✓ Hover pseudo element is active
✓ check visibility of div
✓ div should be visible again before print media query is activated
6 passing

The change is backward-compatible with the current released runner (single AUT iframe) and forward-compatible with the reporter-in-iframe layout.

🤖 Generated with Claude Code

The reporter now renders in its own same-origin iframe, so the
`activateHoverPseudo` CDP task can no longer assume the app is the first
iframe. Search each iframe for the target selector instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mschile mschile self-assigned this Jul 16, 2026
@mschile
mschile requested a review from ryanthemanuel July 16, 2026 13:53
@cypress

cypress Bot commented Jul 16, 2026

Copy link
Copy Markdown

cypress-example-recipes    Run #132000

Run Properties:  status check passed Passed #132000  •  git commit cabd809dca: fix: find app iframe by selector in chrome-remote-debugging hover task
Project cypress-example-recipes
Branch Review mschile/fix-hover-pseudo-reporter-iframe
Run status status check passed Passed #132000
Run duration 12m 18s
Commit git commit cabd809dca: fix: find app iframe by selector in chrome-remote-debugging hover task
Committer Matthew Schile
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 36
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 634
View all changes introduced in this branch ↗︎
UI Coverage  15.53%
  Untested elements 99  
  Tested elements 52  
Accessibility  71.21%
  Failed rules  7 critical   10 serious   4 moderate   1 minor
  Failed elements 549  

@mschile
mschile merged commit acb5cfa into master Jul 16, 2026
158 of 159 checks passed
@mschile
mschile deleted the mschile/fix-hover-pseudo-reporter-iframe branch July 16, 2026 14:20
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