diff --git a/packages/playwright-core/src/cli/cli.ts b/packages/playwright-core/src/cli/cli.ts index 81d578a19d..ffeb305af2 100755 --- a/packages/playwright-core/src/cli/cli.ts +++ b/packages/playwright-core/src/cli/cli.ts @@ -499,10 +499,9 @@ async function launchContext(options: Options, headless: boolean, executablePath closeBrowser().catch(e => null); }); }); - if (options.timeout) { - context.setDefaultTimeout(parseInt(options.timeout, 10)); - context.setDefaultNavigationTimeout(parseInt(options.timeout, 10)); - } + const timeout = options.timeout ? parseInt(options.timeout, 10) : 0; + context.setDefaultTimeout(timeout); + context.setDefaultNavigationTimeout(timeout); if (options.saveTrace) await context.tracing.start({ screenshots: true, snapshots: true }); @@ -654,7 +653,7 @@ function commandWithOpenOptions(command: string, description: string, options: a .option('--save-storage ', 'save context storage state at the end, for later use with --load-storage') .option('--save-trace ', 'record a trace for the session and save it to a file') .option('--timezone