Reports and artifacts: what to keep and how to share
Which reports. The Playwright HTML report (playwright-report/) is for people: steps, screenshots, trace. JUnit XML is for machines: CI and third-party services show tests in their UI, draw history and annotate PRs. Usually both are enabled: reporter: [['html', { open: 'never' }], ['junit', { outputFile: 'results/junit.xml' }]], and in CI you add github (annotations in the logs) or dot (short output).
What to upload. Traces, video and screenshots are the best evidence of a failure but heavy. Record them only for failed tests or retries (trace: 'on-first-retry', video: 'retain-on-failure', screenshot: 'only-on-failure'). Set retention-days for artifacts (7–14 days is enough) and do not upload what is not needed on success.
Sharded runs. Each shard produces a blob report; a separate job (needs: [e2e]) downloads all blob artifacts (download-artifact@v4 with pattern and merge-multiple: true), runs npx playwright merge-reports --reporter html ./all-blob-reports and uploads a single HTML report. The merge job also needs if: ${{ !cancelled() }}, otherwise it will not start after a red shard.
How to share. A zip artifact has to be downloaded and unpacked, and an HTML report with static assets cannot be opened as a single file without a server. It is more convenient to publish the report to GitHub Pages or static hosting and add the link to a PR comment. For a short summary on the run page, write Markdown to the $GITHUB_STEP_SUMMARY file.
Notifications. Send only what matters to a channel (Slack/Teams): failures of nightly and main, not of every PR; the message has the suite name, the number of failures, and links to the run and the report.