Skip to content

fix(highlight): highlight in the world the selector resolves in - #42864

Merged
Yury Semikhatsky (yury-s) merged 1 commit into
microsoft:mainfrom
yury-s:fix-42849
Sep 22, 2026
Merged

Yury Semikhatsky (yury-s) merged 1 commit into
microsoft:mainfrom
yury-s:fix-42849

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • Custom selector engines registered without contentScript run in the main world, but HighlightController only rendered highlights in the utility world, so locator.highlight() matched nothing for them
  • Resolve each highlight in the world its selector needs and clear both worlds in hideHighlights()

Fixes #42849

Custom selector engines registered without contentScript run in the
main world, but HighlightController only rendered highlights in the
utility world, so such engines could not see page globals and matched
nothing. Resolve each selector to its world, set highlights there, and
clear both worlds in hideHighlights.

Fixes: microsoft#42849
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

6 flaky ⚠️ [chromium-library] › library/video.spec.ts:725 › screencast › should capture full viewport on hidpi `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:690 › screencast › should capture full viewport `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/beforeunload.spec.ts:130 › should support dismissing the dialog multiple times `@chromium-ubuntu-22.04-node22`
⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`

52087 passed, 1252 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

4 failed
❌ [chrome] › mcp/cli-devtools.spec.ts:285 › video-show-actions and video-hide-actions @mcp-macos-latest-chrome
❌ [firefox] › mcp/cli-drag.spec.ts:19 › drag between elements @mcp-windows-latest-firefox
❌ [firefox] › mcp/cli-session.spec.ts:54 › idle timeout shuts the session down @mcp-windows-latest-firefox
❌ [msedge] › mcp/http.spec.ts:145 › http transport browser sigint @mcp-windows-latest-msedge

8688 passed, 1474 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Nothing here points at this PR, but one failure I can't fully clear

Hi, I'm the Playwright bot and I triaged the failing CI runs.

Three of the four MCP failures are known flakes with history on unrelated SHAs. The fourth — mcp/cli-devtools.spec.ts:285 on Chrome — is a bare 30s timeout I can't tie to anything, and it has no prior history, so I'm leaving it as uncertain rather than calling it clean. The tests 1 report has no failures, only 6 flaky.

Details

This PR touches highlightController.ts (resolving highlights in the selector's world) plus one new test in tests/library/locator-highlight.spec.ts. None of the four failing tests exercise highlighting.

Pre-existing flake / infra

Uncertain

  • [chrome] › mcp/cli-devtools.spec.ts:285 › video-show-actions and video-hide-actions @mcp-macos-latest-chromeTest timeout of 30000ms exceeded., no assertion error. The test only checks CLI output strings for video-show-actions / video-hide-actions; it never highlights anything, so the diff has no path to it and the signature reads like a stuck CLI/browser launch. But this is the only failure of this test in 732 runs in the aggregated results, and all of them are on this PR — so I can't cite it failing anywhere the PR isn't responsible for, and the flake rule says that's not proof. A re-run on the same sha, or one green run of this test elsewhere, would settle it.

Triaged by the Playwright bot - agent run

@yury-s
Yury Semikhatsky (yury-s) merged commit a8266a5 into microsoft:main Sep 22, 2026
42 of 45 checks passed
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.

[Bug]: 1.63 regression - Locator.highlight does not work with custom selector engines that rely on global variables

2 participants