playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature] How do we change the html report name??

Open mechandan opened this issue 3 years ago • 2 comments
trafficstars

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

mechandan avatar Sep 16 '22 17:09 mechandan

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.

harir5 avatar Sep 19 '22 07:09 harir5

For now, you can rename the file yourself (either programmatically or manually) after it is saved.

rwoll avatar Sep 20 '22 21:09 rwoll

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.

karimould avatar Mar 14 '23 12:03 karimould

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.

pavelfeldman avatar Nov 17 '23 00:11 pavelfeldman

// 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, '_');
}

ankitKumarCloudanalogy avatar Mar 10 '24 13:03 ankitKumarCloudanalogy

This issue is not solved. The ways provided here is to rename the folder, not the file name.