-
-
Notifications
You must be signed in to change notification settings - Fork 10
407 lines (355 loc) · 11.6 KB
/
Copy pathcross-browser-tests.yml
File metadata and controls
407 lines (355 loc) · 11.6 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
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
name: Cross-Browser Compatibility Tests
on:
push:
branches: [main, develop]
paths:
- 'packages/leptos/**'
- 'tests/e2e/**'
- '.github/workflows/cross-browser-tests.yml'
- 'playwright.config.ts'
- 'tests/e2e/cross-browser.config.ts'
pull_request:
branches: [main, develop]
paths:
- 'packages/leptos/**'
- 'tests/e2e/**'
- '.github/workflows/cross-browser-tests.yml'
- 'playwright.config.ts'
- 'tests/e2e/cross-browser.config.ts'
schedule:
# Run cross-browser tests weekly on Sundays at 2 AM UTC
- cron: '0 2 * * 0'
workflow_dispatch:
inputs:
browser:
description: 'Browser to test (all, chrome, firefox, safari, edge, mobile)'
required: false
default: 'all'
type: choice
options:
- all
- chrome
- firefox
- safari
- edge
- mobile
env:
NODE_VERSION: '20'
RUST_VERSION: 'stable'
RUSTFLAGS: "-D warnings"
jobs:
cross-browser-tests:
name: Cross-Browser Tests - ${{ matrix.browser }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
browser:
- chromium
- firefox
- webkit
include:
- browser: chromium
display-name: Chrome
project: chromium
- browser: firefox
display-name: Firefox
project: firefox
- browser: webkit
display-name: Safari
project: webkit
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps ${{ matrix.browser }}
- name: Cache Cargo build
uses: actions/cache@v3
with:
path: |
target/
~/.cargo/registry/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build demo application
run: |
cd examples/comprehensive-demo
trunk build --public-url /comprehensive-demo
- name: Start test server
run: |
cd examples/comprehensive-demo
python3 -m http.server 8001 &
echo $! > /tmp/test-server.pid
- name: Wait for server
run: |
for i in {1..30}; do
if curl -s http://localhost:8001 > /dev/null; then
echo "Server is ready"
exit 0
fi
echo "Waiting for server... ($i/30)"
sleep 2
done
echo "Server failed to start"
exit 1
- name: Run ${{ matrix.display-name }} cross-browser tests
run: |
pnpm exec playwright test \
--config=tests/e2e/cross-browser.config.ts \
--project=${{ matrix.project }} \
--reporter=json \
--reporter=html \
--reporter=line
env:
CI: true
HEADLESS: true
- name: Upload ${{ matrix.display-name }} test results
if: always()
uses: actions/upload-artifact@v3
with:
name: cross-browser-results-${{ matrix.browser }}
path: |
test-results/cross-browser/
playwright-report/
retention-days: 30
- name: Upload ${{ matrix.display-name }} screenshots
if: failure()
uses: actions/upload-artifact@v3
with:
name: cross-browser-screenshots-${{ matrix.browser }}
path: test-results/cross-browser/
retention-days: 30
- name: Stop test server
if: always()
run: |
if [ -f /tmp/test-server.pid ]; then
kill $(cat /tmp/test-server.pid) || true
fi
edge-tests:
name: Cross-Browser Tests - Edge
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps msedge
- name: Build demo application
run: |
cd examples/comprehensive-demo
trunk build --public-url /comprehensive-demo
- name: Start test server
run: |
cd examples/comprehensive-demo
python -m http.server 8001
continue-on-error: true
- name: Wait for server
run: |
for i in {1..30}; do
if curl -s http://localhost:8001 > /dev/null; then
echo "Server is ready"
exit 0
fi
echo "Waiting for server... ($i/30)"
sleep 2
done
- name: Run Edge cross-browser tests
run: |
pnpm exec playwright test \
--config=tests/e2e/cross-browser.config.ts \
--project=edge \
--reporter=json \
--reporter=html
env:
CI: true
HEADLESS: true
- name: Upload Edge test results
if: always()
uses: actions/upload-artifact@v3
with:
name: cross-browser-results-edge
path: |
test-results/cross-browser/
playwright-report/
retention-days: 30
mobile-tests:
name: Cross-Browser Tests - Mobile (${{ matrix.mobile-browser }})
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
mobile-browser:
- mobile-chrome
- mobile-safari
include:
- mobile-browser: mobile-chrome
display-name: Android Chrome
- mobile-browser: mobile-safari
display-name: iOS Safari
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps chromium webkit
- name: Cache Cargo build
uses: actions/cache@v3
with:
path: |
target/
~/.cargo/registry/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build demo application
run: |
cd examples/comprehensive-demo
trunk build --public-url /comprehensive-demo
- name: Start test server
run: |
cd examples/comprehensive-demo
python3 -m http.server 8001 &
echo $! > /tmp/test-server.pid
- name: Wait for server
run: |
for i in {1..30}; do
if curl -s http://localhost:8001 > /dev/null; then
echo "Server is ready"
exit 0
fi
echo "Waiting for server... ($i/30)"
sleep 2
done
- name: Run ${{ matrix.display-name }} tests
run: |
pnpm exec playwright test \
--config=tests/e2e/cross-browser.config.ts \
--project=${{ matrix.mobile-browser }} \
--reporter=line
env:
CI: true
HEADLESS: true
- name: Upload ${{ matrix.display-name }} test results
if: always()
uses: actions/upload-artifact@v3
with:
name: cross-browser-results-${{ matrix.mobile-browser }}
path: |
test-results/cross-browser/
playwright-report/
retention-days: 30
- name: Stop test server
if: always()
run: |
if [ -f /tmp/test-server.pid ]; then
kill $(cat /tmp/test-server.pid) || true
fi
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [cross-browser-tests, edge-tests, mobile-tests]
if: always()
steps:
- name: Download all test results
uses: actions/download-artifact@v3
with:
path: test-results/all
- name: Generate cross-browser test summary
run: |
echo "# Cross-Browser Compatibility Test Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Browser Coverage" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Chromium (Chrome)" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Firefox" >> $GITHUB_STEP_SUMMARY
echo "- ✅ WebKit (Safari)" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Edge" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Mobile Chrome" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Mobile Safari" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Components Tested" >> $GITHUB_STEP_SUMMARY
echo "All 41+ components tested across all browsers:" >> $GITHUB_STEP_SUMMARY
echo "- Basic: button, input, checkbox, switch, etc." >> $GITHUB_STEP_SUMMARY
echo "- Interactive: tabs, accordion, dialog, etc." >> $GITHUB_STEP_SUMMARY
echo "- Layout: card, separator, scroll-area, etc." >> $GITHUB_STEP_SUMMARY
echo "- Complex: form, calendar, date-picker, etc." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "## Feature Detection" >> $GITHUB_STEP_SUMMARY
echo "- CSS Variables support" >> $GITHUB_STEP_SUMMARY
echo "- Flexbox and Grid support" >> $GITHUB_STEP_SUMMARY
echo "- WASM module loading" >> $GITHUB_STEP_SUMMARY
echo "- Accessibility features" >> $GITHUB_STEP_SUMMARY
echo "- Viewport responsiveness" >> $GITHUB_STEP_SUMMARY
- name: Check test results
run: |
if [ -d "test-results/all" ]; then
echo "Test results downloaded successfully"
ls -la test-results/all
else
echo "No test results found"
fi