playwright
playwright copied to clipboard
[Feature] How do we change the html report name??
I am wondering if we can change the report file directly from the script ?? Is there any possible way ?? Like <date/time>.html instead of index.html
thanks
I have a similar question as well, we have a large suite of tests split across different Modules and we wanted to have module specific reports generated.
For now, you can rename the file yourself (either programmatically or manually) after it is saved.
you can do something like this:
// playwright.config.ts
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
reporter: [ ['html', { outputFolder: 'playwright-report/' + (new Date()).toISOString()}] ],
};
export default config;
This way you have a folder with a timestamp and you dont overwrite your reports.
Why was this issue closed?
Thank you for your involvement. This issue was closed due to limited engagement (upvotes/activity), lack of recent activity, and insufficient actionability. To maintain a manageable database, we prioritize issues based on these factors.
If you disagree with this closure, please open a new issue and reference this one. More support or clarity on its necessity may prompt a review. Your understanding and cooperation are appreciated.
// playwright.config.ts
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
reporter: [ ['html', { outputFolder: path.join('playwright-report', generateTimestamp()) }]]
};
export default config;
function generateTimestamp() {
return new Date().toISOString().replace(/:/g, '_');
}
This issue is not solved. The ways provided here is to rename the folder, not the file name.