E2E Tests #7
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"] | |
pull_request: | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
services: | |
postgresql: | |
image: postgres:alpine | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
env: | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
cache: "yarn" | |
cache-dependency-path: "yarn.lock" | |
- run: yarn install --immutable --inline-builds | |
- name: Migrate and seed database | |
run: yarn prisma:migrateProd && yarn prisma:seed | |
- name: Build application | |
run: yarn build | |
- name: Get Playwright version | |
id: playwright-version | |
run: echo version=$(yarn info --json @playwright/test | jq -r '.children.Version') >> $GITHUB_OUTPUT | |
- name: Cache playwright binaries | |
uses: actions/cache@v3 | |
id: playwright-cache | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }} | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
- name: Install Playwright OS dependencies | |
run: npx playwright install-deps | |
if: steps.playwright-cache.outputs.cache-hit == 'true' | |
- name: Run Playwright tests | |
run: npx playwright test | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |