Skip to content

chore(recorder): render highlights via the shared element highlight - #42253

Open
Dmitry Gozman (dgozman) wants to merge 3 commits into
microsoft:mainfrom
dgozman:recorder-highlight
Open

chore(recorder): render highlights via the shared element highlight#42253
Dmitry Gozman (dgozman) wants to merge 3 commits into
microsoft:mainfrom
dgozman:recorder-highlight

Conversation

@dgozman

Copy link
Copy Markdown
Collaborator

Summary

  • Recorder highlights the current selector through the shared element highlight (Frame.addHighlight) instead of the UIState.
  • New internal aria-template=<json> selector engine, so that the highlighted aria template goes through the same code path.
  • Trace viewer highlights via injectedScript.addHighlight() directly.
  • Shared element highlight fixes: the action point element is created lazily, the rAF loop ignores glass panes and tolerates unqueryable selectors, and internal calls are not tracked as actions.
  • Highlights are confined to the frame the selector resolves to for now; cross-frame highlighting will be restored together with piercing frames support.

The recorder now highlights the current selector through the shared
element highlight, replacing the actionSelector in the UIState. The
trace viewer calls injectedScript.addHighlight() directly for the same
purpose. Frame.addHighlight does not require a Progress anymore.

Also fix a few issues in the shared element highlight this uncovered:
- The action point element is created lazily, so that highlights that
  never show it do not affect 'x-pw-action-point' selectors.
- The rAF loop ignores elements inside glass panes to avoid matching
  its own tooltips, and tolerates selectors that cannot be queried in
  the frame, e.g. those with frame steps.
- The recorder does not track internal calls, so that Frame.highlight
  calls coming from locator.highlight() do not interfere with the
  user-added highlights.
Introduce an internal 'aria-template=<json>' selector engine that matches
elements against the serialized aria template. The recorder and the trace
viewer now highlight the aria template through the same code path as the
highlighted selector, and the UIState does not carry any highlight state
anymore. Tooltips are skipped for aria-template highlights.
…pported

Highlights now resolve through the selector machinery, which confines a
plain selector to the frame it resolves to. Highlighting across frames
will be restored together with the piercing frames support.
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 flaky ⚠️ [chromium-library] › library/chromium/chromium.spec.ts:213 › should intercept service worker requests (main and within) `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-goto.spec.ts:90 › should work with Cross-Origin-Opener-Policy `@firefox-ubuntu-22.04-node20`

51122 passed, 1208 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

3 failed
❌ [firefox] › mcp/cli-core.spec.ts:77 › click with --modifiers @mcp-windows-latest-firefox
❌ [firefox] › mcp/cli-devtools.spec.ts:84 › request shows full request and response details @mcp-windows-latest-firefox
❌ [firefox] › mcp/cli-devtools.spec.ts:173 › response-body returns just the body @mcp-windows-latest-firefox

8098 passed, 1311 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures.

🟢 CI is clear — the 3 failures are pre-existing Firefox flakes

The three failing MCP tests all flip verdict on unrelated PRs and on main, and this PR only touches recorder highlighting and selector/frame code that the MCP CLI flow doesn't exercise. Nothing here looks caused by the change.

Details

The tests 1 report has 0 failures (3 flaky, retried green) — nothing to triage. The MCP report has 3 failures, all [firefox] on mcp-windows-latest-firefox.

Pre-existing flake / infra

All three are green on every other browser (chromium, webkit, chrome, msedge: 0 failures across ~2000 runs each), and this PR's diff — shared element highlight, aria-template= selector engine, recorder/trace-viewer highlight plumbing — doesn't reach the MCP CLI click/request/response paths.

Triaged by the Playwright bot - agent run

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