Skip to content

Commit 69059f2

Browse files
fix: improve stability of double pipeline tests (#5142)
* fix: improve stability of double pipeline tests and enhance snapshot regeneration logic * chore: print snapshot changes * chore: revert logs inside check.ts * test: print changed snapshot variable * fix: issue with snapshot changes * fix: issue with cancel * fix: cancel workflow * fix: default.yml pipeline * auto update snapshots (#5162) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: add more output for failures * fix: remove env. from if statement * auto update snapshots (#5170) 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 9643085 commit 69059f2

File tree

3 files changed

+60
-13
lines changed

3 files changed

+60
-13
lines changed

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

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ jobs:
7777
# We test everything for patternhub and main branch
7878
- name: 👩‍🔬 Test showcase with Playwright 🎭
7979
shell: bash
80-
# TODO: we need to find a more stable solution / https://github.com/db-ux-design-system/core-web/issues/4910
81-
# if: github.event.pull_request == null
80+
if: github.event.pull_request == null
8281
env:
8382
NEXT_PUBLIC_BASE_PATH: ${{ inputs.path }}
8483
run: |
@@ -92,9 +91,13 @@ jobs:
9291
run: |
9392
npm run test:aria-snapshots --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --update-snapshots
9493
OUTPUT=$(npx --no tsx scripts/github/snapshot-changes/check-aria.ts)
95-
echo "aria-snapshots-changed=$OUTPUT" >> $GITHUB_OUTPUT
94+
if [ "$OUTPUT" = "true" ]; then
95+
echo "aria-snapshots-changed=$OUTPUT" >> $GITHUB_OUTPUT
96+
fi
9697
OUTPUT=$(npx --no tsx scripts/github/snapshot-changes/check-main-aria.ts)
97-
echo "aria-snapshots-changed-to-main=$OUTPUT" >> $GITHUB_OUTPUT
98+
if [ "$OUTPUT" = "true" ]; then
99+
echo "aria-snapshots-changed-to-main=$OUTPUT" >> $GITHUB_OUTPUT
100+
fi
98101
99102
- name: 👩‍🔬 Test axe-core with Playwright 🎭
100103
shell: bash
@@ -109,16 +112,29 @@ jobs:
109112
run: |
110113
npm run test:visual-snapshots --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --update-snapshots
111114
OUTPUT=$(npx --no tsx scripts/github/snapshot-changes/check-visual.ts)
112-
echo "visual-snapshots-changed=$OUTPUT" >> $GITHUB_OUTPUT
115+
if [ "$OUTPUT" = "true" ]; then
116+
echo "visual-snapshots-changed=$OUTPUT" >> $GITHUB_OUTPUT
117+
fi
113118
114119
- name: 👩‍🔬 Test a11y-checker with Playwright 🎭
115120
shell: bash
116121
if: |
117122
github.event.pull_request != null &&
118-
steps.aria-snapshots.outputs.aria-snapshots-changed-to-main=='true'
123+
steps.aria-snapshots.outputs.aria-snapshots-changed-to-main == 'true'
119124
run: |
120125
npm run test:a11y-checker --workspace=${{ inputs.showcase }} -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
121126
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+
122138
- name: 🔣 Print GitHub Report
123139
if: failure()
124140
shell: bash

.github/workflows/default.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,16 @@ jobs:
272272
with:
273273
version: ${{ needs.get-playwright-version.outputs.version }}
274274

275-
regenerate-snapshots:
275+
should-regenerate-snapshots:
276+
env:
277+
ARIA_ANGULAR: ${{ needs.test-showcase-angular.outputs.aria-snapshots-changed }}
278+
VISUAL_ANGULAR: ${{ needs.test-showcase-angular.outputs.visual-snapshots-changed }}
279+
ARIA_REACT: ${{ needs.test-showcase-react.outputs.aria-snapshots-changed }}
280+
VISUAL_REACT: ${{ needs.test-showcase-react.outputs.visual-snapshots-changed }}
281+
ARIA_VUE: ${{ needs.test-showcase-vue.outputs.aria-snapshots-changed }}
282+
VISUAL_VUE: ${{ needs.test-showcase-vue.outputs.visual-snapshots-changed }}
283+
ARIA_STENCIL: ${{ needs.test-showcase-stencil.outputs.aria-snapshots-changed }}
284+
VISUAL_STENCIL: ${{ needs.test-showcase-stencil.outputs.visual-snapshots-changed }}
276285
if: |
277286
!cancelled() && (
278287
needs.test-showcase-angular.result == 'failure' ||
@@ -283,19 +292,41 @@ jobs:
283292
needs.test-showcase-react.outputs.aria-snapshots-changed == 'true' ||
284293
needs.test-showcase-react.outputs.visual-snapshots-changed == 'true' ||
285294
needs.test-showcase-vue.outputs.aria-snapshots-changed == 'true' ||
286-
needs.test-showcase-vue.outputs.visual-snapshots-changed == 'true'
295+
needs.test-showcase-vue.outputs.visual-snapshots-changed == 'true' ||
296+
needs.test-showcase-stencil.outputs.aria-snapshots-changed == 'true' ||
297+
needs.test-showcase-stencil.outputs.visual-snapshots-changed == 'true'
287298
)
288-
uses: ./.github/workflows/02-e2e-regenerate.yml
289-
with:
290-
version: ${{ needs.get-playwright-version.outputs.version }}
291-
type: showcases
292299
needs:
293300
[
294301
test-showcase-angular,
295302
test-showcase-react,
296303
test-showcase-vue,
297-
get-playwright-version
304+
test-showcase-stencil
298305
]
306+
runs-on: ubuntu-24.04
307+
steps:
308+
- name: "Fail if actor is a bot and regeneration is triggered"
309+
run: |
310+
if [[ "${{ github.actor }}" == *"[bot]"* ]]; then
311+
echo "The snapshots between frameworks are different." >> $GITHUB_STEP_SUMMARY
312+
echo "| Framework | Aria Snapshots Changed | Visual Snapshots Changed |" >> $GITHUB_STEP_SUMMARY
313+
echo "|-----------|------------------------|--------------------------|" >> $GITHUB_STEP_SUMMARY
314+
echo "| Angular | "$ARIA_ANGULAR" | "$VISUAL_ANGULAR" |" >> $GITHUB_STEP_SUMMARY
315+
echo "| React | "$ARIA_REACT" | "$VISUAL_REACT" |" >> $GITHUB_STEP_SUMMARY
316+
echo "| Vue | "$ARIA_VUE" | "$VISUAL_VUE" |" >> $GITHUB_STEP_SUMMARY
317+
echo "| Stencil | "$ARIA_STENCIL" | "$VISUAL_STENCIL" |" >> $GITHUB_STEP_SUMMARY
318+
exit 1
319+
fi
320+
shell: bash
321+
322+
regenerate-snapshots:
323+
if: |
324+
!cancelled() && needs.should-regenerate-snapshots.result == 'success'
325+
uses: ./.github/workflows/02-e2e-regenerate.yml
326+
with:
327+
version: ${{ needs.get-playwright-version.outputs.version }}
328+
type: showcases
329+
needs: [should-regenerate-snapshots, get-playwright-version]
299330

300331
commit-regenerated-snapshots:
301332
uses: ./.github/workflows/02-e2e-regenerated-snapshots-commit.yml
128 KB
Loading

0 commit comments

Comments
 (0)