devops: add bots for other browsers/platforms (#174)

This commit is contained in:
Yury Semikhatsky
2025-04-15 13:16:56 -07:00
committed by GitHub
parent 795a9d578a
commit 0d6bb2f547
6 changed files with 38 additions and 6 deletions

View File

@@ -28,6 +28,10 @@ type Fixtures = {
startClient: (options?: { args?: string[] }) => Promise<Client>;
wsEndpoint: string;
cdpEndpoint: string;
// Cli options.
mcpHeadless: boolean;
mcpBrowser: string | undefined;
};
export const test = baseTest.extend<Fixtures>({
@@ -40,12 +44,16 @@ export const test = baseTest.extend<Fixtures>({
await use(await startClient({ args: ['--vision'] }));
},
startClient: async ({ }, use, testInfo) => {
startClient: async ({ mcpHeadless, mcpBrowser }, use, testInfo) => {
const userDataDir = testInfo.outputPath('user-data-dir');
let client: StdioClientTransport | undefined;
use(async options => {
const args = ['--headless', '--user-data-dir', userDataDir];
const args = ['--user-data-dir', userDataDir];
if (mcpHeadless)
args.push('--headless');
if (mcpBrowser)
args.push(`--browser=${mcpBrowser}`);
if (options?.args)
args.push(...options.args);
const transport = new StdioClientTransport({
@@ -89,6 +97,12 @@ export const test = baseTest.extend<Fixtures>({
await use(`http://localhost:${port}`);
browserProcess.kill();
},
mcpHeadless: async ({ headless }, use) => {
await use(headless);
},
mcpBrowser: ['chromium', { option: true }],
});
type Response = Awaited<ReturnType<Client['callTool']>>;

View File

@@ -30,7 +30,8 @@ test('save as pdf unavailable', async ({ startClient }) => {
})).toHaveTextContent(/Tool \"browser_pdf_save\" not found/);
});
test('save as pdf', async ({ client }) => {
test('save as pdf', async ({ client, mcpBrowser }) => {
test.skip(!!mcpBrowser && !['chromium', 'chrome', 'msedge'].includes(mcpBrowser), 'Save as PDF is only supported in Chromium.');
expect(await client.callTool({
name: 'browser_navigate',
arguments: {