-
Notifications
You must be signed in to change notification settings - Fork 100
186 lines (165 loc) · 5.01 KB
/
e2e-tests.yml
File metadata and controls
186 lines (165 loc) · 5.01 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: E2E Tests
permissions:
contents: read
on:
# Run manually or on specific branches/paths
workflow_dispatch:
pull_request:
branches: ['master', 'develop']
paths:
- 'Clients/**'
- 'Servers/**'
- 'AIGateway/**'
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
SUPERADMIN_EMAIL: admin@verifywise-test.com
SUPERADMIN_PASSWORD: TestAdmin!Str0ng
run: npx sequelize db:migrate
- name: Seed test data
working-directory: Servers
env:
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: verifywise_test
DB_USER: postgres
DB_PASSWORD: postgres
run: node dist/scripts/seedTestData.js
# ---- AIGateway setup ----
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install AIGateway dependencies
working-directory: AIGateway
run: pip install -r requirements.txt
- name: Start AIGateway
working-directory: AIGateway/src
env:
AI_GATEWAY_PORT: 8100
AI_GATEWAY_INTERNAL_KEY: test-ai-gateway-key-for-e2e
REDIS_URL: redis://localhost:6379/0
DB_HOST: localhost
DB_PORT: 5432
DB_NAME: verifywise_test
DB_USER: postgres
DB_PASSWORD: postgres
ENCRYPTION_KEY: test-encryption-key-32chars!!
EXPRESS_BACKEND_URL: http://localhost:3000
run: |
alembic upgrade head
uvicorn app:app --host 0.0.0.0 --port 8100 &
# Wait for AIGateway to be ready
for i in $(seq 1 30); do
curl -s http://localhost:8100/health && break
sleep 1
done
- 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
AI_GATEWAY_URL: http://localhost:8100
AI_GATEWAY_INTERNAL_KEY: test-ai-gateway-key-for-e2e
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@v7
with:
name: playwright-report
path: Clients/playwright-report/
retention-days: 14
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: playwright-results
path: Clients/test-results/
retention-days: 7