diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..597ff7a --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,60 @@ +name: E2E Tests + +on: + pull_request: + branches: [main, develop] + workflow_dispatch: # Allow manual triggering + +jobs: + e2e-tests: + name: Playwright E2E Tests + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Cache Playwright browsers + uses: actions/cache@v4 + id: playwright-cache + with: + path: ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-playwright- + + - name: Install Playwright browsers + run: npx playwright install chromium --with-deps + if: steps.playwright-cache.outputs.cache-hit != 'true' + + - name: Install Playwright browser dependencies only + run: npx playwright install-deps chromium + if: steps.playwright-cache.outputs.cache-hit == 'true' + + - name: Run Playwright tests + run: npm run test:e2e -- --project=chromium + env: + CI: true + NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} + NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} + + - name: Upload test artifacts on failure + uses: actions/upload-artifact@v4 + if: failure() + with: + name: playwright-report + path: | + playwright-report/ + test-results/ + retention-days: 7 +