-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
78 lines (65 loc) · 2 KB
/
Copy pathe2e.yml
File metadata and controls
78 lines (65 loc) · 2 KB
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
name: E2E Testing
on:
workflow_dispatch:
pull_request:
branches: [develop]
jobs:
test-e2e:
environment: e2e-tests
timeout-minutes: 60
runs-on: ubuntu-latest
services:
# Local mail catcher: the app sends verification emails here over SMTP (port 1025)
# and the e2e tests read them back via Mailpit's REST API (port 8025)
mailpit:
image: axllent/mailpit:latest
ports:
- 1025:1025
- 8025:8025
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: '18.20.x'
cache: 'npm'
- name: Create .env file
run: cp .env.example .env
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.10.0
with:
mongodb-version: '6.0'
- name: Install dependencies
run: npm ci
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ hashFiles('package-lock.json') }}
- name: Install Playwright Browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps chromium
- name: Install Playwright deps (OS libraries)
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium
- name: Start app
run: npm run start:e2e > app.log 2>&1 &
- name: Wait for app to be ready
run: |
npx wait-on@7 http://localhost:9000 --timeout 180000 || {
echo "::error::App failed to become ready at http://localhost:9000 within 180s"
echo "----- app.log -----"
cat app.log
exit 1
}
- name: Run Playwright tests
run: npm run e2e:ci
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 30