mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2025-07-27 00:52:27 +08:00
chore: follow up to exposing playwright config options (#289)
This commit is contained in:
parent
4147e21a3a
commit
69703cc882
1
config.d.ts
vendored
1
config.d.ts
vendored
@ -30,6 +30,7 @@ export type Config = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Path to a user data directory for browser profile persistence.
|
* Path to a user data directory for browser profile persistence.
|
||||||
|
* Temporary directory is created by default.
|
||||||
*/
|
*/
|
||||||
userDataDir?: string;
|
userDataDir?: string;
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ export async function configFromCLIOptions(cliOptions: CLIOptions): Promise<Conf
|
|||||||
const launchOptions: LaunchOptions = {
|
const launchOptions: LaunchOptions = {
|
||||||
channel,
|
channel,
|
||||||
executablePath: cliOptions.executablePath,
|
executablePath: cliOptions.executablePath,
|
||||||
|
headless: cliOptions.headless,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (browserName === 'chromium')
|
if (browserName === 'chromium')
|
||||||
@ -126,7 +127,7 @@ async function loadConfig(configFile: string | undefined): Promise<Config> {
|
|||||||
try {
|
try {
|
||||||
return JSON.parse(await fs.promises.readFile(configFile, 'utf8'));
|
return JSON.parse(await fs.promises.readFile(configFile, 'utf8'));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(`Failed to load config file: ${configFile}`);
|
throw new Error(`Failed to load config file: ${configFile}, ${error}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ const install = defineTool({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handle: async context => {
|
handle: async context => {
|
||||||
const channel = context.config.browser?.launchOptions?.channel ?? context.config.browser?.launchOptions.channel ?? context.config.browser?.launchOptions.browserName ?? 'chrome';
|
const channel = context.config.browser?.launchOptions?.channel ?? context.config.browser?.launchOptions.browserName ?? 'chrome';
|
||||||
const cli = path.join(require.resolve('playwright/package.json'), '..', 'cli.js');
|
const cli = path.join(require.resolve('playwright/package.json'), '..', 'cli.js');
|
||||||
const child = fork(cli, ['install', channel], {
|
const child = fork(cli, ['install', channel], {
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
@ -97,6 +97,7 @@ export const test = baseTest.extend<TestFixtures, WorkerFixtures>({
|
|||||||
`--no-first-run`,
|
`--no-first-run`,
|
||||||
`--no-sandbox`,
|
`--no-sandbox`,
|
||||||
`--headless`,
|
`--headless`,
|
||||||
|
'--use-mock-keychain',
|
||||||
`data:text/html,hello world`,
|
`data:text/html,hello world`,
|
||||||
], {
|
], {
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user