Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test(mcp): add a test for custom executable path (#37312)

Pavel Feldmancc8c05b10444
diff --git a/.github/workflows/tests_components.yml b/.github/workflows/tests_components.yml
index 39f33c9455..020e60d37c 100644
--- a/.github/workflows/tests_components.yml
+++ b/.github/workflows/tests_components.yml
@@ -9,6 +9,8 @@ on:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
+ - 'packages/playwright/src/mcp/**'
+ - 'tests/mcp/**'
branches:
- main
- release-*
diff --git a/.github/workflows/tests_primary.yml b/.github/workflows/tests_primary.yml
index 0a6f2e1857..1673f2f104 100644
--- a/.github/workflows/tests_primary.yml
+++ b/.github/workflows/tests_primary.yml
@@ -9,6 +9,8 @@ on:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
+ - 'packages/playwright/src/mcp/**'
+ - 'tests/mcp/**'
branches:
- main
- release-*
diff --git a/tests/mcp/config.spec.ts b/tests/mcp/config.spec.ts
index a6d8151e12..b7109f9cd9 100644
--- a/tests/mcp/config.spec.ts
+++ b/tests/mcp/config.spec.ts
@@ -46,6 +46,17 @@ test('config user data dir', async ({ startClient, server, mcpMode }, testInfo)
expect(files.length).toBeGreaterThan(0);
});
+test('executable path', async ({ startClient, server }, testInfo) => {
+ const { client } = await startClient({ args: ['--executable-path', testInfo.outputPath('missing-executable')] });
+ expect(await client.callTool({
+ name: 'browser_navigate',
+ arguments: { url: server.PREFIX },
+ })).toHaveResponse({
+ isError: true,
+ result: expect.stringMatching(/Failed to launch.*missing-executable/),
+ });
+});
+
test.describe(() => {
test.use({ mcpBrowser: '' });
test('browserName', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright-mcp/issues/458' } }, async ({ startClient, mcpMode }, testInfo) => {