Unfortunately, the HTML reporter in Playwright doesn't support merging reports from multiple shards. But don't worry, there are other ways to get around this.
First, you can use the JSON reporter. This reporter produces a JSON object with all the test run information. Here's how you can write the JSON to a file:
PLAYWRIGHT_JSON_OUTPUT_NAME=results.json npx playwright test --reporter=json
This command will generate a JSON file with your test results.
Alternatively, you can use the JUnit reporter. This reporter produces a JUnit-style XML report. Here's how you can write the report to an XML file:
PLAYWRIGHT_JUNIT_OUTPUT_NAME=results.xml npx playwright test --reporter=junit
This command will generate an XML file with your test results in JUnit format.
If you prefer to configure reporters in a configuration file (playwright.config.ts
), you can specify options directly for each reporter type. Here's how you can configure the JSON reporter:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [['json', { outputFile: 'results.json' }]],
});
And here's how you can configure the JUnit reporter:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [['junit', { outputFile: 'results.xml' }]],
});
These configurations will generate a JSON file and an XML file respectively, containing all the information about your tests.
To merge these reports into a single report, you'll need to implement a custom solution or explore alternative options outside of Playwright's built-in reporters.
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].