feat(cli): open directly opens browser and does not invoke codegen (#36541)

This commit is contained in:
Adam Gastineau 2025-07-03 01:17:45 -07:00 committed by GitHub
parent fc0b770d0c
commit 5f2a001c71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 12 deletions

View File

@ -57,7 +57,7 @@ program
commandWithOpenOptions('open [url]', 'open page in browser specified via -b, --browser', [])
.action(function(url, options) {
open(options, url, codegenId()).catch(logErrorAndExit);
open(options, url).catch(logErrorAndExit);
})
.addHelpText('afterAll', `
Examples:
@ -313,7 +313,7 @@ const browsers = [
for (const { alias, name, type } of browsers) {
commandWithOpenOptions(`${alias} [url]`, `open page in ${name}`, [])
.action(function(url, options) {
open({ ...options, browser: type }, url, options.target).catch(logErrorAndExit);
open({ ...options, browser: type }, url).catch(logErrorAndExit);
}).addHelpText('afterAll', `
Examples:
@ -631,16 +631,8 @@ async function openPage(context: BrowserContext, url: string | undefined): Promi
return page;
}
async function open(options: Options, url: string | undefined, language: string) {
const { context, launchOptions, contextOptions } = await launchContext(options, { headless: !!process.env.PWTEST_CLI_HEADLESS, executablePath: process.env.PWTEST_CLI_EXECUTABLE_PATH });
await context._enableRecorder({
language,
launchOptions,
contextOptions,
device: options.device,
saveStorage: options.saveStorage,
handleSIGINT: false,
});
async function open(options: Options, url: string | undefined) {
const { context } = await launchContext(options, { headless: !!process.env.PWTEST_CLI_HEADLESS, executablePath: process.env.PWTEST_CLI_EXECUTABLE_PATH });
await openPage(context, url);
}