chore: support channel and executable path params (#90)

Fixes https://github.com/microsoft/playwright-mcp/issues/89
This commit is contained in:
Pavel Feldman
2025-03-31 15:30:08 -07:00
committed by GitHub
parent d316441142
commit 9042c03faa
6 changed files with 69 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ test('test tool list', async ({ client, visionClient }) => {
'browser_wait',
'browser_save_as_pdf',
'browser_close',
'browser_install',
]);
const { tools: visionTools } = await visionClient.listTools();
@@ -53,6 +54,7 @@ test('test tool list', async ({ client, visionClient }) => {
'browser_wait',
'browser_save_as_pdf',
'browser_close',
'browser_install',
]);
});
@@ -353,3 +355,14 @@ test('save as pdf', async ({ client }) => {
});
expect(response).toHaveTextContent(/^Saved as.*page-[^:]+.pdf$/);
});
test('executable path', async ({ startClient }) => {
const client = await startClient({ args: [`--executable-path=bogus`] });
const response = await client.callTool({
name: 'browser_navigate',
arguments: {
url: 'data:text/html,<html><title>Title</title><body>Hello, world!</body></html>',
},
});
expect(response).toContainTextContent(`executable doesn't exist`);
});

View File

@@ -71,6 +71,7 @@ export const test = baseTest.extend<Fixtures>({
cdpEndpoint: async ({ }, use, testInfo) => {
const port = 3200 + (+process.env.TEST_PARALLEL_INDEX!);
const browser = await chromium.launchPersistentContext(testInfo.outputPath('user-data-dir'), {
channel: 'chrome',
args: [`--remote-debugging-port=${port}`],
});
await use(`http://localhost:${port}`);