mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2025-07-27 00:52:27 +08:00
chore: normalize --no- options (#413)
This commit is contained in:
parent
ab20175826
commit
ee33097abe
@ -38,8 +38,8 @@ export type CLIOptions = {
|
|||||||
host?: string;
|
host?: string;
|
||||||
ignoreHttpsErrors?: boolean;
|
ignoreHttpsErrors?: boolean;
|
||||||
isolated?: boolean;
|
isolated?: boolean;
|
||||||
noImageResponses?: boolean;
|
imageResponses: boolean;
|
||||||
sandbox?: boolean;
|
sandbox: boolean;
|
||||||
outputDir?: string;
|
outputDir?: string;
|
||||||
port?: number;
|
port?: number;
|
||||||
proxyBypass?: string;
|
proxyBypass?: string;
|
||||||
@ -111,8 +111,10 @@ export async function configFromCLIOptions(cliOptions: CLIOptions): Promise<Conf
|
|||||||
|
|
||||||
if (browserName === 'chromium') {
|
if (browserName === 'chromium') {
|
||||||
(launchOptions as any).cdpPort = await findFreePort();
|
(launchOptions as any).cdpPort = await findFreePort();
|
||||||
if (cliOptions.sandbox === false)
|
if (!cliOptions.sandbox) {
|
||||||
|
// --no-sandbox was passed, disable the sandbox
|
||||||
launchOptions.chromiumSandbox = false;
|
launchOptions.chromiumSandbox = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cliOptions.proxyServer) {
|
if (cliOptions.proxyServer) {
|
||||||
@ -148,7 +150,7 @@ export async function configFromCLIOptions(cliOptions: CLIOptions): Promise<Conf
|
|||||||
if (cliOptions.blockServiceWorkers)
|
if (cliOptions.blockServiceWorkers)
|
||||||
contextOptions.serviceWorkers = 'block';
|
contextOptions.serviceWorkers = 'block';
|
||||||
|
|
||||||
return {
|
const result: Config = {
|
||||||
browser: {
|
browser: {
|
||||||
browserName,
|
browserName,
|
||||||
isolated: cliOptions.isolated,
|
isolated: cliOptions.isolated,
|
||||||
@ -169,6 +171,13 @@ export async function configFromCLIOptions(cliOptions: CLIOptions): Promise<Conf
|
|||||||
},
|
},
|
||||||
outputDir: cliOptions.outputDir,
|
outputDir: cliOptions.outputDir,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!cliOptions.imageResponses) {
|
||||||
|
// --no-image-responses was passed, disable image responses
|
||||||
|
result.noImageResponses = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findFreePort() {
|
async function findFreePort() {
|
||||||
|
@ -65,6 +65,8 @@ export const test = baseTest.extend<TestFixtures & TestOptions, WorkerFixtures>(
|
|||||||
|
|
||||||
await use(async options => {
|
await use(async options => {
|
||||||
const args = ['--user-data-dir', path.relative(configDir, userDataDir)];
|
const args = ['--user-data-dir', path.relative(configDir, userDataDir)];
|
||||||
|
if (process.env.CI && process.platform === 'linux')
|
||||||
|
args.push('--no-sandbox');
|
||||||
if (mcpHeadless)
|
if (mcpHeadless)
|
||||||
args.push('--headless');
|
args.push('--headless');
|
||||||
if (mcpBrowser)
|
if (mcpBrowser)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user