Loading...
Loading...
Runs Visual Regression Testing (VRT) locally to prevent disqualification in Web Speed Hackathon. Captures screenshots, compares against baselines, updates snapshots, and validates visual integrity after performance optimizations. Use when optimizing WSH apps, running VRT checks, updating VRT baselines, or investigating VRT failures.
npx skill4agent add mazrean/agent-skills checking-wsh-vrt# 1. Install dependencies (first time only)
npx playwright install --with-deps chromium
# 2. Start the app
npm run build && npm run start &
# 3. Run VRT
npx playwright test --project=vrt
# 4. If tests fail, review diffs
npx playwright show-reportdocs/regulation.md# Build and start (ensure latest changes are reflected)
npm run build && npm run start &
# Wait for server to be ready, then run VRT
npx playwright test --project=vrtnpx playwright show-report# Revert to last known-good commit
git stash # or git checkout -- .# Update baseline snapshots
npx playwright test --project=vrt --update-snapshots
# Verify the new baselines look correct
npx playwright show-report
# Commit updated baselines
git add -A '*.png'
git commit -m "update VRT baselines: <reason>"--update-snapshotsdocs/regulation.mdplaywright.config.ts| Optimization | VRT Risk | Mitigation |
|---|---|---|
| Image format conversion (AVIF/WebP) | Color shift, quality loss | Compare carefully, adjust quality parameter |
| Font subsetting | Missing glyphs | Verify all characters used on scored pages |
| CSS-in-JS removal | Style differences | Pixel-level comparison in report |
| Lazy loading images | Images not loaded in screenshot | Ensure scroll/wait in test or disable lazy for VRT |
| CLS fixes (dimensions) | Layout shift (intentional) | Update baselines after confirming improvement |
| SSR implementation | Hydration mismatch visible | Check for flicker or unstyled content |
| Library replacement | Rendering differences | Carefully compare component output |
// Expected in playwright.config.ts
{
project: {
name: 'vrt',
testMatch: /.*\.vrt\.ts/, // or similar pattern
use: {
// Consistent viewport for reproducible screenshots
viewport: { width: 1440, height: 900 },
// Animations disabled for deterministic captures
// Check regulation for required settings
}
}
}docs/regulation.md