make test pass

This commit is contained in:
Simon Knott
2025-08-20 18:44:45 +02:00
parent 21e03968c5
commit 922002e435
2 changed files with 10 additions and 8 deletions

View File

@@ -57,7 +57,12 @@ async function main(config: FullConfig, connectionString: string, lib: string) {
const playwright = await import(lib).then(mod => mod.default ?? mod); const playwright = await import(lib).then(mod => mod.default ?? mod);
const factory = new VSCodeBrowserContextFactory(config, playwright, connectionString); const factory = new VSCodeBrowserContextFactory(config, playwright, connectionString);
await mcpServer.connect( await mcpServer.connect(
() => new BrowserServerBackend(config, factory), {
name: 'Playwright MCP',
nameInConfig: 'playwright-vscode',
create: () => new BrowserServerBackend(config, factory),
version: 'unused'
},
new StdioServerTransport(), new StdioServerTransport(),
false false
); );

View File

@@ -18,7 +18,7 @@ import { test, expect } from './fixtures.js';
test('browser_connect(vscode) works', async ({ startClient, playwright, browserName }) => { test('browser_connect(vscode) works', async ({ startClient, playwright, browserName }) => {
const { client } = await startClient({ const { client } = await startClient({
args: ['--connect-tool'], args: ['--vscode'],
}); });
const server = await playwright[browserName].launchServer(); const server = await playwright[browserName].launchServer();
@@ -26,14 +26,11 @@ test('browser_connect(vscode) works', async ({ startClient, playwright, browserN
expect(await client.callTool({ expect(await client.callTool({
name: 'browser_connect', name: 'browser_connect',
arguments: { arguments: {
name: 'vscode', connectionString: server.wsEndpoint(),
options: { lib: new URL('./index.js', import.meta.resolve('playwright')).pathname,
connectionString: server.wsEndpoint(),
lib: new URL('./index.js', import.meta.resolve('playwright')).pathname,
}
} }
})).toHaveResponse({ })).toHaveResponse({
result: 'Successfully changed connection method.' result: 'Successfully connected.'
}); });
expect(await client.callTool({ expect(await client.callTool({