-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (67 loc) · 2.26 KB
/
test.yml
File metadata and controls
80 lines (67 loc) · 2.26 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
name: E2E Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
name: Run E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Build Docusaurus
run: npm run build
- name: Run Playwright tests
env:
PLAYWRIGHT_JUNIT_OUTPUT_FILE: test-results/junit.xml
run: npx playwright test --reporter=junit,html,list
- name: Upload test results (JUnit XML)
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-junit
path: test-results/junit.xml
retention-days: 30
- name: Upload test results (HTML Report)
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-html
path: test-results/html/
retention-days: 30
- name: Upload test screenshots (on failure)
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-screenshots
path: test-results/
retention-days: 30
- name: Publish test results summary
if: always()
run: |
if [ -f test-results/junit.xml ]; then
echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Extract test counts (basic parsing)
tests=$(grep -oP 'tests="\K[^"]+' test-results/junit.xml | head -1 || echo "N/A")
failures=$(grep -oP 'failures="\K[^"]+' test-results/junit.xml | head -1 || echo "N/A")
echo "- **Total Tests:** $tests" >> $GITHUB_STEP_SUMMARY
echo "- **Failures:** $failures" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "📊 [View detailed HTML report in artifacts](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY
fi