@@ -3,7 +3,7 @@ name: Playwright Tests
3
3
on :
4
4
push :
5
5
branches :
6
- - master
6
+ - main
7
7
pull_request :
8
8
types :
9
9
- opened
16
16
default : ' false'
17
17
18
18
jobs :
19
+ changes :
20
+ runs-on : ubuntu-latest
21
+ # Set job outputs to values from filter step
22
+ outputs :
23
+ changed : ${{ steps.filter.outputs.changed }}
24
+ steps :
25
+ - uses : actions/checkout@v4
26
+ # For pull requests it's not necessary to checkout the code but for the main branch it is
27
+ - uses : dorny/paths-filter@v3
28
+ id : filter
29
+ with :
30
+ filters : |
31
+ changed:
32
+ - backend/**
33
+ - frontend/**
34
+ - .env
35
+ - docker-compose*.yml
36
+ - .github/workflows/playwright.yml
19
37
20
- test :
38
+ test-playwright :
39
+ needs :
40
+ - changes
41
+ if : ${{ needs.changes.outputs.changed == 'true' }}
21
42
timeout-minutes : 60
22
43
runs-on : ubuntu-latest
44
+ strategy :
45
+ matrix :
46
+ shardIndex : [1, 2, 3, 4]
47
+ shardTotal : [4]
48
+ fail-fast : false
23
49
steps :
24
50
- uses : actions/checkout@v4
25
51
- uses : actions/setup-node@v4
@@ -33,35 +59,63 @@ jobs:
33
59
if : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
34
60
with :
35
61
limit-access-to-actor : true
36
- - name : Install dependencies
37
- run : npm ci
38
- working-directory : frontend
39
- - name : Install Playwright Browsers
40
- run : npx playwright install --with-deps
41
- working-directory : frontend
42
62
- run : cp .env.example .env
63
+ - run : cp frontend/.env.example frontend/.env
43
64
- run : docker compose build
44
65
- run : docker compose down -v --remove-orphans
45
- - run : docker compose up -d
46
66
- name : Run Playwright tests
47
- run : npx playwright test
48
- working-directory : frontend
67
+ run : docker compose run --rm playwright npx playwright test --fail-on-flaky-tests --trace=retain-on-failure --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
49
68
- run : docker compose down -v --remove-orphans
50
- - uses : actions/upload-artifact@v4
51
- if : always()
69
+ - name : Upload blob report to GitHub Actions Artifacts
70
+ if : ${{ !cancelled() }}
71
+ uses : actions/upload-artifact@v4
72
+ with :
73
+ name : blob-report-${{ matrix.shardIndex }}
74
+ path : frontend/blob-report
75
+ include-hidden-files : true
76
+ retention-days : 1
77
+
78
+ merge-playwright-reports :
79
+ needs :
80
+ - test-playwright
81
+ - changes
82
+ # Merge reports after playwright-tests, even if some shards have failed
83
+ if : ${{ !cancelled() && needs.changes.outputs.changed == 'true' }}
84
+ runs-on : ubuntu-latest
85
+ steps :
86
+ - uses : actions/checkout@v4
87
+ - uses : actions/setup-node@v4
88
+ with :
89
+ node-version : 20
90
+ - name : Install dependencies
91
+ run : npm ci
92
+ working-directory : frontend
93
+ - name : Download blob reports from GitHub Actions Artifacts
94
+ uses : actions/download-artifact@v4
95
+ with :
96
+ path : frontend/all-blob-reports
97
+ pattern : blob-report-*
98
+ merge-multiple : true
99
+ - name : Merge into HTML Report
100
+ run : npx playwright merge-reports --reporter html ./all-blob-reports
101
+ working-directory : frontend
102
+ - name : Upload HTML report
103
+ uses : actions/upload-artifact@v4
52
104
with :
53
- name : playwright -report
54
- path : frontend/playwright-report/
105
+ name : html -report--attempt-${{ github.run_attempt }}
106
+ path : frontend/playwright-report
55
107
retention-days : 30
108
+ include-hidden-files : true
56
109
57
110
# https://github.com/marketplace/actions/alls-green#why
58
- e2e- alls-green : # This job does nothing and is only used for the branch protection
111
+ alls-green-playwright : # This job does nothing and is only used for the branch protection
59
112
if : always()
60
113
needs :
61
- - test
114
+ - test-playwright
62
115
runs-on : ubuntu-latest
63
116
steps :
64
117
- name : Decide whether the needed jobs succeeded or failed
65
118
uses : re-actors/alls-green@release/v1
66
119
with :
67
120
jobs : ${{ toJSON(needs) }}
121
+ allowed-skips : test-playwright
0 commit comments