AGENT SKILL

visual-testing

Visual verification - screenshots, visual regression, UI bug detection via Playwright. See vision-analyze for LLM.

License 许可
Apache-2.0
最近更新
2026-11-10
Stars
★ 0
Forks
0

01 前言 Front Matter

name
visual-testing
triggers
screenshot, visual diff, visual bug, regression test, VRT, UI broken, text overflow, layout shift, responsive test, visual regression
changelog
docs/ciclos/cycle28-20260815.md
description
Visual verification - screenshots, visual regression, UI bug detection via Playwright. See vision-analyze for LLM.
token_budget
3016

03 SKILL.md 正文

When to Use

Visual verification — screenshots, visual regression, UI bug detection. Tool: Playwright — npx playwright test --project=chromium.

Differentiation

visual-testing = screenshots/visual regression via Playwright (toHaveScreenshot) — NOT LLM analysis. Semantic/feel review → vision-analyze (Ollama).

Automated

test('home',async({page})=>{await page.goto('/');await expect(page).toHaveScreenshot('home.png')});
[{name:'mobile',w:375,h:667},{name:'tablet',w:768,h:1024},{name:'desktop',w:1440,h:900}]
  .forEach(vp=>{test('home '+vp.name,async({page})=>{await page.setViewportSize({w:vp.w,h:vp.h});
  await page.goto('/');await expect(page).toHaveScreenshot('home-'+vp.name+'.png')})});

Baseline

npx playwright test --update-snapshots (create/update). Store in tests/*-snapshots/. Commit.

Decision Tree

Visual bug?→playwright open→screenshot→fix→verify | CI regression?→toHaveScreenshot→baseline | Responsive?→multi-viewport(375/768/1024/1440) | Dynamic?→mask/freeze | Font?→mask/fallback

Bugs

Text overflow:screenshot diff | Alignment:pixel | Z-index:element | Responsive:multi-vp | Color contrast:a11y | Missing states:hover/focus/disabled

Output

VRT:<spec>—<date> RESULT:<pass|fail> DIFF:<pixel-ratio> BASELINE:<match|updated> VIEWPORTS:[375/768/1024/1440]

Anti-Patterns

No baseline·Threshold too strict(flaky)·No viewport reset·Skip anim freeze·No CI artifacts·Ignore theme·Mask nothing dynamic·Increase threshold instead of fix

Anti-Rationalization

Rationalization Red Flag Verification
"Regression visual sin baseline aprobado" Snapshots sin baseline commit npx playwright test --update-snapshots + commit tests/*-snapshots/ + diff check
"Screenshot manual en vez de Playwright" Captura manual sin diff automático expect(page).toHaveScreenshot() + multi-viewport 375/768/1024/1440
"Threshold alto evita flakes" threshold:0.5 sin mask Freeze anim, mask dynamic, threshold ≤0.05 + CI artifacts

Red Flags

  • Doing work without checking output format → STOP, re-read skill
  • Second occurrence of same rationalization → force RED zone

Verification

  • Output matches ## Output contract + file:line; cross-ref-check.ps1 → OK
  • Frontmatter (name/description/triggers/token_budget) stable; cross-refs exist; no listed anti-patterns

Cross-Refs: quality-gate | performance | baseline-ui | accessibility | ui-engine | vision-analyze

docs/skills/visual-testing/reference.md

04 同仓库更多 Skills