Skip to content

Commit 138055c

Browse files
authored
fix: issue issues with snapshots in pipeline (#5243)
1 parent c795993 commit 138055c

File tree

19 files changed

+685
-130
lines changed

19 files changed

+685
-130
lines changed

.github/workflows/00-scan-secrets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
jobs:
1010
TruffleHog:
11+
if: ${{ github.event.pull_request != null }} # only scan on pull-requests
1112
runs-on: ubuntu-24.04 # Use Ubuntu 24.04 explicitly
1213
steps:
1314
- name: ⏬ Checkout repo
@@ -17,7 +18,6 @@ jobs:
1718

1819
# https://github.com/marketplace/actions/trufflehog-oss#advanced-usage-scan-entire-branch
1920
- name: 🐷 TruffleHog OSS
20-
if: ${{ github.event.pull_request != null }} # only scan on pull-requests
2121
uses: trufflesecurity/trufflehog@main
2222
with:
2323
# Setting base to an empty string scans the entire branch, per TruffleHog OSS advanced usage:

.github/workflows/01-get-playwright-version.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,23 @@ on:
1010
version:
1111
description: "Current playwright version"
1212
value: ${{ jobs.playwright-version.outputs.version }}
13+
test-ally:
14+
description: "If aria-snapshots are changed"
15+
value: ${{ jobs.playwright-version.outputs.test-ally }}
1316

1417
jobs:
1518
playwright-version:
1619
name: Get and save publish version
1720
runs-on: ubuntu-24.04 # Use Ubuntu 24.04 explicitly
1821
outputs:
1922
version: ${{ steps.version.outputs.version }}
23+
test-ally: ${{ steps.ally.outputs.test-ally }}
2024
steps:
2125
- name: ⏬ Checkout repo
2226
uses: actions/checkout@v5
27+
with:
28+
fetch-depth: 0
29+
fetch-tags: false
2330

2431
- name: 🔄 Init Cache
2532
uses: ./.github/actions/npm-cache
@@ -29,3 +36,11 @@ jobs:
2936
run: |
3037
OUTPUT=$(npx --no tsx scripts/github/get-playwright-version.ts)
3138
echo "version=$OUTPUT" >> $GITHUB_OUTPUT
39+
40+
- name: 👩 Should Test a11y
41+
id: ally
42+
shell: bash
43+
run: |
44+
ARIA_MAIN=$(npx --no tsx scripts/github/snapshot-changes/check-main-aria.ts)
45+
echo "test-ally=$ARIA_MAIN"
46+
echo "test-ally=$ARIA_MAIN" >> $GITHUB_OUTPUT

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

Lines changed: 15 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,9 @@ on:
99
showcase:
1010
required: true
1111
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 }}
12+
test-ally:
13+
required: false
14+
type: string
2215

2316
permissions:
2417
actions: write
@@ -32,20 +25,15 @@ jobs:
3225
image: mcr.microsoft.com/playwright:v${{ inputs.version }}
3326
options: --user 1001
3427
strategy:
35-
fail-fast: false
28+
fail-fast: true
3629
matrix:
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 }}
30+
shardIndex: [1, 2, 3, 4, 5]
31+
shardTotal: [5]
4332
steps:
4433
- name: ⏬ Checkout repo
4534
uses: actions/checkout@v5
4635
with:
47-
fetch-depth: 0 # fetch all history for all branches
48-
fetch-tags: false
36+
fetch-depth: 2
4937

