Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/playwright-core/src/cli/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,15 @@ async function launchContext(options: Options, extraOptions: LaunchOptions): Pro
launchOptions.proxy.bypass = options.proxyBypass;
}

const browser = await browserType.launch(launchOptions);
let browser: Browser;
if (process.env.PW_BROWSER_SERVER) {
const url = new URL(process.env.PW_BROWSER_SERVER);
url.searchParams.set('connect', 'first');
url.searchParams.set('launch-options', JSON.stringify(launchOptions));
browser = await browserType.connect(url.toString());
} else {
browser = await browserType.launch(launchOptions);
}

if (process.env.PWTEST_CLI_IS_UNDER_TEST) {
(process as any)._didSetSourcesForTest = (text: string) => {
Expand Down Expand Up @@ -638,6 +646,8 @@ async function open(options: Options, url: string | undefined, language: string)
handleSIGINT: false,
});
await openPage(context, url);
if (process.env.PW_BROWSER_SERVER)
gracefullyProcessExitDoNotHang(0);
}

async function codegen(options: Options & { target: string, output?: string, testIdAttribute?: string }, url: string | undefined) {
Expand Down
Loading