👷 ci: Create CI workflow for Playwright E2E tests #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright E2E Tests | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
jobs: | |
e2e-tests: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./tooling/github-actions/setup | |
- name: Install Playwright Browsers | |
run: pnpm exec playwright install --with-deps | |
- name: Run local databases with Docker Compose | |
uses: hoverkraft-tech/compose-action@v2.0.1 | |
- name: Setup environment variables for Student | |
run: cp .env.example .env | |
working-directory: apps/student/ | |
- name: Setup environment variables for Library | |
run: cp .env.example .env | |
working-directory: apps/library/ | |
- name: Setup environment variables for Finance | |
run: cp .env.example .env | |
working-directory: apps/finance/ | |
- name: Setup database with migrations and seed data | |
run: pnpm db:setup | |
- name: Build monorepo | |
run: pnpm build | |
- name: Run Playwright tests | |
run: cd apps/student/ && PLAYWRIGHT_JSON_OUTPUT_NAME=results.json pnpm exec playwright test --reporter=json | |
- uses: daun/playwright-report-summary@v3 | |
if: always() | |
with: | |
github-token: "" | |
report-file: results.json | |
comment-title: "Playwright Test Results" | |
custom-info: "Generated by GitHub Actions [(Link to Action)]](https://github.com/marketplace/actions/playwright-report-comment)" | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |