Skip to content

Commit

Permalink
Add optional config param
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Mar 4, 2021
1 parent 1d88b3a commit 7aa4fcb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 6 additions & 2 deletions src/cli/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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());
}

Expand Down

0 comments on commit 7aa4fcb

Please sign in to comment.