name: Playwright Tests
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
jobs:
  test:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - run: corepack enable
    - uses: actions/setup-node@v4
      with:
        node-version: 18
    - name: Install dependencies
      run: yarn
    - name: Build app
      run: yarn build
    - name: Install Playwright Browsers
      run: yarn playwright install --with-deps
    - name: Run Playwright tests
      run: yarn playwright test
    - uses: actions/upload-artifact@v4
      if: always()
      with:
        name: playwright-report
        path: playwright-report/
        retention-days: 30