@swmansion/argent 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "MCP server for iOS Simulator and Android Emulator control",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/rules/argent.md CHANGED
@@ -13,6 +13,8 @@ Use cases:
13
13
  - User mentions iOS simulator, Android emulator, device, or app interaction
14
14
  - The app user is working with is a mobile application which can be run in a simulator/emulator
15
15
  - Any tapping, swiping, typing, screenshotting, or inspecting a running app
16
+ - Any code change that affects visible mobile UI, layout, styling, copy, navigation, or screen composition
17
+ - Any request to execute manual QA, UI QA, or visual behavior validation for a mobile app
16
18
  - Running, debugging, or testing a React Native app (iOS or Android)
17
19
  - Profiling performance or diagnosing re-renders in a React Native app (iOS or Android)
18
20
  </description>
@@ -92,7 +94,11 @@ When: Beginning a task that involves the Android emulator, no emulator running y
92
94
 
93
95
  TAPPING, SWIPING, TYPING, GESTURES, SCREENSHOTS, SCROLLING
94
96
  Skill: `argent-device-interact`
95
- When: Performing touch interactions, typing, pressing hardware buttons, launching/restarting apps, opening URLs, rotating device, or taking standalone screenshots.
97
+ When: Performing touch interactions, typing, pressing hardware buttons, launching/restarting apps, opening URLs, rotating device, taking standalone screenshots, or verifying a visible UI code change.
98
+
99
+ SCREENSHOT DIFF & VISUAL REGRESSION
100
+ Skill: `argent-screenshot-diff`
101
+ When: Explicit visual regression, screenshot diff, compare screenshots, before/after visual comparison requests, or visible UI changes where stable pixel comparison would add useful evidence.
96
102
 
97
103
  RUNNING / BUILDING / DEBUGGING REACT NATIVE APP
98
104
  Skill: `argent-react-native-app-workflow`
@@ -116,7 +122,7 @@ When: App feels slow, user asks to optimize, reducing bundle size, improving sta
116
122
 
117
123
  END-TO-END UI TESTING
118
124
  Skill: `argent-test-ui-flow`
119
- When: Verifying complete user flows, running interact → screenshot → verify loops, testing features by using the app.
125
+ When: Verifying complete user flows, running interact → screenshot → verify loops, testing features by using the app, executing manual QA steps, or validating visible UI changes or visual behavior after implementation.
120
126
 
121
127
  RECORDING & REPLAYING FLOWS
122
128
  Use skill: `argent-create-flow`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-device-interact
3
- description: Interact with an iOS simulator or Android emulator using argent MCP tools. Use when tapping UI elements, performing gestures, scrolling, typing text, pressing hardware buttons, launching apps, opening URLs, taking screenshots.
3
+ description: Interact with an iOS simulator or Android emulator using argent MCP tools. Use when tapping UI elements, performing gestures, scrolling/swiping, typing text, pressing hardware buttons, launching apps, opening URLs, taking screenshots, or checking visible app state after interactions.
4
4
  ---
5
5
 
6
6
  ## Unified tool surface
@@ -184,6 +184,7 @@ Values: `Portrait`, `LandscapeLeft`, `LandscapeRight`, `PortraitUpsideDown`
184
184
  Use the explicit `screenshot` tool only when:
185
185
 
186
186
  - You need the initial screen state before any action.
187
+ - You are about to edit visible UI and need a baseline capture before making changes.
187
188
  - The auto-attached screenshot shows a transitional or loading frame.
188
189
  - You require extra context.
189
190
  - You want to check state after a delay (e.g. waiting for a network response).
@@ -198,7 +199,15 @@ When using `screenshot` for permission or native modal navigation:
198
199
 
199
200
  Optional rotation parameter: `{ "udid": "<UDID>", "rotation": "LandscapeLeft" }` — rotates the capture without changing simulator orientation.
200
201
 
201
- Screenshots are downscaled by default (30% of original resolution) to reduce context size. `scale` accepts values from 0.01 to 1.0. If UI elements are hard to read or you need to inspect fine detail, pass `scale: 1.0` to get full resolution: `{ "udid": "<UDID>", "scale": 1.0 }`.
202
+ Screenshots are downscaled by default (30% of original resolution) to reduce context size. Use the normal downscaled screenshot for UI context and state checks. `scale` accepts values from 0.01 to 1.0, but do not use `scale: 1.0` as a general readability or tapping aid.
203
+
204
+ Use full-resolution screenshots only when saving baseline/current PNG files for comparison. In that case, suppress the image block so the full-size PNG is not loaded into agent context:
205
+
206
+ ```json
207
+ { "udid": "<UDID>", "scale": 1.0, "includeImageInContext": false }
208
+ ```
209
+
210
+ For visual regression checks, before/after screenshot comparisons, and detailed `screenshot-diff` parameter guidance, use the `argent-screenshot-diff` skill. Keep this skill focused on device interaction mechanics and screenshot capture.
202
211
 
