Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(html): add `--host` and `--port` to the `show-report` command (#18517)

Andrey Lushnikovc3cff485d119
diff --git a/packages/playwright-test/src/cli.ts b/packages/playwright-test/src/cli.ts
index bc23963d8c..f89b00dfb6 100644
--- a/packages/playwright-test/src/cli.ts
+++ b/packages/playwright-test/src/cli.ts
@@ -100,7 +100,9 @@ function addListFilesCommand(program: Command) {
function addShowReportCommand(program: Command) {
const command = program.command('show-report [report]');
command.description('show HTML report');
- command.action(report => showHTMLReport(report));
+ command.action((report, options) => showHTMLReport(report, options.host, +options.port));
+ command.option('--host <host>', 'Host to serve report on', 'localhost');
+ command.option('--port <port>', 'Port to serve report on', '9323');
command.addHelpText('afterAll', `
Arguments [report]:
When specified, opens given report, otherwise opens last generated report.
diff --git a/packages/playwright-test/src/reporters/html.ts b/packages/playwright-test/src/reporters/html.ts
index b4bc773d70..79dd937fe9 100644
--- a/packages/playwright-test/src/reporters/html.ts
+++ b/packages/playwright-test/src/reporters/html.ts
@@ -159,7 +159,7 @@ export async function showHTMLReport(reportFolder: string | undefined, host: str
return;
}
const server = startHtmlReportServer(folder);
- let url = await server.start({ port, host, preferredPort: port ? undefined : 9223 });
+ let url = await server.start({ port, host, preferredPort: port ? undefined : 9323 });
console.log('');
console.log(colors.cyan(` Serving HTML report at ${url}. Press Ctrl+C to quit.`));
if (testId)