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-report): fix command to open HTML report (#10231)

Andrey Lushnikovbd1ce399e343
diff --git a/packages/playwright-test/src/reporters/html.ts b/packages/playwright-test/src/reporters/html.ts
index 4511c57f2e..86fa30d49e 100644
--- a/packages/playwright-test/src/reporters/html.ts
+++ b/packages/playwright-test/src/reporters/html.ts
@@ -144,10 +144,11 @@ class HtmlReporter implements Reporter {
if (shouldOpen) {
await showHTMLReport(reportFolder, singleTestId);
} else {
+ const outputFolderPath = htmlReportFolder(this._outputFolder) === defaultReportFolder() ? '' : ' ' + path.relative(process.cwd(), htmlReportFolder(this._outputFolder));
console.log('');
console.log('To open last HTML report run:');
console.log(colors.cyan(`
- npx playwright show-report
+ npx playwright show-report${outputFolderPath}
`));
}
}
@@ -158,6 +159,10 @@ export function htmlReportFolder(outputFolder?: string): string {
return path.resolve(process.cwd(), process.env[`PLAYWRIGHT_HTML_REPORT`]);
if (outputFolder)
return outputFolder;
+ return defaultReportFolder();
+}
+
+function defaultReportFolder(): string {
return path.resolve(process.cwd(), 'playwright-report');
}