E2E Integration Tests #48
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 Integration Tests | |
| on: | |
| # Run daily at 06:00 UTC to catch regressions from upstream dependency updates. | |
| schedule: | |
| - cron: '0 6 * * *' | |
| # Allow maintainers to trigger a run manually from the Actions tab. | |
| workflow_dispatch: | |
| inputs: | |
| use_mocks: | |
| description: 'Use MSW mocks instead of a real bridgelet-sdk (true/false)' | |
| required: false | |
| default: 'true' | |
| type: string | |
| # Also run on pull requests that touch files consumed by the e2e tests | |
| # so regressions are caught before merge, not just nightly. | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'e2e/**' | |
| - 'frontend/app/**' | |
| - 'frontend/components/**' | |
| - 'frontend/lib/**' | |
| - 'frontend/mocks/**' | |
| - 'frontend/next.config.js' | |
| jobs: | |
| e2e: | |
| name: E2E (${{ matrix.project }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| # fail-fast: false is the point of this matrix — if WebKit breaks we | |
| # still want Chromium/Firefox/mobile results in the same run, each | |
| # clearly attributed to its own job rather than one aggregate pass/fail. | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # `project` maps 1:1 to a project name in e2e/playwright.config.ts | |
| # and is passed to `--project=<name>`. | |
| # `browser` is the underlying engine Playwright needs installed — | |
| # the two mobile projects emulate a device on top of an existing | |
| # desktop engine, so they reuse that engine's binary rather than | |
| # needing a separate download. | |
| - project: chromium | |
| browser: chromium | |
| - project: firefox | |
| browser: firefox | |
| - project: webkit | |
| browser: webkit | |
| - project: mobile-chrome | |
| browser: chromium | |
| - project: mobile-safari | |
| browser: webkit | |
| defaults: | |
| run: | |
| working-directory: e2e | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # ── Node setup ────────────────────────────────────────────────────────── | |
| - name: Use Node.js 20 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: npm | |
| # Cache both the frontend and e2e package-lock files so neither | |
| # restore point is invalidated by a change in the other. | |
| cache-dependency-path: | | |
| frontend/package-lock.json | |
| e2e/package-lock.json | |
| # ── Frontend dependencies ──────────────────────────────────────────────── | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| working-directory: frontend | |
| # ── E2E dependencies ───────────────────────────────────────────────────── | |
| - name: Install e2e dependencies | |
| run: npm ci | |
| working-directory: e2e | |
| - name: Install Playwright browser (${{ matrix.browser }}) | |
| run: npx playwright install --with-deps ${{ matrix.browser }} | |
| working-directory: e2e | |
| # ── Run tests ──────────────────────────────────────────────────────────── | |
| - name: Run E2E tests — ${{ matrix.project }} | |
| run: npx playwright test --project=${{ matrix.project }} --reporter=github | |
| working-directory: e2e | |
| env: | |
| CI: true | |
| # Default to MSW mocked mode; override via workflow_dispatch input | |
| # or repository/environment secret for real-backend runs. | |
| E2E_USE_MOCKS: ${{ github.event.inputs.use_mocks || 'true' }} | |
| # The playwright config starts the dev server at localhost:3000. | |
| # Override this in real-backend runs via repository secrets. | |
| E2E_BASE_URL: ${{ vars.E2E_BASE_URL || 'http://localhost:3000' }} | |
| E2E_API_BASE_URL: ${{ vars.E2E_API_BASE_URL || '' }} | |
| # ── Artifacts ──────────────────────────────────────────────────────────── | |
| # Artifact names include the project so a reviewer can jump straight | |
| # to (e.g.) the mobile-safari report without guessing which run it was. | |
| - name: Upload Playwright report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report-${{ matrix.project }}-${{ github.run_id }} | |
| path: | | |
| frontend/test-results/ | |
| e2e/playwright-report/ | |
| retention-days: 14 | |
| - name: Upload trace files on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-traces-${{ matrix.project }}-${{ github.run_id }} | |
| path: frontend/test-results/**/*.zip | |
| retention-days: 7 |