|
| 1 | +name: Frontend E2E Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - 'release/**' |
| 8 | + pull_request: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + e2e: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v5 |
| 20 | + |
| 21 | + - name: Set up Node.js |
| 22 | + uses: actions/setup-node@v4 |
| 23 | + with: |
| 24 | + node-version: '24' |
| 25 | + cache: 'npm' |
| 26 | + |
| 27 | + - name: Install dependencies |
| 28 | + run: npm ci |
| 29 | + |
| 30 | + - name: Install Playwright browsers |
| 31 | + run: npx playwright install --with-deps |
| 32 | + |
| 33 | + - name: Run linting |
| 34 | + run: npx gulp lint |
| 35 | + |
| 36 | + - name: Run E2E tests with coverage |
| 37 | + run: npm run e2e |
| 38 | + |
| 39 | + - name: Generate coverage report |
| 40 | + if: always() |
| 41 | + run: npm run e2e:coverage:report |
| 42 | + |
| 43 | + - name: Upload coverage reports |
| 44 | + if: always() |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: coverage-e2e |
| 48 | + path: coverage-e2e/ |
| 49 | + retention-days: 30 |
| 50 | + |
| 51 | + - name: Upload Playwright report |
| 52 | + if: always() |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: playwright-report |
| 56 | + path: playwright-report/ |
| 57 | + retention-days: 30 |
| 58 | + |
| 59 | + - name: Comment coverage on PR |
| 60 | + if: github.event_name == 'pull_request' |
| 61 | + uses: actions/github-script@v7 |
| 62 | + with: |
| 63 | + script: | |
| 64 | + const fs = require('fs'); |
| 65 | + const coveragePath = 'coverage-e2e/lcov-report/index.html'; |
| 66 | +
|
| 67 | + if (!fs.existsSync(coveragePath)) { |
| 68 | + console.log('Coverage report not found'); |
| 69 | + return; |
| 70 | + } |
| 71 | +
|
| 72 | + // Read the summary from the test output |
| 73 | + const summary = `## Frontend E2E Test Coverage |
| 74 | +
|
| 75 | + Coverage reports have been generated and uploaded as artifacts. |
| 76 | +
|
| 77 | + Download the artifacts from this workflow run to view the full HTML coverage report. |
| 78 | + `; |
| 79 | +
|
| 80 | + github.rest.issues.createComment({ |
| 81 | + issue_number: context.issue.number, |
| 82 | + owner: context.repo.owner, |
| 83 | + repo: context.repo.repo, |
| 84 | + body: summary |
| 85 | + }); |
0 commit comments