|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
| 17 | +import fs from 'fs/promises'; |
| 18 | + |
17 | 19 | import { test, testWithOldExtensionVersion, expect, extensionId, clickAllowAndSelect, startWithExtensionFlag } from './extension-fixtures'; |
18 | 20 | import { utils } from '../../packages/playwright-core/lib/coreBundle'; |
19 | 21 |
|
@@ -231,6 +233,28 @@ test(`extension needs update`, async ({ startExtensionClient, server }) => { |
231 | 233 | await expect(confirmationPage.locator('.status-banner')).toContainText(`Playwright client trying to connect requires newer extension version`); |
232 | 234 | }); |
233 | 235 |
|
| 236 | +test(`custom executablePath skips local extension check`, { |
| 237 | + annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright-mcp/issues/1590' }, |
| 238 | +}, async ({ startClient, server }) => { |
| 239 | + const executablePath = test.info().outputPath('echo.sh'); |
| 240 | + await fs.writeFile(executablePath, '#!/bin/bash\necho "Custom exec args: $@" > "$(dirname "$0")/output.txt"', { mode: 0o755 }); |
| 241 | + |
| 242 | + // Empty profile would normally fail the extension-installed check; it is skipped when executablePath is set. |
| 243 | + const { client } = await startClient({ |
| 244 | + args: [`--extension`, `--executable-path=${executablePath}`], |
| 245 | + env: { PWTEST_EXTENSION_USER_DATA_DIR: test.info().outputPath('empty-profile') }, |
| 246 | + }); |
| 247 | + |
| 248 | + client.callTool({ |
| 249 | + name: 'browser_navigate', |
| 250 | + arguments: { url: server.HELLO_WORLD }, |
| 251 | + }).catch(() => {}); |
| 252 | + await expect(async () => { |
| 253 | + const output = await fs.readFile(test.info().outputPath('output.txt'), 'utf8'); |
| 254 | + expect(output).toMatch(new RegExp(`Custom exec args.*chrome-extension://${extensionId}/connect\\.html\\?`)); |
| 255 | + }).toPass(); |
| 256 | +}); |
| 257 | + |
234 | 258 | test(`fails when extension is missing in custom userDataDir`, async ({ startClient, server }) => { |
235 | 259 | const userDataDir = test.info().outputPath('empty-profile'); |
236 | 260 |
|
|
0 commit comments