🌐 Web Visual & Behavioral Testing
Priority: P1 (HIGH)
[!IMPORTANT] Tier 2 (Methodology): Strategy web UI/UX audit. Tier 3 (Domain): Responsive, A11y (WCAG), Browser Engine quirk.
🧪 Testing Mindset (Comparative Audit)
Visual test best as Comparative Audit loop:
- Baseline (Before): Capture
snapshot --aria+screenshotprod/main. - Implementation (After): Capture same local/feature.
- Audit: Compare state for regression, CLS, Aria drift.
Responses must label the two captures as Before and After (or Baseline and Fixed) and include the diff and neighboring-element side-effect check.
📋 Scenario Matrix
| Change Type | Scenarios to Run |
|---|---|
| CSS/Layout | Responsive Audit + Hover + CLS Check |
| Forms/Input | Validation Msg + Focus State + Error Boundary |
| Navigation | URL Sync + Sticky Header + Back-Button Persistence |
| Assets/Fonts | Lazy Load + Icon Check + LCP Audit |
| Accessibility | Tab Order + Aria-Snapshot + Color Contrast |
🚫 Anti-Patterns
- Single-Viewport: Never verify Desktop only. Check Mobile (375px) + Tablet (768px).
- Ignore Layout Shift: Check loading state (skeleton) → no page jump.
- Unmasked Dynamic: MUST mask timestamp/balance via
--maskor JS (opacity: 0). Avoid "False Regression". - Blind Assertion: Use
playwright-cli snapshot --aria(CLI) orbrowser_snapshot(Playwright MCP) verify state before done.
📁 Evidence
Before/After pairs live in .playwright-cli/<session>/ as <AC|step>-before.png / <AC|step>-after.png plus matching .aria.txt. Driver rung and dir go in the walkthrough driver: / evidence_dir: lines.
- External Dependency: Mock/bypass 3rd-party (Chat, Analytics) → prevent flakiness.
🔗 References
- playwright-cli: playwright-cli
- Driver Ladder: driver-ladder — CLI first, Playwright MCP fallback, BLOCKED rule.
- Diagnostic Decoder: diagnostic-decoder
- DOM vs Screenshot: dom-snapshot-vs-screenshot
- Login & Data: login-and-test-data
- Scenario Details: scenarios