chore: rename repo references from SpokeToWork_v_001 to SpokeToWork #169
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: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| # Shared env vars for all jobs | |
| NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} | |
| NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} | |
| jobs: | |
| # ============================================ | |
| # STEP 1: Build once, cache for all browsers | |
| # ============================================ | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.16.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build application | |
| run: pnpm build | |
| env: | |
| GITHUB_ACTIONS: false | |
| NEXT_PUBLIC_EMAILJS_PUBLIC_KEY: ${{ secrets.EMAILJS_PUBLIC_KEY }} | |
| NEXT_PUBLIC_EMAILJS_SERVICE_ID: ${{ secrets.EMAILJS_SERVICE_ID }} | |
| NEXT_PUBLIC_EMAILJS_TEMPLATE_ID: ${{ secrets.EMAILJS_TEMPLATE_ID }} | |
| NEXT_PUBLIC_ORS_API_KEY: ${{ secrets.NEXT_PUBLIC_ORS_API_KEY }} | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-output | |
| path: out/ | |
| retention-days: 1 | |
| # ============================================ | |
| # STEP 2: Smoke tests (~2 min) - FAST FEEDBACK | |
| # ============================================ | |
| smoke: | |
| name: Smoke Tests | |
| runs-on: ubuntu-latest | |
| needs: build | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.16.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install Playwright (chromium only) | |
| run: pnpm exec playwright install --with-deps chromium | |
| - name: Download build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-output | |
| path: out/ | |
| - name: Start server | |
| run: | | |
| npx serve out -l 3000 & | |
| npx wait-on http://localhost:3000 --timeout 60000 | |
| - name: Run smoke tests | |
| run: | | |
| pnpm exec playwright test \ | |
| tests/e2e/auth/protected-routes.spec.ts \ | |
| tests/e2e/auth/sign-up.spec.ts \ | |
| --project=chromium \ | |
| --reporter=list \ | |
| --timeout=30000 | |
| env: | |
| CI: true | |
| SKIP_WEBSERVER: true | |
| BASE_URL: http://localhost:3000 | |
| SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | |
| SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} | |
| TEST_USER_EMAIL: ${{ vars.TEST_USER_PRIMARY_EMAIL }} | |
| TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PRIMARY_PASSWORD }} | |
| TEST_USER_PRIMARY_EMAIL: ${{ vars.TEST_USER_PRIMARY_EMAIL }} | |
| TEST_USER_PRIMARY_PASSWORD: ${{ secrets.TEST_USER_PRIMARY_PASSWORD }} | |
| - name: Smoke test summary | |
| if: always() | |
| run: | | |
| echo "## 🚀 Smoke Tests Complete" >> $GITHUB_STEP_SUMMARY | |
| echo "Core auth and routing tests passed - proceeding to full suite." >> $GITHUB_STEP_SUMMARY | |
| # ============================================ | |
| # STEP 3: Auth Setup (runs ONCE, shares state) | |
| # ============================================ | |
| auth-setup: | |
| name: Auth Setup | |
| runs-on: ubuntu-latest | |
| needs: smoke | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.16.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install Playwright (chromium only for auth) | |
| run: pnpm exec playwright install --with-deps chromium | |
| - name: Download build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-output | |
| path: out/ | |
| - name: Start server | |
| run: | | |
| npx serve out -l 3000 & | |
| npx wait-on http://localhost:3000 --timeout 60000 | |
| - name: Run auth setup | |
| run: pnpm exec playwright test --project=setup --reporter=list | |
| env: | |
| CI: true | |
| SKIP_WEBSERVER: true | |
| BASE_URL: http://localhost:3000 | |
| SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | |
| TEST_USER_PRIMARY_EMAIL: ${{ vars.TEST_USER_PRIMARY_EMAIL }} | |
| TEST_USER_PRIMARY_PASSWORD: ${{ secrets.TEST_USER_PRIMARY_PASSWORD }} | |
| - name: Upload auth state | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: auth-state | |
| path: tests/e2e/fixtures/storage-state-auth.json | |
| retention-days: 1 | |
| # ============================================ | |
| # STEP 4: Full E2E tests (sharded, parallel) | |
| # ============================================ | |
| e2e: | |
| name: E2E (${{ matrix.browser }} ${{ matrix.shard }}) | |
| runs-on: ubuntu-latest | |
| needs: [smoke, auth-setup] | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Only run chromium on PRs, all browsers on main/develop | |
| browser: ${{ github.event_name == 'pull_request' && fromJSON('["chromium"]') || fromJSON('["chromium", "firefox", "webkit"]') }} | |
| # 4 shards per browser for parallel execution | |
| shard: [1/4, 2/4, 3/4, 4/4] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.16.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install Playwright browsers | |
| run: | | |
| # Always install chromium (required for auth setup project) | |
| pnpm exec playwright install --with-deps chromium | |
| # Install matrix browser if different from chromium | |
| if [ "${{ matrix.browser }}" != "chromium" ]; then | |
| pnpm exec playwright install --with-deps ${{ matrix.browser }} | |
| fi | |
| - name: Download build | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-output | |
| path: out/ | |
| - name: Download auth state | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: auth-state | |
| path: tests/e2e/fixtures/ | |
| - name: Start server | |
| run: | | |
| npx serve out -l 3000 & | |
| npx wait-on http://localhost:3000 --timeout 60000 | |
| - name: Run E2E tests (shard ${{ matrix.shard }}) | |
| run: | | |
| pnpm exec playwright test \ | |
| --project=${{ matrix.browser }} \ | |
| --shard=${{ matrix.shard }} \ | |
| --reporter=blob \ | |
| --trace=on-first-retry | |
| env: | |
| CI: true | |
| SKIP_WEBSERVER: true | |
| BASE_URL: http://localhost:3000 | |
| DEBUG: pw:api | |
| SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} | |
| SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} | |
| TEST_USER_EMAIL: ${{ vars.TEST_USER_PRIMARY_EMAIL }} | |
| TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PRIMARY_PASSWORD }} | |
| TEST_USER_PRIMARY_EMAIL: ${{ vars.TEST_USER_PRIMARY_EMAIL }} | |
| TEST_USER_PRIMARY_PASSWORD: ${{ secrets.TEST_USER_PRIMARY_PASSWORD }} | |
| TEST_USER_SECONDARY_EMAIL: ${{ vars.TEST_USER_SECONDARY_EMAIL }} | |
| TEST_USER_SECONDARY_PASSWORD: ${{ secrets.TEST_USER_SECONDARY_PASSWORD }} | |
| TEST_USER_TERTIARY_EMAIL: ${{ vars.TEST_USER_TERTIARY_EMAIL }} | |
| TEST_USER_TERTIARY_PASSWORD: ${{ secrets.TEST_USER_TERTIARY_PASSWORD }} | |
| - name: Upload blob report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: blob-report-${{ matrix.browser }}-${{ strategy.job-index }} | |
| path: blob-report/ | |
| retention-days: 1 | |
| # ============================================ | |
| # STEP 5: Merge reports and generate summary | |
| # ============================================ | |
| report: | |
| name: Test Report | |
| runs-on: ubuntu-latest | |
| needs: e2e | |
| if: always() | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.16.1 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Download blob reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: blob-report-* | |
| path: all-blob-reports | |
| merge-multiple: true | |
| - name: Merge reports | |
| run: | | |
| pnpm exec playwright merge-reports --reporter=html,github ./all-blob-reports | |
| - name: Upload HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 7 | |
| - name: Generate summary | |
| if: always() | |
| run: | | |
| echo "## 📊 E2E Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ github.event_name }}" == "pull_request" ]; then | |
| echo "**PR Mode**: Chromium only (4 shards)" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "**Full Mode**: Chromium + Firefox + WebKit (12 shards total)" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "📁 Download the **playwright-report** artifact for detailed results." >> $GITHUB_STEP_SUMMARY |