Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
visual-test: Move Puppeteer alignment tips into the skill.
Evy Kassirerdeb7312271b4
diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.mdindex 100ba5068b0..a1ade433af1 100644--- a/.claude/CLAUDE.md+++ b/.claude/CLAUDE.md@@ -388,33 +388,6 @@ before the change is ready.- Think about edge cases in data: empty lists, very long names, singleitems vs. hundreds, special characters in strings.-### Puppeteer Visual Tests: Verifying Alignment--When using Puppeteer to verify visual alignment, do not rely on-eyeballing screenshots — especially small full-page ones. Instead:--- Use `page.evaluate()` with `getBoundingClientRect()` to measure- actual pixel positions of the elements you need aligned, and print- them to the console. Compare the numbers.-- Always take **both** a full-page screenshot and a zoomed clip of- the area of interest.-- For zoomed clips, calculate the clip region from non-fixed elements;- fixed/sticky elements may report bounding-box positions that don't- match their visual location on the page.-- Be aware that CSS nesting can scope styles to a specific parent- (e.g., `.parent .my-class`) — reusing the same class name in a- different context may not pick up the expected styles.-- To verify keyboard-focus styles, use real keyboard navigation- (`page.keyboard.press`); programmatic `.focus()` doesn't reliably- trigger `:focus-visible` and may be overridden by view-level focus- management.-- Focus rings drawn as `::before` / `::after` pseudo-elements aren't- visible in `getComputedStyle` of the focused element — verify them- in a screenshot, not via computed styles.-- For visual changes, produce before/after screenshot pairs by writing- one test and running it twice with a `SCREENSHOT_SUFFIX` env var- (`-old` on `main`, `-updated` on your branch).-## Self-Review ChecklistBefore finalizing, verify:diff --git a/.claude/skills/visual-test/SKILL.md b/.claude/skills/visual-test/SKILL.mdindex cae6d447b15..c510b642354 100644--- a/.claude/skills/visual-test/SKILL.md+++ b/.claude/skills/visual-test/SKILL.md@@ -242,6 +242,33 @@ console.log(`\n${results.length - failures.length}/${results.length} tests passeThis keeps the test running through failures so you see all results,unlike `assert` which aborts on the first failure.+#### Verifying alignment++When using Puppeteer to verify visual alignment, do not rely on+eyeballing screenshots — especially small full-page ones. Instead:++- Use `page.evaluate()` with `getBoundingClientRect()` to measure+ actual pixel positions of the elements you need aligned, and print+ them to the console. Compare the numbers.+- Always take **both** a full-page screenshot and a zoomed clip of+ the area of interest.+- For zoomed clips, calculate the clip region from non-fixed elements;+ fixed/sticky elements may report bounding-box positions that don't+ match their visual location on the page.+- Be aware that CSS nesting can scope styles to a specific parent+ (e.g., `.parent .my-class`) — reusing the same class name in a+ different context may not pick up the expected styles.+- To verify keyboard-focus styles, use real keyboard navigation+ (`page.keyboard.press`); programmatic `.focus()` doesn't reliably+ trigger `:focus-visible` and may be overridden by view-level focus+ management.+- Focus rings drawn as `::before` / `::after` pseudo-elements aren't+ visible in `getComputedStyle` of the focused element — verify them+ in a screenshot, not via computed styles.+- For visual changes, produce before/after screenshot pairs by writing+ one test and running it twice with a `SCREENSHOT_SUFFIX` env var+ (`-old` on `main`, `-updated` on your branch).+### 2. Run the test```bash