-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(mcp): add experimental MCP interface to test server #35312
base: main
Are you sure you want to change the base?
Conversation
@@ -36,3 +36,12 @@ export const chokidar = chokidarLibrary; | |||
|
|||
import * as getEastAsianWidthLibrary from 'get-east-asian-width'; | |||
export const getEastAsianWidth = getEastAsianWidthLibrary; | |||
|
|||
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This grows the utils bundle from 200kb to 300kb. If that's too much, I guess we could write our own implementation. Not sure if that's worth it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces an experimental MCP interface for the test server, adding support for MCP-based tools in both the test harness and the server.
- Adds integration tests for MCP functionality in Playwright tests.
- Implements MCP server functionality with tool registration for listing and running tests.
- Updates common fixtures and utility bundles to support MCP client and server components.
Reviewed Changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/playwright-test/ui-mode-mcp.spec.ts | Adds integration tests that leverage the experimental MCP interface. |
packages/playwright/src/runner/mcp.ts | Introduces MCP server functionality with tool registration (“listTests” and “runTests”). |
tests/config/commonFixtures.ts | Implements an attachMCP function to support MCP in test processes. |
packages/playwright/src/utilsBundle.ts | Exports MCP-related utilities and types. |
packages/playwright/bundles/utils/src/utilsBundleImpl.ts | Re-exports MCP server components and zod schema validation. |
packages/playwright/src/runner/testServer.ts | Starts the MCP server when the PW_MCP flag is set. |
Files not reviewed (2)
- package.json: Language not supported
- packages/playwright/bundles/utils/package.json: Language not supported
try { | ||
const parsed = JSON.parse(message); | ||
transport.onmessage?.(parsed); | ||
} catch {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swallowing errors in the JSON.parse block may hinder debugging issues with incoming messages. Consider logging the error or providing a minimal handling mechanism to help diagnose malformed input.
} catch {} | |
} catch (error) { | |
console.error('Failed to parse message:', message, error); | |
} |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"5 flaky38822 passed, 809 skipped Merge workflow run. |
No description provided.