feat(mcp): add browser_emulate_media tool and --color-scheme option - #42244
Lars Kiesow (lkiesow) wants to merge 1 commit into
Conversation
Lets agents check a UI in both light and dark mode. The tool wraps page.emulateMedia, so reduced motion, forced colors, contrast and the print media type are covered as well. Omitted parameters keep their current emulation state. --color-scheme (and PLAYWRIGHT_MCP_COLOR_SCHEME) maps to contextOptions.colorScheme so a whole session can start in dark mode. Fixes microsoft#42243
|
Sorry, in the contributor.md, I missed the
Closing this for now, but happy to provide the patch again |
|
Your patch looks good, please feel free to reopen it as is. I'd probably have playwright-cli set- in the CLI instead of passing camelCase options though. |
| description: 'Emulate CSS media features for the page, for example switch between the light and dark color scheme. Omitted parameters are left unchanged.', | ||
| inputSchema: z.object({ | ||
| colorScheme: z.enum(['light', 'dark']).optional().describe('Emulates the prefers-color-scheme media feature'), | ||
| reducedMotion: z.enum(['reduce', 'no-preference']).optional().describe('Emulates the prefers-reduced-motion media feature'), |
There was a problem hiding this comment.
let's use kebob case to be consistent with other options
Test results for "MCP"6 failed 8171 passed, 1391 skipped Merge workflow run. |
|
Closing as stale. |
Lets agents check a UI in both light and dark mode. The tool wraps page.emulateMedia, so reduced motion, forced colors, contrast and the print media type are covered as well. Omitted parameters keep their current emulation state.
--color-scheme (and PLAYWRIGHT_MCP_COLOR_SCHEME) maps to contextOptions.colorScheme so a whole session can start in dark mode.
Fixes #42243