@swmansion/argent 0.30.2-next.1 → 0.30.2-next.10
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.
- package/dist/cli-cmds.mjs +31 -2
- package/dist/client.js +27 -1
- package/dist/installer.mjs +25 -1
- package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/project.pbxproj +80 -0
- package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/xcshareddata/xcschemes/ArgentRunner.xcscheme +14 -0
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/Assets.xcassets/AppIcon.appiconset/AppIcon.png +0 -0
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/Assets.xcassets/Contents.json +6 -0
- package/dist/ios-device-runner/ArgentRunner/brand-runner.sh +27 -0
- package/dist/mcp-server.mjs +99 -71
- package/dist/tool-args.generated.d.ts +40 -38
- package/dist/tool-server.cjs +3532 -1289
- package/package.json +1 -1
- package/rules/argent.md +9 -7
- package/skills/argent-create-e2e/references/e2e-yaml.md +1 -0
- package/skills/argent-device-interact/SKILL.md +4 -2
- package/skills/argent-device-interact/references/harmonyos.md +79 -0
- package/skills/argent-ios-device-setup/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +1 -2
package/package.json
CHANGED
package/rules/argent.md
CHANGED
|
@@ -37,9 +37,9 @@ If argent is ABSENT, treat it as an expected state, not an error to retry. Do no
|
|
|
37
37
|
|
|
38
38
|
<tapping_rule>
|
|
39
39
|
<important>**Never** derive tap coordinates from screenshot pixels</important>
|
|
40
|
-
Interaction tools (`gesture-tap`, `gesture-swipe`, `keyboard`, `button`, `launch-app`, `open-url`, `run-sequence`, …) return the screen **after** the action: a screenshot AND the accessibility element tree (`--- Elements after action (describe) ---`, the same format `describe` prints, with normalized 0–1 frames). Take tap coordinates from that tree: the centre of the element's frame (`x + width/2`, `y + height/2`). You do not need a separate discovery call before a tap when the last result already lists the target.
|
|
40
|
+
Interaction tools (`gesture-tap`, `gesture-swipe`, `keyboard`, `button`, `launch-app`, `open-url`, `run-sequence`, `await-ui-element`, …) return the screen **after** the action: a screenshot AND the accessibility element tree (`--- Elements after action (describe) ---`, the same format `describe` prints, with normalized 0–1 frames). Take tap coordinates from that tree: the centre of the element's frame (`x + width/2`, `y + height/2`). You do not need a separate discovery call before a tap when the last result already lists the target.
|
|
41
41
|
|
|
42
|
-
Call a discovery tool yourself only when you have no fresh tree for the current screen: before the first action on a screen you have not touched yet, after waiting for something to load
|
|
42
|
+
Call a discovery tool yourself only when you have no fresh tree for the current screen: before the first action on a screen you have not touched yet, after waiting for something to load without `await-ui-element`, or when the last tree did not list your target. Preferred tools are, in order:
|
|
43
43
|
|
|
44
44
|
- `describe` - native app-level components and safely targetable foreground apps (iOS and Android).
|
|
45
45
|
- `native-describe-screen` - accessibility screen description via injected native devtools (iOS only)
|
|
@@ -78,11 +78,13 @@ Decision order:
|
|
|
78
78
|
- Always open apps with `launch-app` or `open-url`; never tap home screen icons.
|
|
79
79
|
- If a task can require a saved e2e test, choose `argent-create-e2e` or `argent-qa-e2e` before the first launch or in-app action. Start the recorder before walking the path; recording is not retroactive.
|
|
80
80
|
- Always use `run-sequence` when performing multiple sequential device actions where you don't need to observe the screen between steps. More in `argent-device-interact` skill.
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
- Do not stop simulator servers when a task finishes: the next task reuses them, and stopping them makes its
|
|
82
|
+
first device action start cold again. Call `stop-all-simulator-servers` when the user asks to clean up or
|
|
83
|
+
ends the session, or when a skill tells you to recycle a device's services (e.g. before a QA proof pass).
|
|
84
|
+
Always pass `devices: [...]` naming the devices this session used. One tool-server is shared by every other
|
|
85
|
+
agent using this argent install, so an unscoped call tears down their devices too; reserve that form for a
|
|
86
|
+
deliberate machine-wide cleanup.
|
|
87
|
+
Never stop a Metro the user started unless they ask (`stop-metro`, specify the port if not 8081).
|
|
86
88
|
- If tools provided by mcp-server are not sufficient and action can be done using `xcrun`, `adb`, or other commands, use the command. Examples: changing device options, performing a device action such as lock, shake, etc. Not on a physical iPhone.
|
|
87
89
|
- When waiting for an action, do not call `screenshot` repeatedly without a proper wait mechanism. Use the `await-ui-element` tool to block until the UI settles (e.g. wait for an element to become `visible`/`hidden`, or to contain expected `text`) instead of polling.
|
|
88
90
|
</general_rules>
|
|
@@ -237,6 +237,7 @@ A `run:` target is a YAML path resolved against the directory of the test file c
|
|
|
237
237
|
- iOS and Android can run fragments or standalone tests inline. A nested standalone launch restarts its app.
|
|
238
238
|
- Chromium boots one instance per launch **step**, not one per run. The leading launch (the test's own, or the one its leading `run:` chain reaches) boots before step 1, unless you pinned the run with an explicit `device`, where it only attaches. Every later launch boots a fresh instance, moves the run onto it, and tears down the instance the run already owned for that app path. Nesting a Chromium standalone test with its own launch is therefore the supported way to give a sub-scenario its own restart. Chromium rejects `pinch` and `rotate`. Use the app's own zoom or rotate controls.
|
|
239
239
|
- Vega uses `tool: tv-remote` and raw `tool: keyboard`. The touch directives (`tap`, `long-press`, `swipe`, `type`, `scroll-to`, `pinch`, `rotate`) are unsupported. Gate focus and navigation results with `await`.
|
|
240
|
+
- HarmonyOS: read `references/harmonyos.md` of `argent-device-interact` before writing a test for it.
|
|
240
241
|
|
|
241
242
|
## Local scripts
|
|
242
243
|
|
|
@@ -13,7 +13,7 @@ All interaction tools below accept a `udid` parameter and auto-dispatch iOS vs A
|
|
|
13
13
|
|
|
14
14
|
If you delegate simulator tasks to sub-agents, make sure they have MCP permissions.
|
|
15
15
|
|
|
16
|
-
Use `list-devices` to get a target id. Results are tagged with `platform` (`ios`, `android`, or `chromium`); booted/ready devices come first. Pick the first entry that matches the platform you need; if none are ready, call `boot-device` with `udid` (iOS), `avdName` (Android), or `electronAppPath` (boots an Electron app as a `chromium` device). A Chromium browser already running with a CDP port shows up directly; no `boot-device` needed. See `argent-ios-simulator-setup` / `argent-android-emulator-setup` for full setup flow.
|
|
16
|
+
Use `list-devices` to get a target id. Results are tagged with `platform` (`ios`, `android`, or `chromium`); booted/ready devices come first. For a `harmony` target, read `references/harmonyos.md` before driving it. Pick the first entry that matches the platform you need; if none are ready, call `boot-device` with `udid` (iOS), `avdName` (Android), or `electronAppPath` (boots an Electron app as a `chromium` device). A Chromium browser already running with a CDP port shows up directly; no `boot-device` needed. See `argent-ios-simulator-setup` / `argent-android-emulator-setup` for full setup flow.
|
|
17
17
|
|
|
18
18
|
**Load tool schemas before first use.** Gesture tools (`gesture-tap`, `gesture-swipe`, `gesture-pinch`, `gesture-rotate`, `gesture-custom`) may be deferred: their parameter schemas are not loaded until fetched. Always use ToolSearch to load the schemas of all gesture tools you plan to use **before** calling any of them. If you skip this step, parameters may be coerced to strings instead of numbers, causing validation errors.
|
|
19
19
|
|
|
@@ -36,7 +36,7 @@ Use `list-devices` to get a target id. Results are tagged with `platform` (`ios`
|
|
|
36
36
|
{ "udid": "<UDID>", "bundleId": "com.apple.MobileSMS" }
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Common IDs: `com.apple.MobileSMS` (Messages), `com.apple.mobilesafari` (Safari), `com.apple.Preferences` (Settings), `com.apple.Maps`, `com.apple.
|
|
39
|
+
Common IDs: `com.apple.MobileSMS` (Messages), `com.apple.mobilesafari` (Safari), `com.apple.Preferences` (Settings), `com.apple.Maps`, `com.apple.mobileslideshow` (Photos), `com.apple.MobileAddressBook` (Contacts)
|
|
40
40
|
|
|
41
41
|
### open-url: by URL scheme
|
|
42
42
|
|
|
@@ -169,6 +169,8 @@ Values: `home`, `back`, `power`, `volumeUp`, `volumeDown`, `appSwitch`, `actionB
|
|
|
169
169
|
|
|
170
170
|
One call does one action. `text` and `key` are mutually exclusive, and a call that carries both is rejected with nothing typed. To type and then submit, send two `keyboard` steps in one `run-sequence` (§ 8): `{ "text": "search query" }`, then `{ "key": "enter" }`. Two separate calls do the same work, but cost an extra round-trip.
|
|
171
171
|
|
|
172
|
+
**React Native: the first tap after typing may only close the keyboard.** Inside a scroll view with the default `keyboardShouldPersistTaps="never"`, React Native uses a tap outside the focused field to dismiss the keyboard and does not pass it on (with `"handled"` or `"always"` the tap reaches the button), so a button tapped right after typing may need a second tap; check the returned tree. When the field submits on return, `{ "key": "enter" }` avoids the extra tap.
|
|
173
|
+
|
|
172
174
|
Special keys: `enter`, `escape`, `backspace`, `tab`, `space`, `arrow-up`, `arrow-down`, `arrow-left`, `arrow-right`, `f1`–`f12`. Optional: `"delayMs": 100` between keystrokes (default 50ms); applies to the iOS simulator and Chromium; it is ignored on Android phones/tablets (typed via `adb input text`, no per-key cadence), on Vega, and on TV targets.
|
|
173
175
|
|
|
174
176
|
**Typing secrets.** To enter a credential without its plaintext ever entering your context, transcript, or logs, use a secret placeholder in `text` (works in `keyboard`, `paste`, `run-sequence` keyboard steps, and e2e `type` steps):
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# HarmonyOS Targets
|
|
2
|
+
|
|
3
|
+
HarmonyOS targets exist only after `argent enable harmonyos`; with the flag off `list-devices` lists none and every `harmony-*` id is refused with `HarmonyOS support is off; turn it on with argent enable harmonyos`.
|
|
4
|
+
|
|
5
|
+
Everything in the related SKILL.md still applies; this page covers what differs.
|
|
6
|
+
|
|
7
|
+
## Ids and discovery
|
|
8
|
+
|
|
9
|
+
`list-devices` tags HarmonyOS entries `platform: "harmony"` and gives each a `kind`:
|
|
10
|
+
|
|
11
|
+
| `kind` | id | state | What it is |
|
|
12
|
+
| ---------- | ------------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| `device` | `harmony-<connectKey>` | `Connected` / `Offline` | A target connected over `hdc` (a phone on USB, or a booted emulator). The interaction tools drive this id |
|
|
14
|
+
| `emulator` | `harmony-emulator-<name>` | `running` / `stopped` | A DevEco Studio instance. Only `boot-device` accepts it; never use it as an interaction target |
|
|
15
|
+
|
|
16
|
+
- A running emulator appears under both kinds, as a running Android AVD appears in both `avds` and the device list.
|
|
17
|
+
- A plugged-in phone (`state: "Connected"`) is listed as ready alongside booted simulators. Pick a `harmony` entry only when the user asked for HarmonyOS, and pick the `kind: "device"` one.
|
|
18
|
+
- Every tool auto-dispatches on the id: `harmony-<connectKey>` is a HarmonyOS device, `harmony-emulator-<name>` is a boot target.
|
|
19
|
+
|
|
20
|
+
## Booting an emulator
|
|
21
|
+
|
|
22
|
+
A phone on `hdc` is ready as-is. Otherwise call `boot-device` with `harmonyInstance`: the instance `name` from the `kind: "emulator"` entry (e.g. `Phone_1`), or its `harmony-emulator-<name>` id. It hands the instance to DevEco Studio's Emulator manager, waits for it to register with `hdc`, and returns the `harmony-<connectKey>` id to drive. An instance that is already running is left alone unless you pass `force: true`. Read the `note` when one comes back: it says what the boot left unproven (no key and why, or a key not answering yet). Huawei serves emulator images only within mainland China, so a host outside it usually has no instance to start.
|
|
23
|
+
|
|
24
|
+
## What runs and what is refused
|
|
25
|
+
|
|
26
|
+
The device drives the tap / swipe / pinch / type / read loop with the same tool names as iOS and Android: `describe`, `screenshot`, `await-ui-element`, `await-screen-idle`, `gesture-tap`, `gesture-swipe`, `gesture-pinch`, `keyboard`, `button`, `launch-app`, `restart-app`, `reinstall-app`, `open-url`, `run-sequence`, `screenshot-diff`.
|
|
27
|
+
|
|
28
|
+
Refused as unsupported on harmony:
|
|
29
|
+
|
|
30
|
+
- `gesture-rotate` and `gesture-custom`: the device moves each contact along one straight line per call, so there is no arc and no long-press. There is no long-press tool on HarmonyOS.
|
|
31
|
+
- `gesture-drag` and `gesture-scroll` (Chromium-only), and `rotate`: the device has no orientation command.
|
|
32
|
+
- The app-scoped inspectors `native-describe-screen`, `native-view-at-point`, `native-user-interactable-view-at-point` and `debugger-component-tree`, which declare no harmony support and answer `Tool '<id>' is not supported on harmony device` before running. The rest of the debugger (`debugger-evaluate`, `debugger-log-registry`), `view-network-logs` and the profilers are refused too.
|
|
33
|
+
- `paste`, so a `{{secret:...}}` placeholder goes through `keyboard` only.
|
|
34
|
+
- Screen recording: HarmonyOS exposes no readable frame stream. Use `screenshot` for a still frame.
|
|
35
|
+
|
|
36
|
+
`gesture-pinch` sends both fingers' endpoints in one `uinput` call and the device interpolates the move; `durationMs` is wall-clock time, clamped to 1-15000ms. `gesture-swipe` is likewise one on-device call, and its `durationMs` sets speed, clamped to `uitest`'s 200-40000 px/s: a short slow swipe ends early, a long fast one runs late. `gesture-tap` with `clickCount: 2` is one double-tap gesture; 3 or more land as separate taps.
|
|
37
|
+
|
|
38
|
+
## Discovery
|
|
39
|
+
|
|
40
|
+
`describe` runs the device's own `uitest dumpLayout` (`source: "harmony-uitest"`) and returns it in the same DescribeNode shape as the other platforms. Each top-level child is a window carrying its bundle as `identifier`, so an app plus the status bar reads as two windows. `describe` and `screenshot` are the whole discovery surface, and when `describe` fails `screenshot` is the only fallback.
|
|
41
|
+
|
|
42
|
+
An empty tree comes with a `hint` that the layout dump contains no windows and the foreground app may still be starting. That is the expected read during app startup: call `describe` again rather than switching tools.
|
|
43
|
+
|
|
44
|
+
`screenshot` takes no `rotation`: `uitest screenCap` captures the display in its current orientation, so a `rotation` is refused with 400 and no image comes back. The same holds for a live capture in `screenshot-diff`. Rotate the device itself, or drop the parameter.
|
|
45
|
+
|
|
46
|
+
## Suspended panel
|
|
47
|
+
|
|
48
|
+
A suspended display still dumps its last-composited windows, which look like a live screen. `describe` then carries a `hint` that the panel is off, and the waits pass on that frame:
|
|
49
|
+
|
|
50
|
+
- `await-ui-element` with `success: true` and a `note`: the tree was read off a suspended panel. It is not clearance to act.
|
|
51
|
+
- `await-screen-idle` settles at once on the last frame; a `note` on `settled: true` says the screen is not live.
|
|
52
|
+
|
|
53
|
+
Taps land nowhere and input tools refuse against the panel until `button` with `power` wakes it.
|
|
54
|
+
|
|
55
|
+
## Keyboard keys
|
|
56
|
+
|
|
57
|
+
Only `enter` (alias `return`), `backspace` (alias `delete`), `space`, `arrow-left` and `arrow-right` exist; any other key is refused with 400 `KEYBOARD_KEY_UNSUPPORTED`. `delayMs` is ignored: `uitest uiInput text` types the text in one shot. Text cannot contain a newline or another control character; type the text, then send `key: "enter"`.
|
|
58
|
+
|
|
59
|
+
## Buttons
|
|
60
|
+
|
|
61
|
+
`button` accepts `home`, `back` and `power` only; any other button is rejected.
|
|
62
|
+
|
|
63
|
+
## App launch and open-url
|
|
64
|
+
|
|
65
|
+
- `launch-app` and `restart-app` take the bundle name as listed by `bm dump -a` (e.g. `com.huawei.hmos.calculator`). `activity` is ignored: the ability comes from the bundle's own `abilityInfos`. A launch fails if the app is not installed.
|
|
66
|
+
- `reinstall-app` takes one `.hap` file as `appPath` and the bundle name from its `module.json` as `bundleId`; a mismatch is refused before anything is uninstalled. A multi-module `.app` bundle is not accepted.
|
|
67
|
+
- `open-url` resolves any scheme through `aa start -U`, and every result carries a `note`: `aa` reports success whenever the system accepts the URI. A web URL can leave the screen unchanged, and `tel:` / `mailto:` can leave a "No options to open with" dialog over it. Confirm with `describe` or `screenshot` before treating the link as followed. It fails whenever `aa` refuses the URI, as it does a scheme nothing claims.
|
|
68
|
+
|
|
69
|
+
## E2E tests
|
|
70
|
+
|
|
71
|
+
The e2e runner (`e2e-execute`, skill `argent-create-e2e`) runs on HarmonyOS only when you name the device: `device: "harmony-<connectKey>"` (`--device` on the CLI). A HarmonyOS device is never auto-resolved, and `platform` / `--platform` does not accept `harmony`. HarmonyOS is not an authorable platform either: `when: { platform: harmony }` and a `harmony:` launch-map key are rejected when the YAML is parsed, so launch with a bare app id or `native:`.
|
|
72
|
+
|
|
73
|
+
The runner has no UI tree on HarmonyOS (`describe` reads the `uitest` layout dump, but no runner tree source exists), so no selector resolves:
|
|
74
|
+
|
|
75
|
+
- Every selector step errors with a reason containing `ui-tree matching is not supported on platform "harmony"`: a selector `tap:` / `swipe:` / `pinch:`, `type:` (selector-only), `scroll-to:`, `await:` / `assert:` and `when:` UI conditions, and `snapshot:` with `cropOn:`.
|
|
76
|
+
- `await: { idle: true }` errors immediately, with no polling, since no relaunch can restore a tree that does not exist. It names `wait:` as the replacement and skips the rest of the run.
|
|
77
|
+
- `long-press:` and `rotate:` are refused up front, with or without a selector: `uitest uiInput` sends one whole gesture per call with no hold duration, and `uinput -T -m`, the two-contact injection `pinch:` rides on, moves each contact along one straight line, never an arc.
|
|
78
|
+
|
|
79
|
+
What runs: a coordinate `tap:`, a selector-less `swipe:` and `pinch:`, `launch:`, `snapshot:` without `cropOn:`, `wait:`, `echo:`, `script:`, and raw `tool:` steps for the tools that support HarmonyOS. For anything that needs a selector, run the scenario as a live interact-screenshot-verify loop instead.
|
|
@@ -11,7 +11,7 @@ Read this only for a physical iPhone. Simulators use `argent-ios-simulator-setup
|
|
|
11
11
|
|
|
12
12
|
1. Cable the phone, unlock it, keep the screen awake, and turn on Developer Mode (Settings > Privacy & Security > Developer Mode). `list-devices` must show it `connected`.
|
|
13
13
|
2. `launch-app` only registers the app. The first `describe`, gesture or `screenshot` builds, signs and starts the on-device runner: minutes cold, tens of seconds from cache or after a tool-server restart. Build cap 15 min, runner ready 120 s.
|
|
14
|
-
3. On the first install the phone asks to trust the developer (Settings > General > VPN & Device Management), and an **
|
|
14
|
+
3. On the first install the phone asks to trust the developer (Settings > General > VPN & Device Management), and an **Argent Runner** app appears on the home screen. Tell the user it is argent's automation runner and must stay installed.
|
|
15
15
|
|
|
16
16
|
## Signing and failures
|
|
17
17
|
|
|
@@ -98,8 +98,7 @@ Steps:
|
|
|
98
98
|
```
|
|
99
99
|
1. gesture-tap { x: 0.5, y: 0.7 } → trigger an action that fetches data
|
|
100
100
|
2. screenshot → loading spinner is showing
|
|
101
|
-
3. await-ui-element { condition: hidden, selector: { text: "Loading" } } → block until the fetch finishes and the spinner disappears
|
|
102
|
-
4. describe / screenshot → verify the fetched content rendered
|
|
101
|
+
3. await-ui-element { condition: hidden, selector: { text: "Loading" } } → block until the fetch finishes and the spinner disappears; its result carries the screenshot and element tree, so verify the fetched content rendered from it
|
|
103
102
|
```
|
|
104
103
|
|
|
105
104
|
---
|