5038
- name: 🔄 Init Cache
5139
uses: ./.github/actions/npm-cache
@@ -89,60 +77,37 @@ jobs:
8977
shell: bash
9078
if: github.event.pull_request != null
9179
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-
if [ "$OUTPUT" = "true" ]; then
95-
echo "aria-snapshots-changed=$OUTPUT" >> $GITHUB_OUTPUT
96-
fi
97-
OUTPUT=$(npx --no tsx scripts/github/snapshot-changes/check-main-aria.ts)
98-
if [ "$OUTPUT" = "true" ]; then
99-
echo "aria-snapshots-changed-to-main=$OUTPUT" >> $GITHUB_OUTPUT
100-
fi
80+
npm run test:aria-snapshots --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
10181
102-
- name: 👩‍🔬 Test axe-core with Playwright 🎭
82+
- name: 👩‍🔬 Test visual-snapshots with Playwright 🎭
83+
id: visual-snapshots
10384
shell: bash
10485
if: github.event.pull_request != null
10586
run: |
106-
npm run test:axe-core --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
87+
npm run test:visual-snapshots --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
10788
108-
- name: 👩‍🔬 Test visual-snapshots with Playwright 🎭
109-
id: visual-snapshots
89+
- name: 👩‍🔬 Test axe-core with Playwright 🎭
11090
shell: bash
11191
if: github.event.pull_request != null
11292
run: |
113-
npm run test:visual-snapshots --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --update-snapshots
114-
OUTPUT=$(npx --no tsx scripts/github/snapshot-changes/check-visual.ts)
115-
if [ "$OUTPUT" = "true" ]; then
116-
echo "visual-snapshots-changed=$OUTPUT" >> $GITHUB_OUTPUT
117-
fi
93+
npm run test:axe-core --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
11894
11995
- name: 👩‍🔬 Test a11y-checker with Playwright 🎭
12096
shell: bash
12197
if: |
12298
github.event.pull_request != null &&
123-
steps.aria-snapshots.outputs.aria-snapshots-changed-to-main == 'true'
99+
inputs.test-ally == 'true'
124100
run: |
125101
npm run test:a11y-checker --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
126102
127-
- name: 🌳 Log Snapshot Changes
128-
if: github.event.pull_request != null
129-
env:
130-
ARIA: ${{ steps.aria-snapshots.outputs.aria-snapshots-changed}}
131-
VISUAL: ${{ steps.visual-snapshots.outputs.visual-snapshots-changed}}
132-
ARIA_MAIN: ${{ steps.aria-snapshots.outputs.aria-snapshots-changed-to-main }}
133-
run: |
134-
echo "ARIA: $ARIA"
135-
echo "VISUAL: $VISUAL"
136-
echo "ARIA_MAIN: $ARIA_MAIN"
137-
138103
- name: 🔣 Print GitHub Report
139104
if: failure()
140105
shell: bash
141106
run: |
142107
npx playwright merge-reports --reporter github ./blob-report
143108
144109
- name: 🆙 Upload test results
145-
if: failure()
110+
if: ${{ failure() }}
146111
uses: actions/upload-artifact@v4
147112
with:
148113
name: ${{ inputs.showcase }}-playwright-results-${{ matrix.shardIndex }}

.github/workflows/default.yml

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -211,27 +211,31 @@ jobs:
211211
with:
212212
version: ${{ needs.get-playwright-version.outputs.version }}
213213
showcase: stencil-showcase
214+
test-ally: ${{ needs.get-playwright-version.outputs.test-ally }}
214215

215216
test-showcase-angular:
216217
uses: ./.github/workflows/02-e2e-showcases.yml
217218
needs: [build-showcase-angular, get-playwright-version]
218219
with:
219220
version: ${{ needs.get-playwright-version.outputs.version }}
220221
showcase: angular-showcase
222+
test-ally: ${{ needs.get-playwright-version.outputs.test-ally }}
221223

222224
test-showcase-react:
223225
uses: ./.github/workflows/02-e2e-showcases.yml
224226
needs: [build-showcase-react, get-playwright-version]
225227
with:
226228
version: ${{ needs.get-playwright-version.outputs.version }}
227229
showcase: react-showcase
230+
test-ally: ${{ needs.get-playwright-version.outputs.test-ally }}
228231

229232
test-showcase-vue:
230233
uses: ./.github/workflows/02-e2e-showcases.yml
231234
needs: [build-showcase-vue, get-playwright-version]
232235
with:
233236
version: ${{ needs.get-playwright-version.outputs.version }}
234237
showcase: vue-showcase
238+
test-ally: ${{ needs.get-playwright-version.outputs.test-ally }}
235239