203
212
  ### Troubleshooting
204
213
 
@@ -186,6 +186,7 @@ Check the `argent-environment-inspector` result for test commands. For interacti
186
186
 
187
187
  - **Unit tests**: Look for Jest in `package.json` (`"test": "jest"`, `jest` config). Run: `npm test` or `yarn test`.
188
188
  - **E2E**: Look for Detox (`.detoxrc.js` or similar), or other E2E config. Dependencies: `detox`, `detox-cli`, and for iOS often `applesimutils`.
189
+ - **Visible UI changes**: Use `argent-test-ui-flow` for manual QA. For `screenshot-diff` rules and parameters, follow the `argent-screenshot-diff` skill. Use it when stable before/after screenshots add meaningful pixel-visible evidence.
189
190
  - **UI flow testing**: For interactive UI testing with automatic screenshot verification, refer to the `argent-test-ui-flow` skill.
190
191
 
191
192
  ### 5.2 Running Tests (Typical)
@@ -219,6 +220,7 @@ If the user's intent is ambiguous (run existing tests, write new tests, or find
219
220
  | List devices | `list-devices` tool (iOS + Android) |
220
221
  | Boot a device | `boot-device` tool (pass `udid` for iOS or `avdName` for Android) |
221
222
  | Take screenshot | `screenshot` tool |
223
+ | Compare visible UI changes | `screenshot-diff` tool; follow the `argent-screenshot-diff` skill for baseline/current capture choices |
222
224
  | Describe screen (a11y tree) | `describe` tool for normal app screens and in-app modals; use `screenshot` only when permission/system overlays are not exposed reliably |
223
225
  | Read JS console logs | `debugger-log-registry` tool |
