feat(dialog): handle dialogs (#212)

This commit is contained in:
Pavel Feldman
2025-04-17 14:03:13 -07:00
committed by GitHub
parent 4b261286bf
commit 6481100bdf
10 changed files with 461 additions and 15 deletions

View File

@@ -22,19 +22,20 @@ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { spawn } from 'child_process';
type Fixtures = {
type TestFixtures = {
client: Client;
visionClient: Client;
startClient: (options?: { args?: string[] }) => Promise<Client>;
wsEndpoint: string;
cdpEndpoint: string;
};
// Cli options.
type WorkerFixtures = {
mcpHeadless: boolean;
mcpBrowser: string | undefined;
};
export const test = baseTest.extend<Fixtures>({
export const test = baseTest.extend<TestFixtures, WorkerFixtures>({
client: async ({ startClient }, use) => {
await use(await startClient());
@@ -98,11 +99,11 @@ export const test = baseTest.extend<Fixtures>({
browserProcess.kill();
},
mcpHeadless: async ({ headless }, use) => {
mcpHeadless: [async ({ headless }, use) => {
await use(headless);
},
}, { scope: 'worker' }],
mcpBrowser: ['chromium', { option: true }],
mcpBrowser: ['chromium', { option: true, scope: 'worker' }],
});
type Response = Awaited<ReturnType<Client['callTool']>>;