diff --git a/src/config.ts b/src/config.ts index fe7a6ec..ef768da 100644 --- a/src/config.ts +++ b/src/config.ts @@ -94,11 +94,13 @@ export async function resolveCLIConfig(cliOptions: CLIOptions): Promise { - let browserName: 'chromium' | 'firefox' | 'webkit'; + let browserName: 'chromium' | 'firefox' | 'webkit' | undefined; let channel: string | undefined; switch (cliOptions.browser) { case 'chrome': @@ -119,9 +121,6 @@ export async function configFromCLIOptions(cliOptions: CLIOptions): Promise const files = await fs.promises.readdir(config.browser!.userDataDir!); expect(files.length).toBeGreaterThan(0); }); + +test.describe(() => { + test.use({ mcpBrowser: '' }); + test('browserName', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright-mcp/issues/458' } }, async ({ startClient, localOutputPath }) => { + const config: Config = { + browser: { + browserName: 'firefox', + }, + }; + const configPath = localOutputPath('config.json'); + await fs.promises.writeFile(configPath, JSON.stringify(config, null, 2)); + + const client = await startClient({ args: ['--config', configPath] }); + expect(await client.callTool({ + name: 'browser_navigate', + arguments: { url: 'data:text/html,' }, + })).toContainTextContent(`Firefox`); + }); +});