22
33These tests make use of Playwright, with a setup very similar to that of the e2e tests.
44
5+ ## Prerequisites
6+
7+ - Node.js >= 20.10.0
8+ - A running WordPress environment (` npm run env:start ` )
9+ - Playwright browsers installed (` npx playwright install chromium ` )
10+
511## How to Run the Tests Locally
612
713From a feature branch with a clean working tree, run:
@@ -14,8 +20,27 @@ This will automatically:
14201 . Check out trunk to generate baseline snapshots.
15212 . Return to your feature branch.
16223 . Compare the current branch against those baselines.
23+ 4 . Print a visual impact summary in the terminal.
24+ 5 . Open the HTML report with side-by-side visual diffs.
25+
26+ ### Quick Re-run (Skip Baseline Generation)
1727
18- If any tests fail, diff images can be found in ` artifacts/ ` .
28+ After the first run, baselines from trunk are already saved. To re-compare without regenerating them:
29+
30+ ``` bash
31+ npm run test:visual:quick
32+ ```
33+
34+ This is useful when iterating on CSS — no need to commit changes or wait for trunk baselines to regenerate each time.
35+
36+ ** Typical workflow:**
37+ ``` bash
38+ npm run test:visual # First run: generates baselines from trunk
39+ # ... tweak CSS ...
40+ npm run test:visual:quick # Fast: reuses existing baselines
41+ # ... tweak more CSS ...
42+ npm run test:visual:quick # Fast again
43+ ```
1944
2045### Specifying a Base Branch
2146
@@ -33,3 +58,24 @@ You can also generate baselines and compare manually:
33582 . Run ` npx playwright test --config tests/visual-regression/playwright.config.js --update-snapshots `
34593 . Check out the feature branch to be tested.
35604 . Run ` npx playwright test --config tests/visual-regression/playwright.config.js `
61+
62+ ## Impact Summary
63+
64+ After each run, a summary is printed to the terminal showing which pages changed and which remained unchanged:
65+
66+ ```
67+ ────────────────────────────────────────────────
68+ Visual Impact Summary
69+ ────────────────────────────────────────────────
70+ Changed: 27 of 35 pages
71+ Unchanged: 8 of 35 pages
72+
73+ Changed:
74+ Dashboard, All Posts, Categories, Tags, ...
75+
76+ Unchanged:
77+ Login, Media Settings, ...
78+ ────────────────────────────────────────────────
79+ ```
80+
81+ The HTML report also opens automatically with side-by-side visual diffs for detailed inspection.
0 commit comments