Skip to content

Commit 14a057b

Browse files
chore: update playwright in ci to run only on aria changes (#4452)
* chore: update playwright in ci to run only on aria changes * fix: issue with wrong playwright path * fix: issue with wrong dependency * fix: issue with playwright configs * fix: issue with wrong playwright config * fix: issue with wrong playwright config * fix: issue with wrong playwright config * fix: issue with checks done * test: changed aria * fix: issue with missing branch for git diff * chore: update check.ts to check against remote * auto update snapshots (#4477) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: update playwright config * auto update snapshots (#4478) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * test: aria snapshot trigger * test: without fetch repo * chore: revert test changes * auto update snapshots (#4482) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 2baa1ca commit 14a057b

File tree

148 files changed

+1360
-245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+1360
-245
lines changed

.config/.jscpd.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"**/test-results/**",
3636
"**/tests/**",
3737
"**/tsconfig.json",
38+
"**/e2e/**/*.spec.ts",
3839
"packages/components/scripts/post-build/components.ts",
3940
"packages/components/src/components/**/*.spec.tsx",
4041
"packages/components/src/components/**/index.html",
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: 🎭 Playwright E2E
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
required: true
8+
type: string
9+
path:
10+
required: false
11+
type: string
12+
13+
permissions:
14+
actions: write
15+
contents: write
16+
17+
jobs:
18+
playwright-patternhub:
19+
name: 🧪🎭 - patternhub
20+
runs-on: ubuntu-24.04 # Use Ubuntu 24.04 explicitly
21+
container:
22+
image: mcr.microsoft.com/playwright:v${{ inputs.version }}
23+
options: --user 1001
24+
steps:
25+
- name: ⏬ Checkout repo
26+
uses: actions/checkout@v4
27+
28+
- name: 🔄 Init Cache
29+
uses: ./.github/actions/npm-cache
30+
31+
- name: ⏬ Download foundations build
32+
uses: actions/download-artifact@v4
33+
with:
34+
name: db-ux-foundations-build
35+
path: packages/foundations/build
36+
37+
- name: ⏬ Download output
38+
uses: actions/download-artifact@v4
39+
with:
40+
name: db-ux-output
41+
path: output
42+
43+
- name: ⏬ Download components styles build
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: db-ux-components-build
47+
path: packages/components/build
48+
49+
- name: ⏬ Download patternhub
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: db-ux-patternhub
53+
path: build-showcases/patternhub
54+
55+
# We test everything for patternhub and main branch
56+
- name: 👩‍🔬 Test showcase with Playwright 🎭
57+
shell: bash
58+
env:
59+
NEXT_PUBLIC_BASE_PATH: ${{ inputs.path }}
60+
run: |
61+
mkdir -p ./build-showcases${{ inputs.path }}
62+
cp -RT ./build-showcases/patternhub ./build-showcases${{ inputs.path }}
63+
npm run test:e2e --workspace=patternhub
64+
65+
- name: 🔣 Print GitHub Report
66+
if: failure()
67+
shell: bash
68+
run: |
69+
npx playwright merge-reports --reporter github ./blob-report
70+
71+
- name: 🆙 Upload test results
72+
if: failure()
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: patternhub-playwright-results
76+
path: ./showcases/patternhub/test-results
77+
retention-days: 30

.github/workflows/02-e2e-regenerate.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ jobs:
7878
cp --recursive --no-target-directory ./build-showcases/${{ inputs.type }} ./build-showcases${{ inputs.path }}
7979
npm run regenerate:screenshots --workspace=patternhub
8080
else
81-
npm run regenerate:screenshots --workspace=react-showcase
81+
npm run regenerate:visual-snapshots --workspace=react-showcase
82+
npm run regenerate:aria-snapshots --workspace=react-showcase
8283
fi
8384
8485
- name: 🆙 Upload components

.github/workflows/02-e2e-showcases.yml

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ on:
99
showcase:
1010
required: true
1111
type: string
12-
path:
13-
required: false
14-
type: string
12+
outputs:
13+
aria-snapshots-changed:
14+
description: "If aria snapshots changed in current PR"
15+
value: ${{ jobs.playwright-showcases.outputs.aria-snapshots-changed }}
16+
aria-snapshots-changed-to-main:
17+
description: "If aria snapshots changed to main branch"
18+
value: ${{ jobs.playwright-showcases.outputs.aria-snapshots-changed-to-main }}
19+
visual-snapshots-changed:
20+
description: "If visual snapshots changed"
21+
value: ${{ jobs.playwright-showcases.outputs.visual-snapshots-changed }}
1522

1623
permissions:
1724
actions: write
@@ -27,11 +34,18 @@ jobs:
2734
strategy:
2835
fail-fast: false
2936
matrix:
30-
shardIndex: [1, 2, 3, 4, 5, 6]
31-
shardTotal: [6]
37+
shardIndex: [1, 2, 3, 4]
38+
shardTotal: [4]
39+
outputs:
40+
aria-snapshots-changed: ${{ steps.aria-snapshots.outputs.aria-snapshots-changed }}
41+
aria-snapshots-changed-to-main: ${{ steps.aria-snapshots.outputs.aria-snapshots-changed-to-main }}
42+
visual-snapshots-changed: ${{ steps.visual-snapshots.outputs.visual-snapshots-changed }}
3243
steps:
3344
- name: ⏬ Checkout repo
3445
uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 0 # fetch all history for all branches
48+
fetch-tags: false
3549

3650
- name: 🔄 Init Cache
3751
uses: ./.github/actions/npm-cache
@@ -60,21 +74,50 @@ jobs:
6074
name: db-ux-${{ inputs.showcase }}
6175
path: build-showcases/${{ inputs.showcase }}
6276

63-
- name: 🧴 Copy patternhub testing app
64-
if: inputs.path
65-
shell: bash
66-
run: |
67-
mkdir --parents ./build-showcases${{ inputs.path }}
68-
cp --recursive --no-target-directory ./build-showcases/${{ inputs.showcase }} ./build-showcases${{ inputs.path }}
69-
77+
# We test everything for patternhub and main branch
7078
- name: 👩‍🔬 Test showcase with Playwright 🎭
7179
shell: bash
80+
if: github.event.pull_request == null
7281
env:
7382
NEXT_PUBLIC_BASE_PATH: ${{ inputs.path }}
7483
run: |
75-
ls ./build-showcases${{ inputs.path }}
7684
npm run test:e2e --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
7785
86+
# We check if aria-snapshots were changed
87+
- name: 👩‍🔬 Test aria-snapshots with Playwright 🎭
88+
id: aria-snapshots
89+
shell: bash
90+
if: github.event.pull_request != null
91+
run: |
92+
npm run test:aria-snapshots --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --update-snapshots
93+
OUTPUT=$(npx --no tsx scripts/github/snapshot-changes/check-aria.ts)
94+
echo "aria-snapshots-changed=$OUTPUT" >> $GITHUB_OUTPUT
95+
OUTPUT=$(npx --no tsx scripts/github/snapshot-changes/check-main-aria.ts)
96+
echo "aria-snapshots-changed-to-main=$OUTPUT" >> $GITHUB_OUTPUT
97+
98+
- name: 👩‍🔬 Test axe-core with Playwright 🎭
99+
shell: bash
100+
if: github.event.pull_request != null
101+
run: |
102+
npm run test:axe-core --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
103+
104+
- name: 👩‍🔬 Test visual-snapshots with Playwright 🎭
105+
id: visual-snapshots
106+
shell: bash
107+
if: github.event.pull_request != null
108+
run: |
109+
npm run test:visual-snapshots --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --update-snapshots
110+
OUTPUT=$(npx --no tsx scripts/github/snapshot-changes/check-visual.ts)
111+
echo "visual-snapshots-changed=$OUTPUT" >> $GITHUB_OUTPUT
112+
113+
- name: 👩‍🔬 Test a11y-checker with Playwright 🎭
114+
shell: bash
115+
if: |
116+
github.event.pull_request != null &&
117+
steps.aria-snapshots.outputs.aria-snapshots-changed-to-main=='true'
118+
run: |
119+
npm run test:a11y-checker --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
120+
78121
- name: 🔣 Print GitHub Report
79122
if: failure()
80123
shell: bash
@@ -88,11 +131,3 @@ jobs:
88131
name: ${{ inputs.showcase }}-playwright-results-${{ matrix.shardIndex }}
89132
path: ./showcases/${{ inputs.showcase }}/test-results
90133
retention-days: 30
91-
92-
- name: 🆙 Upload aChecker results
93-
if: failure()
94-
uses: actions/upload-artifact@v4
95-
with:
96-
name: ${{ inputs.showcase }}-showcase-achecker-results-${{ matrix.shardIndex }}
97-
path: ./showcases/${{ inputs.showcase }}-showcase/results
98-
retention-days: 30

.github/workflows/default.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,11 @@ jobs:
143143
showcase: vue-showcase
144144

145145
test-showcase-patternhub:
146-
uses: ./.github/workflows/02-e2e-showcases.yml
146+
uses: ./.github/workflows/02-e2e-patternhub.yml
147147
needs: [build-showcase-patternhub, get-playwright-version]
148148
with:
149149
version: ${{ needs.get-playwright-version.outputs.version }}
150150
path: ${{ needs.build-showcase-patternhub.outputs.path }}
151-
showcase: patternhub
152151

153152
regenerate-snapshots-components:
154153
if: always() && needs.test-components.result == 'failure'
@@ -180,14 +179,24 @@ jobs:
180179
get-playwright-version
181180
]
182181

182+
# This job runs only if aria-snapshots were changed compared to main or if it runs on main branch
183183
test-screen-reader:
184+
if: |
185+
needs.test-showcase-react.outputs.aria-snapshots-changed-to-main == 'true' ||
186+
github.event.pull_request == null
184187
uses: ./.github/workflows/02-e2e-screen-reader.yml
185-
needs: [build-showcase-react, init-playwright, get-playwright-version]
188+
needs: [test-showcase-react, init-playwright, get-playwright-version]
186189
with:
187190
version: ${{ needs.get-playwright-version.outputs.version }}
188191

189192
regenerate-snapshots:
190-
if: always() && (needs.test-showcase-angular.result == 'failure' || needs.test-showcase-react.result == 'failure' || needs.test-showcase-vue.result == 'failure')
193+
if: |
194+
needs.test-showcase-angular.outputs.aria-snapshots-changed == 'true' ||
195+
needs.test-showcase-angular.outputs.visual-snapshots-changed == 'true' ||
196+
needs.test-showcase-react.outputs.aria-snapshots-changed == 'true' ||
197+
needs.test-showcase-react.outputs.visual-snapshots-changed == 'true' ||
198+
needs.test-showcase-vue.outputs.aria-snapshots-changed == 'true' ||
199+
needs.test-showcase-vue.outputs.visual-snapshots-changed == 'true'
191200
uses: ./.github/workflows/02-e2e-regenerate.yml
192201
with:
193202
version: ${{ needs.get-playwright-version.outputs.version }}
@@ -241,7 +250,7 @@ jobs:
241250
resultTestShowcasePatternhub="${{ needs.test-showcase-patternhub.result }}"
242251
resultTestScreenReader="${{ needs.test-screen-reader.result }}"
243252
if [[ $resultTestFoundations == "success" ]] && \
244-
[[ $resultTestScreenReader == "success" ]] && \
253+
[[ $resultTestScreenReader == "success" || $resultTestScreenReader == "skipped" ]] && \
245254
[[ $resultTestShowcaseStencil == "success" ]] && \
246255
[[ $resultTestShowcaseAngular == "success" ]] && \
247256
[[ $resultTestShowcaseReact == "success" ]] && \

.github/workflows/release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,11 @@ jobs:
130130
showcase: vue-showcase
131131

132132
test-showcase-patternhub:
133-
uses: ./.github/workflows/02-e2e-showcases.yml
133+
uses: ./.github/workflows/02-e2e-patternhub.yml
134134
needs: [build-showcase-patternhub, get-playwright-version]
135135
with:
136-
path: ${{ needs.build-showcase-patternhub.outputs.path }}
137136
version: ${{ needs.get-playwright-version.outputs.version }}
138-
showcase: patternhub
137+
path: ${{ needs.build-showcase-patternhub.outputs.path }}
139138

140139
test-screen-reader:
141140
uses: ./.github/workflows/02-e2e-screen-reader.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
- main:
2+
- heading "DBStack" [level=1]
3+
- link "Density"
4+
- text: Functional
5+
- link "Content 1"
6+
- text: Content 2 Content 3 (Default) Regular
7+
- link "Content 1"
8+
- text: Content 2 Content 3 Expressive
9+
- link "Content 1"
10+
- text: Content 2 Content 3
11+
- link "Variant"
12+
- text: (Default) Simple
13+
- link "Content 1"
14+
- text: Content 2 Content 3 Divider
15+
- link "Content 1"
16+
- text: Content 2 Content 3
17+
- link "Gap"
18+
- text: none
19+
- link "Content 1"
20+
- text: Content 2 Content 3 3x-small
21+
- link "Content 1"
22+
- text: Content 2 Content 3 2x-small
23+
- link "Content 1"
24+
- text: Content 2 Content 3 x-small
25+
- link "Content 1"
26+
- text: Content 2 Content 3 (Default) small
27+
- link "Content 1"
28+
- text: Content 2 Content 3 medium
29+
- link "Content 1"
30+
- text: Content 2 Content 3 large
31+
- link "Content 1"
32+
- text: Content 2 Content 3 x-large
33+
- link "Content 1"
34+
- text: Content 2 Content 3 2x-large
35+
- link "Content 1"
36+
- text: Content 2 Content 3 3x-large
37+
- link "Content 1"
38+
- text: Content 2 Content 3
39+
- link "Direction"
40+
- text: (Default) Column
41+
- link "Content 1"
42+
- text: Content 2 Content 3 Row
43+
- link "Content 1"
44+
- text: Content 2 Content 3
45+
- link "Wrap"
46+
- text: "(Default) No Wrap: Column"
47+
- link "Content 1"
48+
- text: "Content 2 Content 3 No Wrap: Row"
49+
- link "Content 1"
50+
- text: "Content 2 Content 3 Wrap: Column"
51+
- link "Content 1"
52+
- text: "Content 2 Content 3 Wrap: Row"
53+
- link "Content 1"
54+
- text: Content 2 Content 3
55+
- link "Alignment Column"
56+
- text: (Default) Stretch
57+
- link "Content 1"
58+
- text: Content 2 Content 3 Start
59+
- link "Content 1"
60+
- text: Content 2 Content 3 Center
61+
- link "Content 1"
62+
- text: Content 2 Content 3 End
63+
- link "Content 1"
64+
- text: Content 2 Content 3
65+
- link "Alignment Row"
66+
- text: (Default) Stretch
67+
- link "Content 1"
68+
- text: Content 2 Content 3 Start
69+
- link "Content 1"
70+
- text: Content 2 Content 3 Center
71+
- link "Content 1"
72+
- text: Content 2 Content 3 End
73+
- link "Content 1"
74+
- text: Content 2 Content 3
75+
- link "Justify Content Column"
76+
- text: (Default) Start
77+
- link "Content 1"
78+
- text: Content 2 Content 3 Center
79+
- link "Content 1"
80+
- text: Content 2 Content 3 End
81+
- link "Content 1"
82+
- text: Content 2 Content 3 Space-Between
83+
- link "Content 1"
84+
- text: Content 2 Content 3
85+
- link "Justify Content Row"
86+
- text: (Default) Start
87+
- link "Content 1"
88+
- text: Content 2 Content 3 Center
89+
- link "Content 1"
90+
- text: Content 2 Content 3 End
91+
- link "Content 1"
92+
- text: Content 2 Content 3 Space-Between
93+
- link "Content 1"
94+
- text: Content 2 Content 3

0 commit comments

Comments
 (0)