Skip to content

Instantly share code, notes, and snippets.

@MarcusFelling
Last active November 22, 2021 19:20
Show Gist options
  • Save MarcusFelling/ac8a1cba24467603c97fac005764fe89 to your computer and use it in GitHub Desktop.
Save MarcusFelling/ac8a1cba24467603c97fac005764fe89 to your computer and use it in GitHub Desktop.
name: Demo.Playwright
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: "Test site using Playwright"
timeout-minutes: 60
needs: build_and_deploy
runs-on: ubuntu-20.04
container: mcr.microsoft.com/playwright:focal
environment:
name: test
url: https://testresults.marcusfelling.com/
env:
SITE_URL: https://demo.marcusfelling.com/ # Playwright tests use this env var
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Install dependencies
run: npm ci
- name: Run Playwright Tests
continue-on-error: false
working-directory: e2e-examples
run: |
HOME=/root npx playwright test --config playwright.config.ts --reporter=html
- name: Upload HTML report as artifact
uses: actions/upload-artifact@v2
if: always()
with:
name: playwright-test-report
path: e2e-examples/playwright-report/index.html
- name: Publish HTML report to testresults.marcusfelling.com
if: always()
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: e2e-examples/playwright-report/
keep_files: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
- name: If failure, upload trace.zip to troubleshoot. Click and drag .zip to https://trace.playwright.dev/
uses: actions/upload-artifact@v2
if: failure()
with:
name: playwright-test-trace
path: e2e-examples/test-results/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment