fix(html-report): fix command to open HTML report (#10231)
This commit is contained in:
parent
80da0f7b69
commit
bd1ce399e3
|
|
@ -144,10 +144,11 @@ class HtmlReporter implements Reporter {
|
||||||
if (shouldOpen) {
|
if (shouldOpen) {
|
||||||
await showHTMLReport(reportFolder, singleTestId);
|
await showHTMLReport(reportFolder, singleTestId);
|
||||||
} else {
|
} else {
|
||||||
|
const outputFolderPath = htmlReportFolder(this._outputFolder) === defaultReportFolder() ? '' : ' ' + path.relative(process.cwd(), htmlReportFolder(this._outputFolder));
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log('To open last HTML report run:');
|
console.log('To open last HTML report run:');
|
||||||
console.log(colors.cyan(`
|
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`]);
|
return path.resolve(process.cwd(), process.env[`PLAYWRIGHT_HTML_REPORT`]);
|
||||||
if (outputFolder)
|
if (outputFolder)
|
||||||
return outputFolder;
|
return outputFolder;
|
||||||
|
return defaultReportFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
function defaultReportFolder(): string {
|
||||||
return path.resolve(process.cwd(), 'playwright-report');
|
return path.resolve(process.cwd(), 'playwright-report');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue