Argent Screenshot Diff

作者 software-mansioncb0f538ad083无许可证收录于 2026年10月8日更新于 2026年10月8日

Compare saved or live app screenshots with the argent screenshot-diff tool. Use when testing visual regressions, before/after UI comparisons, screenshot diff checks, visible layout, spacing, color, typography, clipping, overflow, text rendering, or image/icon rendering changes.

AI 生成的概览

使用 argent screenshot-diff 工具比较已保存或实时的应用截图,以发现像素级可见的界面变化。

功能
指导智能体使用 argent screenshot-diff 工具,将基准截图与当前截图进行比较,截图可来自已保存的 PNG 文件或设备实时捕获。内容涵盖截图规则、参数组合以及先基准后对比的确定性流程,并产出差异摘要和产物路径,用于视觉回归检查。该技能定位为辅助性视觉证据,不能替代人工目视检查或结构性检查。
适用场景
适用于明确的 UI 或视觉回归测试、截图差异比对请求,以及预期结果为像素级可见的前后视觉对比,例如布局、间距、颜色、字体排版、裁剪、溢出或图像渲染变化。当结果更适合通过结构性方式验证,或动态内容和缺失基准会使对比产生噪声时,则不适合使用。
运行要求
需要 argent screenshot-diff 工具和截图能力、目标设备 UDID(支持实体 iPhone)以及输出目录;基于文件的对比还需要已保存的基准和当前 PNG 文件。该技能不附带脚本。

1. Role

Use screenshot-diff as supporting visual evidence for UI QA and visual regression checks. It highlights pixel-visible change or stability; it does not replace visual inspection, accessibility/component-tree state, frame/attribute checks, logs, network evidence, or app behavior.

Do not use screenshot diffing for tap-coordinate discovery. Use describe, debugger-component-tree, or native-describe-screen to find targets first.

screenshot-diff supports physical iPhones (kind "device") for both saved-file diffs and live captures. A live capture on hardware goes through the on-device runner at full resolution, is device-wide, and needs no registered app. Keep baselines per device model and resolution, and note that the rotation parameter is ignored on hardware: the capture follows the device's real orientation.

2. When To Use

Use screenshot-diff when pixel comparison can answer the verification question:

  • Required for explicit "UI regression test", "visual regression test", "screenshot diff", "compare screenshots", or "before/after visual comparison" requests, unless stable comparable screenshots cannot be produced.
  • Good fit when the affected screen has stable before/after states and the expected result is pixel-visible: layout, position, size, spacing, color, typography, image/icon rendering, clipping, overflow, or text rendering.
  • Good fit when the risk is unintended visual regression outside the exact element changed.
  • Poor fit when the result is better verified structurally: state changes, navigation existence, accessibility tree contents, console/network behavior, or unit tests.
  • Poor fit when dynamic content, unpausable animation, timestamps, ads, random data, or missing baseline/current screenshots would make the comparison noisy or meaningless.

3. Capture Rules

Use normal downscaled screenshot calls for UI context and state checks. Use full-resolution screenshots only when saving baseline/current PNG files for visual regression comparison. Suppress the image block so the full-size PNG is not loaded into context:

json
{ "udid": "<UDID>", "scale": 1.0, "includeImageInContext": false }

Capture the stable baseline before the relevant interaction or before editing whenever feasible. Compare it to the post-change or post-interaction screen after the app reloads, rebuilds, or reaches the state under test.

4. Parameters

Provide udid and exactly one input for the baseline side and exactly one input for the current side:

  • Common UI regression flow: saved baseline plus live current -> baselinePath, captureCurrent: true, udid, outputDir.
  • Both screenshots already saved -> baselinePath, currentPath, udid, outputDir.
  • Rare fixture flow: live baseline plus saved current -> captureBaseline: true, currentPath, udid, outputDir.
  • Do not combine captureBaseline: true with captureCurrent: true, or provide both a path and live capture flag for the same side.

5. Deterministic Flow

  1. Navigate to the known-good state.
  2. Capture a baseline PNG with screenshot using scale: 1.0 and includeImageInContext: false; keep the returned path.
  3. Perform the interaction, apply the code change and navigate to the state under test.
  4. Call screenshot-diff with the saved baselinePath, captureCurrent: true, udid, and outputDir.
  5. Inspect the summary and artifact paths, then combine the diff with normal visual inspection and any structural/runtime evidence needed for the assertion.
json
{  "baselinePath": "/tmp/baseline.png",  "captureCurrent": true,  "udid": "<UDID>",  "outputDir": "/tmp/argent-diff"}

If both images are already saved, use file paths for both sides:

json
{  "baselinePath": "/tmp/baseline.png",  "currentPath": "/tmp/current.png",  "udid": "<UDID>",  "outputDir": "/tmp/argent-diff"}

来源与署名

来源:software-mansion/argent位于packages/skills/skills/argent-screenshot-diff提交cb0f538

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架