224
226
  | Reload JS bundle | `debugger-reload-metro` tool |
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: argent-screenshot-diff
3
+ description: 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.
4
+ ---
5
+
6
+ ## 1. Role
7
+
8
+ 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.
9
+
10
+ Do not use screenshot diffing for tap-coordinate discovery. Use `describe`, `debugger-component-tree`, or `native-describe-screen` to find targets first.
11
+
12
+ ## 2. When To Use
13
+
14
+ Use `screenshot-diff` when pixel comparison can answer the verification question:
15
+
16
+ - 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.
17
+ - 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.
18
+ - Good fit when the risk is unintended visual regression outside the exact element changed.
19
+ - Poor fit when the result is better verified structurally: state changes, navigation existence, accessibility tree contents, console/network behavior, or unit tests.
20
+ - Poor fit when dynamic content, unpausable animation, timestamps, ads, random data, or missing baseline/current screenshots would make the comparison noisy or meaningless.
21
+
22
+ ## 3. Capture Rules
23
+
24
+ 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:
25
+
26
+ ```json
27
+ { "udid": "<UDID>", "scale": 1.0, "includeImageInContext": false }
28
+ ```
29
+
30
+ 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.
31
+
32
+ ## 4. Parameters
33
+
34
+ Provide `udid` and exactly one input for the baseline side and exactly one input for the current side:
35
+
36
+ - Common UI regression flow: saved baseline plus live current -> `baselinePath`, `captureCurrent: true`, `udid`, `outputDir`.
37
+ - Both screenshots already saved -> `baselinePath`, `currentPath`, `udid`, `outputDir`.
38
+ - Rare fixture flow: live baseline plus saved current -> `captureBaseline: true`, `currentPath`, `udid`, `outputDir`.
39
+ - Do not combine `captureBaseline: true` with `captureCurrent: true`, or provide both a path and live capture flag for the same side.
40
+
41
+ ## 5. Deterministic Flow
42
+
43
+ 1. Navigate to the known-good state.
44
+ 2. Capture a baseline PNG with `screenshot` using `scale: 1.0` and `includeImageInContext: false`; keep the returned `path`.
45
+ 3. Perform the interaction, apply the code change and navigate to the state under test.
46
+ 4. Call `screenshot-diff` with the saved `baselinePath`, `captureCurrent: true`, `udid`, and `outputDir`.
47
+ 5. Inspect the summary and artifact paths, then combine the diff with normal visual inspection and any structural/runtime evidence needed for the assertion.
48
+
49
+ ```json
50
+ {
51
+ "baselinePath": "/tmp/baseline.png",
52
+ "captureCurrent": true,
53
+ "udid": "<UDID>",
54
+ "outputDir": "/tmp/argent-diff"
55
+ }
56
+ ```
57
+
58
+ If both images are already saved, use file paths for both sides:
59
+
60
+ ```json
61
+ {
62
+ "baselinePath": "/tmp/baseline.png",
63
+ "currentPath": "/tmp/current.png",
64
+ "udid": "<UDID>",
65
+ "outputDir": "/tmp/argent-diff"
66
+ }
67
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-test-ui-flow
3
- description: Autonomously test an app UI (iOS or Android) by running interact-screenshot-verify loops using argent MCP tools. Use when testing a UI flow, verifying login works, testing navigation, or running an end-to-end UI test scenario.
3
+ description: Autonomously test an app UI (iOS or Android) by running interact-screenshot-verify loops using argent MCP tools. Use when testing UI flows, verifying login works, testing navigation, running end-to-end UI test scenarios, manual QA steps, visible UI changes, or visual behavior.
4
4
  ---
5
5
 
6
6
  ## Platform-agnostic
@@ -20,14 +20,21 @@ Once a platform is chosen, the per-platform setup skill takes over:
20
20
 
21
21
  All interactions go through argent MCP tools. Ensure the simulator/emulator is ready before starting.
22
22
 
23
- 1. **Baseline screenshot**: Call `screenshot` to see the current UI state.
23
+ For implementation tasks that modify visible UI, this workflow can also serve as a visual acceptance path.
24
+
25
+ 1. **Baseline screenshot**: Call `screenshot` to see the current UI state. For visual regression comparison or UI change verification, capture the baseline at `scale: 1.0` with `includeImageInContext: false` and keep the returned `path` before editing whenever feasible.
24
26
  2. **Find target**: Before tapping, use a discovery tool to get element coordinates:
25
27
  - **React Native apps**: use `debugger-component-tree` — it returns component names with (tap: x,y) coordinates. This is the preferred tool for RN apps on either platform. To use it, resolve the `argent-react-native-app-workflow` skill for setup; on Android you must also run `adb -s <serial> reverse tcp:8081 tcp:8081` so Metro is reachable from the device.
26
28
  - **Standard app screens and in-app modals**: use `describe`. On iOS this returns the AX tree (falls back to native-devtools when AX is empty); on Android it returns the uiautomator tree in the same DescribeNode shape.
27
29
  - **Permission prompts / system modal overlays**: try `describe` first. Fall back to `screenshot` only if the overlay is not exposed reliably.
28
30
  - **Fallback**: use `screenshot` to estimate where the desired component is, then verify immediately after the action.
29
31
  3. **Interact**: Perform the action (`gesture-tap`, `gesture-swipe`, `keyboard`, `button`, ...) — you receive a screenshot automatically.
30
- 4. **Verify**: Check the returned screenshot for expected results. If it shows a loading/transitional state, retake with `screenshot`.
32
+ 4. **Verify**: Check the returned screenshot for expected results. If it shows a loading/transitional state, retake with normal downscaled `screenshot`. Pick evidence by what's being asserted:
33
+ - **Visual** (layout, spacing, color, typography, image/icon rendering, clipping, overflow, text rendering): prefer `screenshot-diff` against the baseline captured in step 1 — it surfaces pixel-visible changes the auto-screenshot might miss. Fall back to visual inspection of the auto-screenshot only when a stable baseline isn't available.
34
+ - **Structural** (navigation state, element existence, accessibility labels/values, selection, hierarchy, route): verify with `describe`, `debugger-component-tree`, or `native-describe-screen`.
35
+ - **Runtime / log / network** (console errors, API calls, persistence, timing): verify with `view-network-logs`, `debugger-log-registry`, `debugger-evaluate`, or targeted tests.
36
+ - **Mixed**: collect evidence for each relevant class.
37
+ - Report the combined verdict: expected behavior, observed behavior, evidence used, and any blocker for requested visual diffing.
31
38
  5. **Repeat** for each step in the flow.
32
39
 
33
40
  ## 2. Template
@@ -36,10 +43,12 @@ All interactions go through argent MCP tools. Ensure the simulator/emulator is r
36
43
  Goal: Test [feature name]
37
44
 
38
45
  Steps:
39
- 1. screenshot see current state (baseline)
40
- 2. [Navigate / tap / type to reach starting point] → verify auto-screenshot
41
- 3. [Perform the action to test]verify auto-screenshot
42
- 4. Report: pass / fail with details
46
+ 1. Classify expected result: visual / structural / runtime-log-network / mixed → choose evidence
47
+ 2. [Navigate / tap / type to reach stable comparable starting point] → verify auto-screenshot
48
+ 3. screenshot { scale: 1.0, includeImageInContext: false } save baseline path when visual or mixed evidence needs diffing
49
+ 4. [Perform the action to test] → verify auto-screenshot
50
+ 5. Use screenshot-diff when requested or when comparable images add useful visual evidence
51
+ 6. Report: pass / fail with combined visual, structural, runtime/log/network evidence as applicable
43
52
  ```
