diff --git a/src/cli/cli.ts b/src/cli/cli.ts index fc178b939d9e6..53ac4a443c9c8 100755 --- a/src/cli/cli.ts +++ b/src/cli/cli.ts @@ -161,7 +161,7 @@ if (process.argv[2] === 'run-driver') else if (process.argv[2] === 'print-api-json') printApiJson(); else if (process.argv[2] === 'launch-server') - launchBrowserServer(process.argv[3]); + launchBrowserServer(process.argv[3], process.argv[4]); else program.parse(process.argv); diff --git a/src/cli/driver.ts b/src/cli/driver.ts index e194e32579537..55b6d44cbed9b 100644 --- a/src/cli/driver.ts +++ b/src/cli/driver.ts @@ -20,6 +20,7 @@ import fs from 'fs'; import path from 'path'; import * as playwright from '../..'; import { BrowserType } from '../client/browserType'; +import { LaunchServerOptions } from '../client/types'; import { DispatcherConnection } from '../dispatchers/dispatcher'; import { PlaywrightDispatcher } from '../dispatchers/playwrightDispatcher'; import { installBrowsersWithProgressBar } from '../install/installer'; @@ -55,9 +56,12 @@ export function runServer() { new PlaywrightDispatcher(dispatcherConnection.rootDispatcher(), playwright); } -export async function launchBrowserServer(browserName: string) { +export async function launchBrowserServer(browserName: string, configFile?: string) { + let options: LaunchServerOptions = {}; + if (configFile) + options = JSON.parse(fs.readFileSync(configFile).toString()); const browserType = (playwright as any)[browserName] as BrowserType; - const server = await browserType.launchServer(); + const server = await browserType.launchServer(options); console.log(server.wsEndpoint()); }