|
9 | 9 | jobs: |
10 | 10 | ci: |
11 | 11 | runs-on: ubuntu-latest |
| 12 | + timeout-minutes: 15 |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + pull-requests: write |
12 | 16 | strategy: |
13 | 17 | matrix: |
14 | | - task: [lint, test] |
| 18 | + task: [lint, test, e2e] |
15 | 19 | steps: |
16 | 20 | - name: Checkout |
17 | 21 | uses: actions/checkout@v5 |
|
30 | 34 | - name: Install dependencies |
31 | 35 | run: pnpm install |
32 | 36 |
|
| 37 | + - name: Install Playwright Browsers |
| 38 | + if: matrix.task == 'e2e' |
| 39 | + run: pnpm playwright install --with-deps |
| 40 | + |
33 | 41 | - name: Run lint |
34 | 42 | if: matrix.task == 'lint' |
35 | 43 | run: pnpm lint:ci |
|
38 | 46 | if: matrix.task == 'test' |
39 | 47 | run: pnpm test:ci |
40 | 48 |
|
| 49 | + - name: Run e2e tests |
| 50 | + if: matrix.task == 'e2e' |
| 51 | + env: |
| 52 | + AIRTABLE_PAT: ${{ secrets.AIRTABLE_PAT }} |
| 53 | + run: pnpm test:e2e:headless |
| 54 | + |
41 | 55 | - name: Upload coverage artifact |
42 | 56 | if: matrix.task == 'test' && github.event_name == 'pull_request' |
43 | 57 | uses: actions/upload-artifact@v4 |
44 | 58 | with: |
45 | 59 | name: vitest-coverage |
46 | 60 | path: vitest-coverage |
| 61 | + |
| 62 | + - name: Upload Playwright report |
| 63 | + if: matrix.task == 'e2e' && failure() |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: playwright-report |
| 67 | + path: playwright-report/ |
| 68 | + retention-days: 30 |
| 69 | + |
| 70 | + - name: Comment PR with Playwright artifact link |
| 71 | + if: matrix.task == 'e2e' && failure() && github.event_name == 'pull_request' |
| 72 | + uses: actions/github-script@v7 |
| 73 | + with: |
| 74 | + script: | |
| 75 | + const runId = context.runId; |
| 76 | + const repo = context.repo; |
| 77 | + const artifactUrl = `https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId}`; |
| 78 | +
|
| 79 | + const comment = `## ❌ Playwright Tests Failed |
| 80 | +
|
| 81 | + The Playwright tests have failed. Please download the test report artifact to see detailed information about the failures: |
| 82 | +
|
| 83 | + 📊 [View test run and download artifact](${artifactUrl}) |
| 84 | +
|
| 85 | + **How to view the report:** |
| 86 | + 1. Click the link above |
| 87 | + 2. Scroll to the bottom to the "Artifacts" section |
| 88 | + 3. Download the \`playwright-report\` artifact |
| 89 | + 4. Extract the zip file and open \`index.html\` in your browser |
| 90 | +
|
| 91 | + The report includes screenshots, videos, and detailed traces of the failed tests.`; |
| 92 | +
|
| 93 | + github.rest.issues.createComment({ |
| 94 | + issue_number: context.issue.number, |
| 95 | + owner: repo.owner, |
| 96 | + repo: repo.repo, |
| 97 | + body: comment |
| 98 | + }); |
0 commit comments