Skip to content

Commit eba6387

Browse files
committed
chore: Added updated playwright + screenshots
1 parent 02a00c6 commit eba6387

File tree

6 files changed

+38
-10
lines changed

6 files changed

+38
-10
lines changed

.github/workflows/playwright.yml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,48 @@ jobs:
2828
run: npx playwright install --with-deps
2929
- name: Run Playwright tests
3030
id: test-visual
31-
run: make tests
31+
run: |
32+
make tests | tee output.log
33+
if grep -q -e "Error: A snapshot doesn't exist at" -e "Screenshot comparison failed" output.log; then
34+
echo "Playwright tests failed due to a snapshot issue."
35+
echo "SNAPSHOT_DIFFERENCES=true" >> $GITHUB_ENV
36+
exit 1
37+
elif grep -q "failed" output.log; then
38+
echo "Playwright tests failed due to a non-snapshot issue."
39+
exit 1
40+
fi
3241
- uses: actions/upload-artifact@v4
42+
id: artifact-upload
3343
if: ${{ !cancelled() && failure() && steps.test-visual.conclusion == 'failure' }}
3444
with:
3545
name: playwright-report
3646
path: tests/playwright-report/
3747
retention-days: 3
38-
- uses: actions/upload-artifact@v4
39-
if: ${{ !cancelled() && failure() && steps.test-visual.conclusion == 'failure' }}
48+
- name: Comment on PR with Playwright report
49+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
50+
if: ${{ failure() && env.SNAPSHOT_DIFFERENCES == 'true' }}
4051
with:
41-
name: test-results
42-
path: tests/test-results/
43-
retention-days: 3
52+
script: |
53+
const body = `### <span aria-hidden="true">❌</span> Playwright visual snapshot differences were detected.
54+
55+
View the [Playwright report](${{ steps.artifact-upload.outputs.artifact-url }})
56+
**To approve the snapshot changes and update the snapshots, please comment:** /approve-snapshots`;
57+
58+
await github.rest.issues.createComment({
59+
issue_number: context.issue.number,
60+
owner: context.repo.owner,
61+
repo: context.repo.repo,
62+
body: body,
63+
});
64+
65+
# - name: Update the screenshots based on Ubuntu env on GH
66+
# id: test-visual-update
67+
# if: ${{ failure() && steps.test-visual.conclusion == 'failure' }}
68+
# run: make tests-update-screenshots
69+
# - name: Upload updated Playwright screenshots
70+
# uses: actions/upload-artifact@v4
71+
# if: ${{ failure() && steps.test-visual-update.conclusion == 'success' }}
72+
# with:
73+
# name: playwright-screenshots-updated
74+
# path: tests/src/__screenshots__/**/*.png
75+
# retention-days: 3

tests/playwright.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ export default defineConfig({
1717
timezoneId: 'America/Los_Angeles',
1818
},
1919
projects: [
20-
{
21-
name: 'chromium',
22-
use: { ...devices['Desktop Chrome'] },
23-
},
2420
{
2521
name: 'firefox',
2622
use: { ...devices['Desktop Firefox'] },

0 commit comments

Comments
 (0)