E2E Tests #361
This file contains hidden or 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: E2E Tests | |
| on: | |
| pull_request: | |
| branches: [main, develop] | |
| schedule: | |
| # Run every night at 3:00 AM UTC | |
| - cron: "0 3 * * *" | |
| workflow_dispatch: # Allow manual triggers | |
| env: | |
| PNPM_VERSION: 10.14.0 | |
| jobs: | |
| e2e: | |
| name: Playwright E2E | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: 'pnpm' | |
| - name: Install monorepo dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('e2e/pnpm-lock.yaml') }} | |
| - name: Install e2e dependencies | |
| # e2e/ is intentionally excluded from pnpm-workspace.yaml to prevent | |
| # @playwright/test from being hoisted as a Next.js peer dependency, | |
| # which corrupts the App Router's async response handling in production. | |
| working-directory: e2e | |
| run: pnpm install | |
| - name: Install Playwright browsers | |
| working-directory: e2e | |
| # Use local binary directly — pnpm exec traverses up to the monorepo root | |
| # and picks up apps/web's `playwright` package instead of e2e's @playwright/test. | |
| run: ./node_modules/.bin/playwright install --with-deps chromium | |
| - name: Run E2E tests | |
| working-directory: e2e | |
| env: | |
| E2E_BASE_URL: "https://march.fit" | |
| E2E_CHALLENGE_ID: ${{ secrets.E2E_CHALLENGE_ID }} | |
| E2E_CHALLENGE_INVITE_CODE: ${{ secrets.E2E_CHALLENGE_INVITE_CODE }} | |
| E2E_USER_PASSWORD: ${{ secrets.E2E_USER_PASSWORD }} | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| # Lightweight PR smoke suite (no challenge secrets required). | |
| ./node_modules/.bin/playwright test tests/google-sign-in.spec.ts --grep "renders" | |
| else | |
| # Full scheduled/manual E2E suite. | |
| ./node_modules/.bin/playwright test | |
| fi | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: playwright-report | |
| path: e2e/playwright-report/ | |
| retention-days: 14 | |
| - name: Upload test traces | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: playwright-traces | |
| path: e2e/test-results/ | |
| retention-days: 7 |