-
Notifications
You must be signed in to change notification settings - Fork 100
139 lines (122 loc) · 3.51 KB
/
e2e-tests.yml
File metadata and controls
139 lines (122 loc) · 3.51 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: E2E Tests
permissions:
contents: read
on:
# Run manually or on specific branches/paths
workflow_dispatch:
pull_request:
branches: ['master', 'develop']
paths:
- 'Clients/**'
- 'Servers/**'
jobs:
e2e-tests:
name: Playwright E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 20
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: verifywise_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '20'
# ---- Backend setup ----
- name: Install backend dependencies
working-directory: Servers
run: npm ci --legacy-peer-deps
- name: Build backend
working-directory: Servers
run: npm run build
- name: Run migrations
working-directory: Servers
env:
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: verifywise_test
DB_USER: postgres
DB_PASSWORD: postgres
run: npx sequelize db:migrate
- name: Start backend
working-directory: Servers
env:
PORT: 3000
NODE_ENV: test
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: verifywise_test
DB_USER: postgres
DB_PASSWORD: postgres
REDIS_HOST: localhost
REDIS_PORT: 6379
JWT_SECRET: test-jwt-secret-for-e2e
REFRESH_TOKEN_SECRET: test-refresh-secret-for-e2e
ENCRYPTION_KEY: test-encryption-key-32chars!!
MULTI_TENANCY_ENABLED: false
run: |
node dist/index.js &
# Wait for backend to be ready
for i in $(seq 1 30); do
curl -s http://localhost:3000/api/users/check/exists && break
sleep 1
done
# ---- Frontend setup ----
- name: Install frontend dependencies
working-directory: Clients
run: npm ci --legacy-peer-deps
- name: Install Playwright browsers
working-directory: Clients
run: npx playwright install --with-deps chromium
- name: Start frontend
working-directory: Clients
env:
VITE_APP_API_BASE_URL: http://localhost:3000
run: |
npm run dev:vite &
# Wait for frontend to be ready
for i in $(seq 1 30); do
curl -s http://localhost:5173 && break
sleep 1
done
# ---- Run E2E tests ----
- name: Run Playwright tests
working-directory: Clients
env:
E2E_BASE_URL: http://localhost:5173
run: npx playwright test
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v6
with:
name: playwright-report
path: Clients/playwright-report/
retention-days: 14
- name: Upload test results
if: always()
uses: actions/upload-artifact@v6
with:
name: playwright-results
path: Clients/test-results/
retention-days: 7