microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.43k stars 3.63k forks source link

[Feature]: Is there a way to stop the html file being overwritten? #31040

Closed hari-prasad1 closed 4 months ago

hari-prasad1 commented 4 months ago

🚀 Feature Request

I see that everytime a test is ran, the index.html file is overwritten. Is there a way to bypass that? As I need the result files to be individual with more no of tests that I run. I tried changing the output folder name to be dynamic as suggested in a similar prev query as below

reporter: [['html', { outputFolder: 'my-report'+ (new Date()).toISOString() }]]

but when this is used, I'm getting the below error

Error in reporter Error: ENOENT: no such file or directory, mkdir 'C:\Users\hari.prasad\Demo\Sample\my-report2024-05-28T03:33:37.485Z'

any suggestions would be much appreciated

Example

No response

Motivation

It'll help storing results more efficiently

mxschmitt commented 4 months ago

In Windows a filename cannot contain a colon :. Could you try e.g.:

  reporter: [['html', { outputFolder: 'playwright-report-' + new Date().toISOString().replace(/[:\.]/g, '-') }]],

that might be the issue.

hari-prasad1 commented 4 months ago

@mxschmitt this worked. Thanks also is there a way to add the testname to the foldername?

mxschmitt commented 4 months ago

A HTML Report contains multiple tests for multiple test files, so this won't work.

Closing since the original issue has been solved.