44
53
 
45
54
  ## 3. Examples
@@ -67,6 +76,19 @@ Steps:
67
76
  6. screenshot → verify returned to list
68
77
  ```
69
78
 
79
+ ### Visual behavior check
80
+
81
+ ```
82
+ 1. Classify expected result as visual or mixed.
83
+ 2. Navigate to the stable starting state.
84
+ 3. screenshot { scale: 1.0, includeImageInContext: false } → save baseline path.
85
+ 4. describe / debugger-component-tree → find the control and use its returned tap coordinates.
86
+ 5. gesture-tap → perform the visual behavior under test.
87
+ 6. screenshot-diff { baselinePath, captureCurrent: true, udid, outputDir } → inspect visible change or stability.
88
+ 7. describe / debugger-component-tree → verify selected state, label, route, or attributes if relevant.
89
+ 8. Report combined verdict from expected behavior, visual inspection, diff summary, and structural evidence.
90
+ ```
91
+
70
92
  ---
71
93
 
72
94
  ## 4. Recovery Pattern
@@ -82,17 +104,17 @@ Steps:
82
104
  - **Use `paste` for text entry on iOS** — faster and more reliable than key-by-key `keyboard`. `paste` is iOS-only; on Android use `keyboard` instead.
83
105
  - **Use `gesture-custom` for long-press** context menus (800ms hold).
84
106
  - **Report clearly**: state what you expected, what you saw, and the verdict.
85
- - **Coordinate estimation**: center = 0.5, 0.5; top-third ~ 0.2; bottom-third ~ 0.8.
86
107
  - **Permission modals**: try `describe` first. Use `screenshot` only as fallback, tap one visible button at a time, and verify with the returned screenshot before continuing.
87
108
  - **Record for replay**: If a tested flow is likely to be repeated, use the `argent-create-flow` skill to record it as a `.yaml` script. This lets you replay the entire sequence later with a single `flow-execute` call instead of re-running each step manually.
88
109
 
89
110
  ## Related Skills
90
111
 
91
- | Skill | When to use |
92
- | ---------------------------------- | ------------------------------------------------------- |
93
- | `argent-device-interact` | Tool usage for tapping, swiping, typing (iOS + Android) |
94
- | `argent-ios-simulator-setup` | Booting and connecting an iOS simulator |
95
- | `argent-android-emulator-setup` | Booting and connecting an Android emulator |
96
- | `argent-react-native-app-workflow` | Starting the app, Metro, build issues |
97
- | `argent-metro-debugger` | Breakpoints, console logs, JS evaluation |
98
- | `argent-create-flow` | Record a test sequence as a replayable flow |
112
+ | Skill | When to use |
113
+ | ---------------------------------- | -------------------------------------------------------- |
114
+ | `argent-device-interact` | Tool usage for tapping, swiping, typing (iOS + Android) |
115
+ | `argent-screenshot-diff` | Visual regression and before/after screenshot comparison |
116
+ | `argent-ios-simulator-setup` | Booting and connecting an iOS simulator |
117
+ | `argent-android-emulator-setup` | Booting and connecting an Android emulator |
118
+ | `argent-react-native-app-workflow` | Starting the app, Metro, build issues |
119
+ | `argent-metro-debugger` | Breakpoints, console logs, JS evaluation |
120
+ | `argent-create-flow` | Record a test sequence as a replayable flow |