forked from milos-pujic/playwright-e2e-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
269 lines (266 loc) · 9.52 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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
name: Playwright Tests
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * 1'
jobs:
install:
name: Install
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout Repository
id: checkout-repository
uses: actions/checkout@v4
- name: Setup Node
id: setup-node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Cache Playwright Binaries
id: cache-playwright
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
key: playwright-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
id: install-dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Install Playwright Browsers
id: install-playwright-browsers
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
test:
name: Tests - ${{ matrix.project }} - Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}
runs-on: ubuntu-latest
needs: [install]
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
project: [chromium, firefox, webkit]
shardIndex: [1, 2]
shardTotal: [2]
services:
rbp-booking:
image: mwinteringham/restfulbookerplatform_booking:1.6.24c7b22
ports:
- 3000:3000
rbp-room:
image: mwinteringham/restfulbookerplatform_room:1.6.24c7b22
ports:
- 3001:3001
rbp-branding:
image: mwinteringham/restfulbookerplatform_branding:1.6.24c7b22
ports:
- 3002:3002
rbp-assets:
image: mwinteringham/restfulbookerplatform_assets:1.6.24c7b22
ports:
- 3003:3003
rbp-auth:
image: mwinteringham/restfulbookerplatform_auth:1.6.24c7b22
ports:
- 3004:3004
rbp-report:
image: mwinteringham/restfulbookerplatform_report:1.6.24c7b22
ports:
- 3005:3005
rbp-message:
image: mwinteringham/restfulbookerplatform_message:1.6.24c7b22
ports:
- 3006:3006
rbp-proxy:
image: mwinteringham/restfulbookerplatform_proxy:latest
ports:
- 80:80
steps:
- name: Checkout Repository
id: checkout-repository
uses: actions/checkout@v4
- name: Setup Node
id: setup-node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Cache Playwright Binaries
id: cache-playwright
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
key: playwright-${{ hashFiles('package-lock.json') }}
# Playwright caches the browser binaries, but not their dependencies.
# Those extra browser dependencies must be installed separately when the cached browsers are restored.
- name: Install Playwright System Dependencies
id: install-playwright-system-dependencies
run: npx playwright install-deps ${{ matrix.project }}
- name: Run Playwright Tests
id: run-playwright-tests
run: npx playwright test --project=${{ matrix.project }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
env:
ENV: local
BLOB_NAME: ${{ matrix.project }}-${{ matrix.shardIndex }}
- name: Upload Playwright Blob Report
id: upload-playwright-blob-report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-blob-report-${{ matrix.project }}-${{ matrix.shardIndex }}_${{ matrix.shardTotal }}
path: playwright-blob-report
if-no-files-found: ignore
retention-days: 1
- name: Upload Playwright Test Results
id: upload-playwright-test-results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.project }}-${{ matrix.shardIndex }}_${{ matrix.shardTotal }}
path: test-results/
if-no-files-found: ignore
retention-days: 1
- name: Upload Playwright Monocart Report
id: upload-playwright-monocart-report
uses: actions/upload-artifact@v4
if: always()
with:
name: monocart-report-${{ matrix.project }}-${{ matrix.shardIndex }}_${{ matrix.shardTotal }}
path: playwright-monocart-report/
if-no-files-found: ignore
retention-days: 1
- name: Upload Playwright Allure Results
id: upload-playwright-allure-results
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-allure-results-${{ matrix.project }}-${{ matrix.shardIndex }}_${{ matrix.shardTotal }}
path: playwright-allure-results/
if-no-files-found: ignore
retention-days: 1
report:
name: Merge and Publish Reports
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [test]
timeout-minutes: 30
permissions:
actions: write
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout Repository
id: checkout-repository
uses: actions/checkout@v4
- name: Setup Node
id: setup-node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Cache Playwright Binaries
id: cache-playwright
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
key: playwright-${{ hashFiles('package-lock.json') }}
- name: Download Playwright Blob Reports
id: download-blob-reports
uses: actions/download-artifact@v4
with:
path: playwright-all-blob-reports
pattern: playwright-blob-report-*
merge-multiple: true
- name: Merge Playwright HTML Reports
id: merge-playwright-html-reports
run: npx playwright merge-reports --reporter html ./playwright-all-blob-reports
- name: Download Monocart Reports
id: download-monocart-reports
uses: actions/download-artifact@v4
with:
pattern: monocart-report-*
- name: Download Test Results
id: download-test-results
uses: actions/download-artifact@v4
with:
path: merged-monocart-report/data
pattern: test-results-*
merge-multiple: true
- name: Merge Playwright Monocart Reports
id: merge-playwright-monocart-reports
run: |
curl -o previous-trend.json https://milos-pujic.github.io/playwright-e2e-tests/monocart/index.json
npm run merge:report:monocart
- name: Download Allure Results
id: download-allure-results
uses: actions/download-artifact@v4
with:
path: playwright-allure-results
pattern: playwright-allure-results-*
merge-multiple: true
- name: Generate Allure Report
id: generate-allure-report
run: |
curl --create-dirs -o ./playwright-allure-results/history/categories-trend.json https://milos-pujic.github.io/playwright-e2e-tests/allure/history/categories-trend.json
curl --create-dirs -o ./playwright-allure-results/history/duration-trend.json https://milos-pujic.github.io/playwright-e2e-tests/allure/history/duration-trend.json
curl --create-dirs -o ./playwright-allure-results/history/history-trend.json https://milos-pujic.github.io/playwright-e2e-tests/allure/history/history-trend.json
curl --create-dirs -o ./playwright-allure-results/history/history.json https://milos-pujic.github.io/playwright-e2e-tests/allure/history/history.json
curl --create-dirs -o ./playwright-allure-results/history/retry-trend.json https://milos-pujic.github.io/playwright-e2e-tests/allure/history/retry-trend.json
npx allure generate playwright-allure-results -o playwright-allure-report --clean
- name: Move to Reports folder
id: move-to-reports-folder
run: |
mv playwright-report reports/playwright
mv merged-monocart-report reports/monocart
mv playwright-allure-report reports/allure
shell: bash
- name: Setup Pages
id: setup-pages
uses: actions/configure-pages@v5
- name: Upload Pages Artifact
id: upload-pages-artifact
uses: actions/upload-pages-artifact@v3
with:
path: reports/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Delete Unnecessary Artifacts
id: delete-unnecessary-artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
playwright-blob-report-*
test-results-*
monocart-report-*
playwright-allure-results-*
failOnError: false