Loading...
Loading...
[INTERNAL TEMPLATE] Visual evidence capture and regression testing protocol. Called by agent-browser orchestrator.
npx skill4agent add owenleezy/agent-browser-skill agent-browser-visualInternal template. Entry point:skill.agent-browser
NEVER compare screenshots before `wait --load networkidle` — animation frames cause false diffs
NEVER use default diff threshold for pixel-perfect checks — set --threshold 0.05 or lower
NEVER skip baseline update after intentional UI changes — stale baseline = false positives forever
NEVER start `network har start` after navigation — HAR must begin before the requests you want to capture
NEVER start `record start` before opening the page — start after `open` + `wait` to preserve auth state| Goal | Command |
|---|---|
| Catch visual regression (before/after deploy) | |
| Compare staging vs production side by side | |
| Detect DOM structure changes | |
| Create shareable demo / bug report video | |
| Annotated screenshot for docs / ticket | |
| Capture full network trace for perf/debug | |
# Step 1: Capture baseline (run once before changes)
agent-browser open <url>
agent-browser wait --load networkidle
agent-browser screenshot --full baseline.png
# Step 2: After changes, compare
agent-browser open <url>
agent-browser wait --load networkidle
agent-browser diff screenshot --baseline baseline.png --output diff.png --threshold 0.1
# Step 3: Scope to specific element (reduces noise from unrelated areas)
agent-browser diff screenshot --baseline baseline.png -s "#main-content"
# Step 4: Compare two environments (snapshot + optionally screenshots)
agent-browser diff url https://staging.example.com https://prod.example.com
agent-browser diff url https://staging.example.com https://prod.example.com --screenshot --full0.10.050.010.2# Best practice: open page first, then start recording (preserves auth state)
agent-browser open <url>
agent-browser wait --load networkidle
agent-browser snapshot -i # explore first, plan your actions
agent-browser record start ./demo.webm
# ... perform actions ...
agent-browser record stop
# Record from a fresh URL
agent-browser record start ./onboarding.webm https://app.example.com/signup
# Restart (stop current recording, start new — useful for retakes)
agent-browser record restart ./take2.webmTo convert WebM → GIF:ffmpeg -i demo.webm -vf "fps=10,scale=800:-1:flags=lanczos" demo.gif
agent-browser screenshot --annotate step1.png# Must start BEFORE navigation to capture all requests
agent-browser network har start ./trace.har
agent-browser open <url>
agent-browser wait --load networkidle
# ... perform actions you want to trace ...
agent-browser network har stop
# View: open in browser DevTools → Network tab → Import HAR
# Or: https://har.tech (online analyzer)# Compare current DOM vs last snapshot in this session
agent-browser diff snapshot
# Compare against a saved snapshot file
agent-browser diff snapshot --baseline before.txt
# Scope to a specific section
agent-browser diff snapshot -s ".sidebar" -c
# Combined: compact + depth-limited scope
agent-browser diff snapshot -s "#app" -c -d 4| Failure | Recovery |
|---|---|
| Diff always shows changes (animation/loading) | |
| Diff too sensitive (antialiasing noise) | Increase |
| Diff misses real regression | Decrease |
| Video file too large | Scope recording to shorter flow; use |
| HAR missing early requests | Restart: |
| Always |
| Mistake | Fix |
|---|---|
| Screenshot before page is stable | |
| Baseline not updated after intentional design change | Delete old baseline, re-capture: |
| |
| HAR started after XHR calls already fired | |
| Open page + wait first, then start recording |