mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2025-07-25 07:52:27 +08:00
fix: no-sandbox flag logic to only disable sandbox when explicitly passed (#709)
This commit is contained in:
parent
9f8441daa5
commit
29ac29e6bb
@ -133,7 +133,7 @@ export function configFromCLIOptions(cliOptions: CLIOptions): Config {
|
||||
};
|
||||
|
||||
// --no-sandbox was passed, disable the sandbox
|
||||
if (!cliOptions.sandbox)
|
||||
if (cliOptions.sandbox === false)
|
||||
launchOptions.chromiumSandbox = false;
|
||||
|
||||
if (cliOptions.proxyServer) {
|
||||
|
@ -61,3 +61,20 @@ test.describe(() => {
|
||||
})).toContainTextContent(`Firefox`);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('sandbox configuration', () => {
|
||||
test('should enable sandbox by default (no --no-sandbox flag)', async () => {
|
||||
const { configFromCLIOptions } = await import('../lib/config.js');
|
||||
const config = configFromCLIOptions({ sandbox: undefined });
|
||||
// When --no-sandbox is not passed, chromiumSandbox should not be set to false
|
||||
// This allows the default (true) to be used
|
||||
expect(config.browser?.launchOptions?.chromiumSandbox).toBeUndefined();
|
||||
});
|
||||
|
||||
test('should disable sandbox when --no-sandbox flag is passed', async () => {
|
||||
const { configFromCLIOptions } = await import('../lib/config.js');
|
||||
const config = configFromCLIOptions({ sandbox: false });
|
||||
// When --no-sandbox is passed, chromiumSandbox should be explicitly set to false
|
||||
expect(config.browser?.launchOptions?.chromiumSandbox).toBe(false);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user