Skip to content

Commit f7d3b31

Browse files
authored
Playwright failed test screenshots in all browsers (#999)
1 parent 9853db7 commit f7d3b31

File tree

38 files changed

+12
-5
lines changed

38 files changed

+12
-5
lines changed

.github/workflows/playwright.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,16 @@ jobs:
134134
run: yarn playwright test --shard ${{ matrix.shard }}
135135

136136
# Screenshots
137+
- name: Collect failed tests
138+
if: (failure() || inputs.update_all_screenshots)
139+
run: yarn playwright test --last-failed --list --pass-with-no-tests > failed-tests.txt
140+
137141
- name: Update screenshots
138142
if: failure() && matrix.screenshots == true && github.event_name != 'schedule' && !(github.event_name == 'push' && (github.ref_name == 'master' || endsWith(github.ref_name, '.x')))
139-
run: yarn playwright test --update-snapshots --last-failed --reporter=list
143+
run: |
144+
while read -r test_name; do
145+
yarn playwright test "$test_name" --update-snapshots --reporter=list
146+
done < <(awk -F ' › ' 'NF>1{print $2}' failed-tests.txt | sort -u)
140147
141148
- name: Update all screenshots
142149
if: ${{ inputs.update_all_screenshots && matrix.screenshots == true }}

tests/playwright/checkout.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AccountPage } from './pages/AccountPage'
66
const checkoutTypes = ['default', 'onestep']
77

88
checkoutTypes.forEach((type) => {
9-
test(type + '- as guest', async ({ page }) => {
9+
test(type + ' - as guest', async ({ page }) => {
1010
const productPage = new ProductPage(page)
1111
const checkoutPage = new CheckoutPage(page, type)
1212

tests/playwright/checkout.spec.js-snapshots/default--as-guest-1-Mobile-Chrome-linux.png renamed to tests/playwright/checkout.spec.js-snapshots/default---as-guest-1-Mobile-Chrome-linux.png

File renamed without changes.

tests/playwright/checkout.spec.js-snapshots/default--as-guest-1-Mobile-Safari-linux.png renamed to tests/playwright/checkout.spec.js-snapshots/default---as-guest-1-Mobile-Safari-linux.png

File renamed without changes.

tests/playwright/checkout.spec.js-snapshots/default--as-guest-1-chromium-linux.png renamed to tests/playwright/checkout.spec.js-snapshots/default---as-guest-1-chromium-linux.png

File renamed without changes.

tests/playwright/checkout.spec.js-snapshots/default--as-guest-1-firefox-linux.png renamed to tests/playwright/checkout.spec.js-snapshots/default---as-guest-1-firefox-linux.png

File renamed without changes.

tests/playwright/checkout.spec.js-snapshots/default--as-guest-1-webkit-linux.png renamed to tests/playwright/checkout.spec.js-snapshots/default---as-guest-1-webkit-linux.png

File renamed without changes.

tests/playwright/checkout.spec.js-snapshots/default--as-guest-2-Mobile-Chrome-linux.png renamed to tests/playwright/checkout.spec.js-snapshots/default---as-guest-2-Mobile-Chrome-linux.png

File renamed without changes.

tests/playwright/checkout.spec.js-snapshots/default--as-guest-2-Mobile-Safari-linux.png renamed to tests/playwright/checkout.spec.js-snapshots/default---as-guest-2-Mobile-Safari-linux.png

File renamed without changes.

tests/playwright/checkout.spec.js-snapshots/default--as-guest-2-chromium-linux.png renamed to tests/playwright/checkout.spec.js-snapshots/default---as-guest-2-chromium-linux.png

File renamed without changes.

0 commit comments

Comments
 (0)