236240
test-showcase-patternhub:
237241
uses: ./.github/workflows/02-e2e-patternhub.yml
@@ -273,68 +277,33 @@ jobs:
273277
# This job runs only if aria-snapshots were changed compared to main or if it runs on main branch
274278
test-screen-reader:
275279
if: |
276-
needs.test-showcase-react.outputs.aria-snapshots-changed-to-main == 'true' ||
280+
needs.get-playwright-version.outputs.test-ally == 'true' ||
277281
github.event.pull_request == null
278282
uses: ./.github/workflows/02-e2e-screen-reader.yml
279283
needs: [test-showcase-react, init-playwright, get-playwright-version]
280284
with:
281285
version: ${{ needs.get-playwright-version.outputs.version }}
282286

283-
should-regenerate-snapshots:
284-
env:
285-
ARIA_ANGULAR: ${{ needs.test-showcase-angular.outputs.aria-snapshots-changed }}
286-
VISUAL_ANGULAR: ${{ needs.test-showcase-angular.outputs.visual-snapshots-changed }}
287-
ARIA_REACT: ${{ needs.test-showcase-react.outputs.aria-snapshots-changed }}
288-
VISUAL_REACT: ${{ needs.test-showcase-react.outputs.visual-snapshots-changed }}
289-
ARIA_VUE: ${{ needs.test-showcase-vue.outputs.aria-snapshots-changed }}
290-
VISUAL_VUE: ${{ needs.test-showcase-vue.outputs.visual-snapshots-changed }}
291-
ARIA_STENCIL: ${{ needs.test-showcase-stencil.outputs.aria-snapshots-changed }}
292-
VISUAL_STENCIL: ${{ needs.test-showcase-stencil.outputs.visual-snapshots-changed }}
287+
regenerate-snapshots:
293288
if: |
294-
!cancelled() && (
289+
!cancelled() && !contains(github.actor,'[bot]') && (
295290
needs.test-showcase-angular.result == 'failure' ||
296291
needs.test-showcase-react.result == 'failure' ||
297292
needs.test-showcase-vue.result == 'failure' ||
298-
needs.test-showcase-angular.outputs.aria-snapshots-changed == 'true' ||
299-
needs.test-showcase-angular.outputs.visual-snapshots-changed == 'true' ||
300-
needs.test-showcase-react.outputs.aria-snapshots-changed == 'true' ||
301-
needs.test-showcase-react.outputs.visual-snapshots-changed == 'true' ||
302-
needs.test-showcase-vue.outputs.aria-snapshots-changed == 'true' ||
303-
needs.test-showcase-vue.outputs.visual-snapshots-changed == 'true' ||
304-
needs.test-showcase-stencil.outputs.aria-snapshots-changed == 'true' ||
305-
needs.test-showcase-stencil.outputs.visual-snapshots-changed == 'true'
293+
needs.test-showcase-stencil.result == 'failure'
306294
)
295+
uses: ./.github/workflows/02-e2e-regenerate.yml
296+
with:
297+
version: ${{ needs.get-playwright-version.outputs.version }}
298+
type: showcases
307299
needs:
308300
[
309301
test-showcase-angular,
310302
test-showcase-react,
311303
test-showcase-vue,
312-
test-showcase-stencil
304+
test-showcase-stencil,
305+
get-playwright-version
313306
]
314-
runs-on: ubuntu-24.04
315-
steps:
316-
- name: "Fail if actor is a bot and regeneration is triggered"
317-
run: |
318-
if [[ "${{ github.actor }}" == *"[bot]"* ]]; then
319-
echo "The snapshots between frameworks are different." >> $GITHUB_STEP_SUMMARY
320-
echo "| Framework | Aria Snapshots Changed | Visual Snapshots Changed |" >> $GITHUB_STEP_SUMMARY
321-
echo "|-----------|------------------------|--------------------------|" >> $GITHUB_STEP_SUMMARY
322-
echo "| Angular | "$ARIA_ANGULAR" | "$VISUAL_ANGULAR" |" >> $GITHUB_STEP_SUMMARY
323-
echo "| React | "$ARIA_REACT" | "$VISUAL_REACT" |" >> $GITHUB_STEP_SUMMARY
324-
echo "| Vue | "$ARIA_VUE" | "$VISUAL_VUE" |" >> $GITHUB_STEP_SUMMARY
325-
echo "| Stencil | "$ARIA_STENCIL" | "$VISUAL_STENCIL" |" >> $GITHUB_STEP_SUMMARY
326-
exit 1
327-
fi
328-
shell: bash
329-
330-
regenerate-snapshots:
331-
if: |
332-
!cancelled() && needs.should-regenerate-snapshots.result == 'success'
333-
uses: ./.github/workflows/02-e2e-regenerate.yml
334-
with:
335-
version: ${{ needs.get-playwright-version.outputs.version }}
336-
type: showcases
337-
needs: [should-regenerate-snapshots, get-playwright-version]
338307

339308
commit-regenerated-snapshots:
340309
uses: ./.github/workflows/02-e2e-regenerated-snapshots-commit.yml
249 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
- main:
2+
- heading "DBSwitch" [level=1]
3+
- link "Density"
4+
- switch "functional"
5+
- text: functional
6+
- status
7+
- switch "regular (Default)"
8+
- text: regular (Default)
9+
- status
10+
- switch "expressive"
11+
- text: expressive
12+
- status
13+
- link "Checked"
14+
- switch "(Default) False"
15+
- text: (Default) False
16+
- status
17+
- switch "True" [checked]
18+
- text: "True"
19+
- status
20+
- link "Disabled"
21+
- switch "(Default) False"
22+
- text: (Default) False
23+
- status
24+
- switch "True" [disabled]
25+
- text: "True"
26+
- status
27+
- link "Visual Aid"
28+
- switch "(Default) False + Unchecked"
29+
- text: (Default) False + Unchecked
30+
- status
31+
- switch "(Default) False + Checked" [checked]
32+
- text: (Default) False + Checked
33+
- status
34+
- switch "True + Unchecked"
35+
- text: True + Unchecked
36+
- status
37+
- switch "True + Checked" [checked]
38+
- text: True + Checked
39+
- status
40+
- link "Size"
41+
- switch "(Default) Medium"
42+
- text: (Default) Medium
43+
- status
44+
- switch "Small"
45+
- text: Small
46+
- status
47+
- link "Variant"
48+
- switch "(Default) Trailing"
49+
- text: (Default) Trailing
50+
- status
51+
- switch "Leading"
52+
- text: Leading
53+
- status
54+
- link "Show Label"
55+
- switch "(Default) True"
56+
- text: (Default) True
57+
- status
58+
- switch "False"
59+
- text: "False"
60+
- status
61+
- text: "False"
62+
- link "Required"
63+
- switch "(Default) False"
64+
- text: (Default) False
65+
- status
66+
- switch "True"
67+
- text: "True"
68+
- status
69+
- link "Show Required Asterisk"
70+
- switch "(Default) True"
71+
- text: (Default) True
72+
- status
73+
- switch "False"
74+
- text: "False"
75+
- status
76+
- link "Validation"
77+
- switch "(Default) No validation"
78+
- text: (Default) No validation
79+
- status
80+
- switch "Invalid"
81+
- text: Invalid Invalid Message
82+
- status
83+
- switch "Valid" [checked]
84+
- text: Valid Valid message
85+
- status
86+
- link "Show Message"
87+
- switch "(Default) False"
88+
- text: (Default) False
89+
- status
90+
- switch "True"
91+
- text: True Message
92+
- status
93+
- link "Examples"
94+
- switch "Custom Icons"
95+
- text: Custom Icons
96+
- status
97+
- switch "Required + Visual Aid"
98+
- text: Required + Visual Aid
99+
- status
162 Bytes
Loading

0 commit comments

Comments
 (0)