Skip to content

feat(mcp): add media emulation - #42668

Merged
Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-42243
Sep 14, 2026
Merged

Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-42243

Conversation

@yury-s

@yury-s Yury Semikhatsky (yury-s) commented Sep 11, 2026

Copy link
Copy Markdown
Member

Summary

  • add a default MCP tool for setting and clearing page media emulation
  • add paired set-* and clear-* commands under the playwright-cli Emulation category

Fixes #42243

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 flaky ⚠️ [chromium-library] › library/video.spec.ts:664 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node22`
⚠️ [chromium-page] › page/workers.spec.ts:191 › should attribute network activity for worker inside iframe to the iframe `@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`
⚠️ [firefox-page] › page/page-event-request.spec.ts:181 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`

51691 passed, 1247 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

6 failed
❌ [chrome] › mcp/cli-route.spec.ts:38 › route with content-type @mcp-macos-latest-chrome
❌ [chromium] › mcp/webmcp.spec.ts:178 › browser_webmcp_call disambiguates duplicate tool names by frame @mcp-macos-latest-chromium
❌ [firefox] › mcp/cli-core.spec.ts:248 › click in iframe @mcp-windows-latest-firefox
❌ [firefox] › mcp/cli-devtools.spec.ts:115 › per-part commands extract individual parts @mcp-windows-latest-firefox
❌ [firefox] › mcp/cli-devtools.spec.ts:173 › response-body returns just the body @mcp-windows-latest-firefox
❌ [firefox] › mcp/cli-drag.spec.ts:19 › drag between elements @mcp-windows-latest-firefox

8545 passed, 1446 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Five of the six failures are known flakes; one I can't call either way

Hi, I'm the Playwright bot and I took a look at the failing CI. Four of the six are the same
mcp-windows-latest-firefox shard misbehaving — all four tests flake there regularly on unrelated
SHAs. The webmcp one flaked twice elsewhere in the last day. The cli-route timeout on macOS/chrome
has no history at all, so I'm leaving it uncertain rather than calling it clean.

Details

The latest merged report lists 6
failures from test run 34655556923.
This PR adds MCP media emulation — tools/backend/emulation.ts, the set-*/clear-* Emulation CLI
commands, and the new cli-emulation.spec.ts / emulation.spec.ts tests. The only shared-code edits
are additive: a new emulation entry in browserTools, an 'emulation' string added to the CLI
Category union, and a value === null early return in formatObject. None of the failing tests
exercises that path.

Note the PR's own new tests — mcp/cli-emulation.spec.ts and mcp/emulation.spec.ts — all passed in
this run, on every engine and OS.

Pre-existing flake / infra

Uncertain

  • [chrome] › mcp/cli-route.spec.ts:38 › route with content-type (macos) — a bare Test timeout of 30000ms exceeded. with no other error, and the test is otherwise spotless: 0 failures across ~728 chrome runs and none on any other engine in the DB. So there's no prior occurrence to point at, and by the flake bar that's not enough to call it pre-existing. Nothing points at this PR either — it doesn't touch routing, and the naked timeout with no assertion detail reads like macOS runner slowness. A re-run would settle it.

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.

[MCP]: switch between light and dark color scheme

2 participants