This README explains how to host Playwright reports on GitHub Pages, enabling you to share your test results publicly or within your team. The following workflow will:
- Generate the reports and host them in GitHub Pages every time a new PR is created or updated
- Automatically comment the PR with the report URL
- Delete the report once the branch is deleted
Ensure your Playwright tests are configured to generate an HTML report. Update the playwright.config.ts file if needed:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: 'html',
});- Create a new orphan branch
git checkout --orphan gh-pages
git rm -rf .
git commit --allow-empty -m "setup empty branch for GitHub Pages"
git push --set-upstream origin gh-pages
- Navigate to your repository on GitHub.
- Go to Settings > Pages.
- Select
Deploy from a branchand setgh-pagesas branch
- See
.github/workflows/playwright-pull-request.ymlfile as reference (remember to update the report URL defined in the last 3 steps with yourownerandrepo)
- See
.github/workflows/playwright-delete-reports.ymlfile as reference