browser-screenshot-diff
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBrowser Screenshot Diff
Browser Screenshot Diff
Compare two recorded sessions step-by-step. Pairs each step in session A to the same in session B, diffs the captured screenshot and accessibility snapshot, reports the first divergence and an aggregate similarity score.
step-id逐步对比两个录制的会话。将会话A中的每个步骤与会话B中相同的配对,对比捕获的截图和无障碍快照,报告首次差异点以及整体相似度得分。
step-idWhen to use
使用场景
- Visual regression after a UI change (record before, record after, diff).
- Verifying a run matches the parent session within tolerance.
browser-replay - Comparing two A/B variants of the same form flow.
- UI变更后的视觉回归测试(变更前录制、变更后录制、对比)。
- 验证运行结果与母会话在允许误差范围内匹配。
browser-replay - 对比同一表单流程的两个A/B变体。
Steps
操作步骤
- Locate both RVF containers:
bash
npx -y ruvector@0.2.25 rvf status <session-id-a>.rvf npx -y ruvector@0.2.25 rvf status <session-id-b>.rvf - Load both trajectories from . Build a
trajectory.ndjsonmap for each.step-id → (screenshot_path, snapshot_path) - Pair steps by . Steps that exist on only one side are flagged as
step-idand contribute to the divergence score.unmatched - Pixel diff (): compare the two PNGs at each step. Report
--mode pixel|both,mse, and the bounding box of the largest diff cluster. Threshold defaultpsnr(2% of pixels).0.02 - DOM diff (): compare the accessibility snapshots node-by-node. Report added / removed / changed nodes with their accessible names.
--mode dom|both - Aggregate similarity: weighted average across matched steps, weighted by step duration. Verdict goes into a new under a fresh RVF container so the diff itself is replayable.
findings.md - Persist the diff verdict in under both source ids' tags so future searches surface "ran a diff against session X".
browser-sessions
- 定位两个RVF容器:
bash
npx -y ruvector@0.2.25 rvf status <session-id-a>.rvf npx -y ruvector@0.2.25 rvf status <session-id-b>.rvf - 从加载两个轨迹。为每个会话构建
trajectory.ndjson映射表。step-id → (screenshot_path, snapshot_path) - 按配对步骤。仅存在于一侧的步骤会被标记为
step-id(未匹配),并计入差异得分。unmatched - 像素对比():对比每个步骤的两张PNG图片。报告
--mode pixel|both(均方误差)、mse(峰值信噪比)以及最大差异簇的边界框。默认阈值为psnr(2%的像素)。0.02 - DOM对比():逐节点对比无障碍快照。报告新增/移除/修改的节点及其无障碍名称。
--mode dom|both - 整体相似度:对匹配步骤的结果按步骤时长进行加权平均。对比结果会存入新RVF容器下的文件,以便重放对比过程。
findings.md - 持久化存储:将对比结果存入中两个源会话ID的标签下,以便后续搜索时能显示“已与会话X进行对比”。
browser-sessions
Caveats
注意事项
- Pixel diff is sensitive to font hinting, antialiasing, and scrollbar position. Keep viewport pinned across both sessions.
- DOM diff over Playwright's accessibility tree is more stable than HTML diff. Prefer it.
- This skill does not handle dynamic content (clocks, ads); add ignore regions to the field map or pre-process snapshots before diffing.
- The MCP tool is not planned (ADR-0001 §7); the skill operates against locally-saved RVF artifacts and uses
browser_screenshot_diffonly for live verification.browser_eval
- 像素对比对字体微调、抗锯齿和滚动条位置敏感。需在两个会话中固定视口。
- 基于Playwright无障碍树的DOM对比比HTML对比更稳定,建议优先使用。
- 该功能不支持处理动态内容(如时钟、广告);可在字段映射中添加忽略区域,或在对比前预处理快照。
- 目前无计划开发MCP工具(ADR-0001 §7);该功能基于本地保存的RVF工件运行,仅在实时验证时使用
browser_screenshot_diff。browser_eval