Skip to content

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

fix(html-reporter): Include specified host and port in the logged instructions to launch the HTML report (#28144)

Daniel1c8ceb0a0295
diff --git a/packages/playwright/src/reporters/html.ts b/packages/playwright/src/reporters/html.ts
index ddac659269..418f74a9d2 100644
--- a/packages/playwright/src/reporters/html.ts
+++ b/packages/playwright/src/reporters/html.ts
@@ -134,10 +134,12 @@ class HtmlReporter extends EmptyReporter {
} else if (!FullConfigInternal.from(this.config)?.cliListOnly) {
const packageManagerCommand = getPackageManagerExecCommand();
const relativeReportPath = this._outputFolder === standaloneDefaultFolder() ? '' : ' ' + path.relative(process.cwd(), this._outputFolder);
+ const hostArg = this._options.host ? ` --host ${this._options.host}` : '';
+ const portArg = this._options.port ? ` --port ${this._options.port}` : '';
console.log('');
console.log('To open last HTML report run:');
console.log(colors.cyan(`
- ${packageManagerCommand} playwright show-report${relativeReportPath}
+ ${packageManagerCommand} playwright show-report${relativeReportPath}${hostArg}${portArg}
`));
}
}