Skip to content

HTML Report Generate #103

HTML Report Generate

HTML Report Generate #103

Workflow file for this run

name: Run Playwright Tests for Chromium and Publish Report to GitHub Pages
on:
push:
branches:
- main # Trigger this workflow on push to the main branch
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Run Playwright tests for Chromium
run: npx playwright test --project=chromium --workers=4
- name: Generate HTML Report
run: mv playwright-report /tmp/playwright-report # Move report to a safe location
- name: Set up GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # Uses the GitHub token for authentication
branch: gh-pages # The branch to deploy to (GitHub Pages)
folder: /tmp/playwright-report # The folder containing the HTML report
- name: Commit HTML report to gh-pages
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git checkout -b gh-pages # Checkout gh-pages branch (create if doesn't exist)
cp -r /tmp/playwright-report/* ./ # Copy the report to the root of the branch
git add .
git commit -m "Publish Playwright HTML report"
git push --force origin gh-pages # Force push to gh-pages branch