Skip to content

Instantly share code, notes, and snippets.

@MarcusFelling
Created April 25, 2022 14:40
Show Gist options
  • Save MarcusFelling/6f41df574706af40e294eecabac5249a to your computer and use it in GitHub Desktop.
Save MarcusFelling/6f41df574706af40e294eecabac5249a to your computer and use it in GitHub Desktop.
name: Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
# optional - use container with deps and browsers baked in
# tip - Always pin versions!
# container: mcr.microsoft.com/playwright:v1.21.0-focal
environment:
name: test # This declares an environment named test https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
env:
# Construct Netlify deploy preview URL using GitHub PR # https://docs.netlify.com/site-deploys/deploy-previews/#deploy-preview-urls
# Playwright Tests use this for baseURL
PLAYWRIGHT_TEST_BASE_URL: https://deploy-preview-${{ github.event.number }}--debbiecodes.netlify.app/
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Install dependencies
run: yarn
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v2
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment