From aj-geddes-useful-ai-prompts-4
Detects unintended visual changes in UI by comparing screenshots across versions using Playwright, Percy, Chromatic, Cypress. Useful for CSS bugs, responsive design, browser testing, and PR reviews.
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4This skill uses the workspace's default tool permissions.
- [Overview](#overview)
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Visual regression testing captures screenshots of UI components and pages, then compares them across versions to detect unintended visual changes. This automated approach catches CSS bugs, layout issues, and design regressions that traditional functional tests miss.
Minimal working example:
// tests/visual/homepage.spec.ts
import { test, expect } from "@playwright/test";
test.describe("Homepage Visual Tests", () => {
test("homepage matches baseline", async ({ page }) => {
await page.goto("/");
// Wait for images to load
await page.waitForLoadState("networkidle");
// Full page screenshot
await expect(page).toHaveScreenshot("homepage-full.png", {
fullPage: true,
maxDiffPixels: 100, // Allow small differences
});
});
test("responsive design - mobile", async ({ page }) => {
await page.setViewportSize({ width: 375, height: 667 }); // iPhone SE
await page.goto("/");
await expect(page).toHaveScreenshot("homepage-mobile.png");
});
test("responsive design - tablet", async ({ page }) => {
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Playwright Visual Testing | Playwright Visual Testing |
| Percy Visual Testing | Percy Visual Testing |
| Chromatic for Storybook | Chromatic for Storybook |
| Cypress Visual Testing | Cypress Visual Testing |
| BackstopJS Configuration | BackstopJS Configuration |
| Handling Dynamic Content | Handling Dynamic Content |
| Testing Responsive Components | Testing Responsive Components |