Back to All Questions
Question 91 of 100
CI/CD
Intermediate
What reports can Playwright generate?
The Answer
Playwright has multiple built-in reporters: HTML (interactive), JSON (for integrations), JUnit (for CI systems like Jenkins), GitHub (PR annotations), and Dot/List (CLI). You can configure multiple simultaneously.
Deep Dive Explanation
The HTML report is the most valuable for development β it shows a searchable list of all tests with pass/fail status, attached screenshots, videos, and traces. The JUnit XML format integrates with Jenkins and most CI dashboards to display test trends over time.
example.spec.ts
// playwright.config.ts
export default defineConfig({
reporter: [
['html', { outputFolder: 'playwright-report', open: 'never' }],
['json', { outputFile: 'test-results/results.json' }],
['junit', { outputFile: 'test-results/junit.xml' }],
['github'], // GitHub Actions annotations
['list'], // Live CLI output
],
});
// View HTML report
// npx playwright show-report
// Custom reporter (advanced)
class MyReporter implements Reporter {
onTestEnd(test, result) {
if (result.status === 'failed') {
// Send Slack notification, create Jira ticket, etc.
}
}
}