-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (82 loc) · 3.16 KB
/
playwright.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Playwright
on:
deployment_status:
push:
branches:
- production
jobs:
test-e2e:
timeout-minutes: 20
runs-on: ubuntu-latest
if: github.event.deployment_status.state == 'success' && contains(github.event.deployment_status.target_url, 'oak-ai-lesson-assistant')
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- uses: ./.github/actions/ref_from_sha
name: Get PR Ref from SHA
id: ref_from_sha
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Playwright
run: npx playwright install --with-deps
- name: Inject Doppler env vars
uses: dopplerhq/secrets-fetch-action@v1.2.0
id: doppler
with:
doppler-token: ${{ secrets.DOPPLER_TOKEN }}
inject-env-vars: true
- name: Run Playwright tests
working-directory: apps/nextjs
# Only include @openai tests on RC branches
run: |
if [[ "${{ steps.ref_from_sha.outputs.branch_name }}" =~ ^rc$ ]]; then
pnpm test-e2e
else
pnpm test-e2e --grep-invert @openai
fi
env:
TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
TEST_USER_EMAIL: ${{ steps.doppler.outputs.TEST_USER_EMAIL }}
TEST_USER_PASSWORD: ${{ steps.doppler.outputs.TEST_USER_PASSWORD }}
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ steps.doppler.outputs.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
CLERK_SECRET_KEY: ${{ steps.doppler.outputs.CLERK_SECRET_KEY }}
- name: Upload Playwright report
id: upload-report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: apps/nextjs/playwright-report
retention-days: 30
- name: Comment PR with playwright report
uses: thollander/actions-comment-pull-request@v2
if: ${{ !cancelled() && github.ref != 'refs/heads/production' && github.ref != 'refs/heads/main' }}
with:
pr_number: ${{ steps.ref_from_sha.outputs.pr_number }}
message: |
### Playwright e2e tests
[Job summary](https://github.com/oaknational/oak-ai-lesson-assistant/actions/runs/${{github.run_id}})
[Download report](${{ steps.upload-report.outputs.artifact-url }})
To view traces locally, unzip the report and run:
```bash
npx playwright show-report ~/Downloads/playwright-report
```
comment_tag: playwright-report
- name: Upload playwright screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-failure-screenshots
path: apps/nextjs/tests-e2e/test-results ## Folder used in playwright.config.js `outputDir`
retention-days: 30