-
Notifications
You must be signed in to change notification settings - Fork 14
210 lines (191 loc) · 6.66 KB
/
Copy pathplaywright-testing.yml
File metadata and controls
210 lines (191 loc) · 6.66 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Klicker automated testing with playwright
on:
pull_request:
branches: ['v3', 'v3*']
types: [opened, synchronize, reopened, ready_for_review]
paths:
- apps/**
- packages/**
- playwright/**
- .github/workflows/playwright-testing.yml
- .github/scripts/wait-for-services.sh
- util/_create_hatchet_token_cypress.sh
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
jobs:
playwright-run-draft:
if: github.event_name == 'pull_request' && github.event.pull_request.draft == true
runs-on: ubuntu-24.04
timeout-minutes: 120
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: klicker-prod
POSTGRES_PASSWORD: klicker
POSTGRES_DB: klicker-prod
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
postgres_hatchet:
image: postgres:15
env:
POSTGRES_USER: hatchet
POSTGRES_PASSWORD: hatchet
POSTGRES_DB: hatchet
options: >-
--health-cmd "pg_isready -U hatchet -d hatchet"
--health-interval 5s
--health-timeout 10s
--health-retries 10
--health-start-period 30s
ports:
- 5433:5432
redis_cache:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6380:6379
redis_exec:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
redis_assessment_exec:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6381:6379
hatchet:
image: ghcr.io/hatchet-dev/hatchet/hatchet-lite:v0.73.1
ports:
- '8888:8888'
- '7077:7077'
env:
DATABASE_URL: 'postgresql://hatchet:hatchet@postgres_hatchet:5432/hatchet?sslmode=disable'
SERVER_AUTH_COOKIE_DOMAIN: localhost
SERVER_AUTH_COOKIE_INSECURE: 't'
SERVER_GRPC_BIND_ADDRESS: '0.0.0.0'
SERVER_GRPC_INSECURE: 't'
SERVER_GRPC_BROADCAST_ADDRESS: localhost:7077
SERVER_INTERNAL_CLIENT_INTERNAL_GRPC_BROADCAST_ADDRESS: localhost:7077
SERVER_GRPC_PORT: '7077'
SERVER_URL: http://localhost:8888
SERVER_AUTH_SET_EMAIL_VERIFIED: 't'
SERVER_DEFAULT_ENGINE_VERSION: 'V1'
SERVER_LOGGER_LEVEL: debug
SERVER_LOGGER_FORMAT: console
steps:
- run: echo "Running Playwright PoC tests for draft PR"
- name: Define node version
uses: actions/setup-node@v4
with:
node-version: 24
- name: Check out repository code
uses: actions/checkout@v3
- uses: pnpm/action-setup@v4
with:
version: 11.5.0
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: |
${{ env.STORE_PATH }}
~/.cache/ms-playwright
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Cache turbo build artifacts
uses: actions/cache@v4
with:
path: |
.turbo
key: ${{ runner.os }}-turbo-${{ hashFiles('**/pnpm-lock.yaml', 'turbo.json') }}-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-turbo-${{ hashFiles('**/pnpm-lock.yaml', 'turbo.json') }}-
${{ runner.os }}-turbo-
- name: Install dependencies
run: pnpm install
- name: Build all packages and apps
run: pnpm run --filter @klicker-uzh/prisma build:test && pnpm run build:test
- name: Prepare .env files
run: |
./util/_create_hatchet_token_cypress.sh
- name: Apply migrations and reset database
run: |
cd packages/prisma
pnpm run prisma:reset:raw -f
env:
DATABASE_URL: postgres://klicker-prod:klicker@localhost:5432/klicker-prod
- name: Seed test participants for Playwright
run: pnpm --filter @klicker-uzh/prisma-data seed:test
env:
DATABASE_URL: postgres://klicker-prod:klicker@localhost:5432/klicker-prod
- name: Install Playwright browsers
run: pnpm --filter @klicker-uzh/playwright exec playwright install --with-deps chromium firefox webkit
- name: Start services and wait for readiness
run: |
chmod +x .github/scripts/wait-for-services.sh
.github/scripts/wait-for-services.sh
env:
APP_SECRET: abcd
DATABASE_URL: postgres://klicker-prod:klicker@localhost:5432/klicker-prod
NODE_ENV: production
SERVICE_ENDPOINTS: 'http://127.0.0.1:3000/healthz http://127.0.0.1:3001 http://127.0.0.1:3002 http://127.0.0.1:3003 http://127.0.0.1:3010'
TIMEOUT_SECONDS: '300'
CHECK_INTERVAL: '5'
REDIS_HOST: localhost
REDIS_PASS: ''
REDIS_PORT: 6379
REDIS_ASSESSMENT_PORT: 6381
REDIS_ASSESSMENT_PASS: ''
REDIS_ASSESSMENT_HOST: localhost
APP_ORIGIN_API: http://127.0.0.1:3000
APP_ORIGIN_AUTH: http://127.0.0.1:3010
APP_ORIGIN_LTI: http://127.0.0.1:3005
APP_ORIGIN_PWA: http://127.0.0.1:3001
APP_ORIGIN_MANAGE: http://127.0.0.1:3002
APP_ORIGIN_CONTROL: http://127.0.0.1:3003
APP_ORIGIN_ASSESSMENT_API: http://127.0.0.1:3000
APP_ORIGIN_ASSESSMENT_PWA: http://127.0.0.1:3001
- name: Run Playwright tests
run: pnpm --filter @klicker-uzh/playwright test:run
env:
PLAYWRIGHT_BASE_URL: http://127.0.0.1:3001
PW_STUDENT_USERNAME: testuser1
PW_STUDENT_PASSWORD: abcdabcd
- name: Upload Playwright artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-artifacts-draft
path: |
playwright/playwright-report
playwright/test-results
service.log
if-no-files-found: ignore
retention-days: 1