agent-device 0.18.3 → 0.19.1
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/README.md +5 -1
- package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.3.apk → agent-device-android-multitouch-helper-0.19.1.apk} +0 -0
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.19.1.apk.sha256 +1 -0
- package/android-multitouch-helper/dist/{agent-device-android-multitouch-helper-0.18.3.manifest.json → agent-device-android-multitouch-helper-0.19.1.manifest.json} +4 -4
- package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.3.apk → agent-device-android-snapshot-helper-0.19.1.apk} +0 -0
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.19.1.apk.sha256 +1 -0
- package/android-snapshot-helper/dist/{agent-device-android-snapshot-helper-0.18.3.manifest.json → agent-device-android-snapshot-helper-0.19.1.manifest.json} +6 -6
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTapPointPolicy.swift +28 -0
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift +33 -127
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift +630 -177
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +155 -0
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +67 -0
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Interaction.swift +173 -122
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift +172 -0
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +64 -0
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SequenceExecution.swift +76 -182
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift +92 -51
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift +213 -137
- package/dist/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift +142 -0
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntry.swift +208 -46
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift +82 -11
- package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +74 -0
- package/dist/src/agent-browser-tool.js +1 -0
- package/dist/src/android-adb.d.ts +63 -234
- package/dist/src/android-adb.js +1 -1
- package/dist/src/android-input-ownership.js +6 -0
- package/dist/src/android.js +1 -5
- package/dist/src/app-lifecycle.js +7 -0
- package/dist/src/apple-runner-options.js +1 -0
- package/dist/src/apps.js +5 -11
- package/dist/src/artifacts.d.ts +4 -3
- package/dist/src/artifacts.js +1 -1
- package/dist/src/audio-probe.js +1 -1
- package/dist/src/batch.d.ts +2 -177
- package/dist/src/batch.js +1 -1
- package/dist/src/cli-help.js +178 -60
- package/dist/src/cli-output.js +1 -1
- package/dist/src/cli-runner.js +2 -0
- package/dist/src/cli.js +12 -41
- package/dist/src/client-metro-companion.js +1 -0
- package/dist/src/client.js +3 -0
- package/dist/src/command-metadata.js +1 -0
- package/dist/src/command-schema.js +22 -0
- package/dist/src/command-surface.js +1 -1
- package/dist/src/contracts.d.ts +2 -213
- package/dist/src/contracts.js +1 -1
- package/dist/src/debug-symbols.js +5 -3
- package/dist/src/device-input-state.js +2 -0
- package/dist/src/devices.js +1 -1
- package/dist/src/devices2.js +1 -0
- package/dist/src/devices3.js +1 -0
- package/dist/src/find.js +1 -1
- package/dist/src/finders.d.ts +2 -81
- package/dist/src/finders.js +1 -1
- package/dist/src/generic.js +1 -1
- package/dist/src/handler-utils.js +1 -1
- package/dist/src/helper.js +2 -0
- package/dist/src/host-process.js +2 -0
- package/dist/src/index.d.ts +1444 -1786
- package/dist/src/index.js +1 -1
- package/dist/src/input-actions.js +3 -1
- package/dist/src/input-actions2.js +1 -0
- package/dist/src/install-source.d.ts +13 -14
- package/dist/src/install-source.js +1 -1
- package/dist/src/install-source2.js +1 -0
- package/dist/src/interaction-snapshot.js +1 -0
- package/dist/src/interaction.js +1 -1
- package/dist/src/interactor.js +2 -1
- package/dist/src/internal/bin.d.ts +1 -1
- package/dist/src/internal/bin.js +2 -5
- package/dist/src/internal/companion-tunnel.d.ts +1 -1
- package/dist/src/internal/companion-tunnel.js +1 -1
- package/dist/src/internal/daemon.d.ts +1 -1
- package/dist/src/internal/daemon.js +18 -1
- package/dist/src/internal/png-worker.d.ts +29 -26
- package/dist/src/internal/png-worker.js +1 -1
- package/dist/src/internal/update-check-entry.d.ts +1 -1
- package/dist/src/internal/update-check-entry.js +1 -1
- package/dist/src/io.d.ts +2 -85
- package/dist/src/io.js +1 -1
- package/dist/src/lease.js +1 -1
- package/dist/src/linux.js +1 -1
- package/dist/src/manifest.js +1 -0
- package/dist/src/metro.d.ts +69 -113
- package/dist/src/metro.js +1 -1
- package/dist/src/metro2.js +1 -0
- package/dist/src/notifications.js +1 -1
- package/dist/src/output-path.js +1 -0
- package/dist/src/path-resolution.js +1 -0
- package/dist/src/png-worker-contract.js +1 -0
- package/dist/src/points.js +4 -0
- package/dist/src/project-runtime.js +1 -0
- package/dist/src/provider.js +1 -1
- package/dist/src/providers.js +1 -0
- package/dist/src/react-native.js +1 -1
- package/dist/src/record-trace-recording.js +2 -5
- package/dist/src/record-trace.js +1 -1
- package/dist/src/recording-provider.js +1 -1
- package/dist/src/registry.js +38 -0
- package/dist/src/remote-config.d.ts +2 -83
- package/dist/src/reporting.js +9 -0
- package/dist/src/rolldown-runtime.js +1 -0
- package/dist/src/runner-client.js +1 -0
- package/dist/src/runner-provider.js +1 -0
- package/dist/src/runner-sequence.js +1 -1
- package/dist/src/runtime-transport.js +1 -0
- package/dist/src/runtime.js +3 -0
- package/dist/src/scoped-provider.js +1 -0
- package/dist/src/sdk-android-adb.d.ts +144 -0
- package/dist/src/sdk-android-adb.js +4 -0
- package/dist/src/sdk-app-inventory.d.ts +4 -0
- package/dist/src/sdk-app-inventory.js +1 -0
- package/dist/src/sdk-batch-runner.d.ts +39 -0
- package/dist/src/sdk-batch-runner.js +2 -0
- package/dist/src/sdk-batch.js +2 -0
- package/dist/src/sdk-contracts.d.ts +386 -0
- package/dist/src/sdk-contracts.js +2 -0
- package/dist/src/sdk-finders.d.ts +60 -0
- package/dist/src/sdk-finders.js +1 -0
- package/dist/src/sdk-io.d.ts +78 -0
- package/dist/src/sdk-io.js +1 -0
- package/dist/src/sdk-remote-config.d.ts +139 -0
- package/dist/src/sdk-remote-config.js +1 -0
- package/dist/src/sdk-selectors.js +1 -0
- package/dist/src/selector-runtime.js +1 -1
- package/dist/src/selectors.d.ts +38 -137
- package/dist/src/selectors.js +1 -1
- package/dist/src/selectors2.js +1 -0
- package/dist/src/server.js +3 -2
- package/dist/src/session.js +10 -11
- package/dist/src/setting-state.js +1 -0
- package/dist/src/simctl.js +1 -0
- package/dist/src/simulator.js +1 -2
- package/dist/src/snapshot-diagnostics.js +3 -0
- package/dist/src/snapshot-helper.js +5 -0
- package/dist/src/snapshot-quality.js +1 -0
- package/dist/src/snapshot.js +1 -2
- package/dist/src/snapshot2.js +2 -0
- package/dist/src/{5560.js → timeouts.js} +1 -1
- package/dist/src/tool-provider.js +3 -0
- package/dist/src/tool-provider2.js +1 -0
- package/dist/src/ttl-memo.js +1 -0
- package/dist/src/tv-remote.js +14 -0
- package/dist/src/update-check.js +1 -0
- package/dist/src/url.js +1 -0
- package/dist/src/version.js +1 -0
- package/dist/src/web.js +1 -1
- package/dist/src/xml.js +2 -0
- package/package.json +13 -19
- package/server.json +2 -2
- package/skills/agent-device/SKILL.md +8 -7
- package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.18.3.apk.sha256 +0 -1
- package/android-snapshot-helper/dist/agent-device-android-snapshot-helper-0.18.3.apk.sha256 +0 -1
- package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift +0 -443
- package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+FlatSnapshotFiltering.swift +0 -169
- package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScrollGesture.swift +0 -220
- package/dist/src/1404.js +0 -1
- package/dist/src/1986.js +0 -1
- package/dist/src/2748.js +0 -1
- package/dist/src/2948.js +0 -30
- package/dist/src/3006.js +0 -1
- package/dist/src/314.js +0 -1
- package/dist/src/3340.js +0 -8
- package/dist/src/4418.js +0 -1
- package/dist/src/4428.js +0 -3
- package/dist/src/485.js +0 -1
- package/dist/src/4917.js +0 -1
- package/dist/src/495.js +0 -5
- package/dist/src/5448.js +0 -3
- package/dist/src/5484.js +0 -1
- package/dist/src/5643.js +0 -1
- package/dist/src/587.js +0 -1
- package/dist/src/5913.js +0 -4
- package/dist/src/6849.js +0 -1
- package/dist/src/6918.js +0 -1
- package/dist/src/6967.js +0 -1
- package/dist/src/760.js +0 -1
- package/dist/src/7871.js +0 -1
- package/dist/src/8184.js +0 -1
- package/dist/src/8225.js +0 -1
- package/dist/src/8391.js +0 -1
- package/dist/src/8404.js +0 -2
- package/dist/src/8414.js +0 -2
- package/dist/src/8875.js +0 -4
- package/dist/src/893.js +0 -1
- package/dist/src/8936.js +0 -1
- package/dist/src/9414.js +0 -1
- package/dist/src/9581.js +0 -22
- package/dist/src/9612.js +0 -1
- package/dist/src/9624.js +0 -1
- package/dist/src/9722.js +0 -39
- package/dist/src/devices~1.js +0 -1
- package/dist/src/devices~2.js +0 -1
- package/dist/src/input-actions~1.js +0 -1
- package/dist/src/rslib-runtime.js +0 -1
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner/AgentDeviceRunnerApp.m +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.pbxproj +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunner.xcodeproj/xcshareddata/xcschemes/AgentDeviceRunner.xcscheme +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests-Bridging-Header.h +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/AgentDeviceRunnerUITests.entitlements +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.h +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAXSnapshotBridge.m +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.h +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerObjCExceptionCatcher.m +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.h +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerSynthesizedGesture.m +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Environment.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Exceptions.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Lifecycle.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Models.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TvRemote.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/AgentDeviceRunnerUITests.xctestplan +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-overlay.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-resize.swift +0 -0
- /package/{apple-runner → dist/apple-runner}/AgentDeviceRunner/RecordingScripts/recording-trim.swift +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-device",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Agent-native CLI for AI app automation across iOS, Android, tvOS, Android TV, macOS, Linux, and web.",
|
|
5
5
|
"mcpName": "io.github.callstackincubator/agent-device",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"engines": {
|
|
67
|
-
"node": ">=22.
|
|
67
|
+
"node": ">=22.12"
|
|
68
68
|
},
|
|
69
69
|
"bin": {
|
|
70
70
|
"agent-device": "bin/agent-device.mjs"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
|
-
"build": "
|
|
73
|
+
"build": "tsdown",
|
|
74
74
|
"clean:daemon": "node --experimental-strip-types scripts/clean-daemon.ts",
|
|
75
75
|
"daemon:state-dir": "node --experimental-strip-types scripts/print-daemon-state-dir.ts",
|
|
76
76
|
"clean:xcuitest": "node scripts/clean-xcuitest-derived.mjs",
|
|
@@ -90,20 +90,22 @@
|
|
|
90
90
|
"build:android-snapshot-helper": "sh ./scripts/build-android-snapshot-helper.sh $(node -p \"require('./package.json').version\") .tmp/android-snapshot-helper",
|
|
91
91
|
"package:android-snapshot-helper": "sh ./scripts/package-android-snapshot-helper.sh $(node -p \"require('./package.json').version\") v$(node -p \"require('./package.json').version\") .tmp/android-snapshot-helper",
|
|
92
92
|
"package:android-snapshot-helper:npm": "rm -rf android-snapshot-helper/dist && sh ./scripts/package-android-snapshot-helper.sh $(node -p \"require('./package.json').version\") v$(node -p \"require('./package.json').version\") android-snapshot-helper/dist",
|
|
93
|
+
"package:apple-runner:npm": "node scripts/package-apple-runner-source.mjs",
|
|
93
94
|
"build:android-multitouch-helper": "sh ./scripts/build-android-multitouch-helper.sh $(node -p \"require('./package.json').version\") .tmp/android-multitouch-helper",
|
|
94
95
|
"package:android-multitouch-helper": "sh ./scripts/package-android-multitouch-helper.sh $(node -p \"require('./package.json').version\") .tmp/android-multitouch-helper",
|
|
95
96
|
"package:android-multitouch-helper:npm": "rm -rf android-multitouch-helper/dist && sh ./scripts/package-android-multitouch-helper.sh $(node -p \"require('./package.json').version\") android-multitouch-helper/dist",
|
|
96
97
|
"build:macos-helper": "swift build -c release --package-path macos-helper",
|
|
97
98
|
"build:all": "pnpm build:node && pnpm build:xcuitest",
|
|
98
99
|
"ad": "node bin/agent-device.mjs",
|
|
100
|
+
"bench:help-conformance": "node scripts/help-conformance-bench.mjs",
|
|
99
101
|
"size": "node scripts/size-report.mjs",
|
|
100
102
|
"size:markdown": "node scripts/size-report.mjs --json .tmp/size-report.json --markdown .tmp/size-report.md",
|
|
101
103
|
"perf": "node --experimental-strip-types scripts/perf/run.ts",
|
|
102
104
|
"perf:ios": "node --experimental-strip-types scripts/perf/run.ts --platform ios",
|
|
103
105
|
"perf:android": "node --experimental-strip-types scripts/perf/run.ts --platform android",
|
|
104
106
|
"lint": "oxlint . --deny-warnings",
|
|
105
|
-
"format": "node ./node_modules/oxfmt/bin/oxfmt --write src test skills package.json tsconfig.json tsconfig.lib.json
|
|
106
|
-
"format:check": "node ./node_modules/oxfmt/bin/oxfmt --check src test skills package.json tsconfig.json tsconfig.lib.json
|
|
107
|
+
"format": "node ./node_modules/oxfmt/bin/oxfmt --write src test skills package.json tsconfig.json tsconfig.lib.json tsdown.config.ts vitest.config.ts .github/actions/setup-node-pnpm/action.yml .oxlintrc.json .oxfmtrc.json '!test/skillgym/.skillgym-results/**'",
|
|
108
|
+
"format:check": "node ./node_modules/oxfmt/bin/oxfmt --check src test skills package.json tsconfig.json tsconfig.lib.json tsdown.config.ts vitest.config.ts .github/actions/setup-node-pnpm/action.yml .oxlintrc.json .oxfmtrc.json '!test/skillgym/.skillgym-results/**'",
|
|
107
109
|
"fallow": "fallow audit --base origin/main",
|
|
108
110
|
"fallow:all": "fallow --summary",
|
|
109
111
|
"fallow:baseline": "(fallow dead-code --save-baseline fallow-baselines/dead-code.json --summary || true) && (fallow health --save-baseline fallow-baselines/health.json --summary || true)",
|
|
@@ -116,7 +118,7 @@
|
|
|
116
118
|
"check:tooling": "pnpm lint && pnpm typecheck && pnpm check:layering && pnpm check:mcp-metadata && pnpm build",
|
|
117
119
|
"check:unit": "pnpm test:unit && pnpm test:smoke",
|
|
118
120
|
"check": "pnpm check:tooling && pnpm check:fallow && pnpm check:unit",
|
|
119
|
-
"prepack": "pnpm check:mcp-metadata && pnpm build:all && pnpm package:android-snapshot-helper:npm && pnpm package:android-multitouch-helper:npm",
|
|
121
|
+
"prepack": "pnpm check:mcp-metadata && pnpm build:all && pnpm package:apple-runner:npm && pnpm package:android-snapshot-helper:npm && pnpm package:android-multitouch-helper:npm",
|
|
120
122
|
"typecheck": "tsc -p tsconfig.json",
|
|
121
123
|
"test-app:install": "pnpm install --dir examples/test-app --ignore-workspace",
|
|
122
124
|
"test-app:start": "pnpm --dir examples/test-app start",
|
|
@@ -128,8 +130,8 @@
|
|
|
128
130
|
"test-app:maestro": "node scripts/run-test-app-maestro-suite.mjs",
|
|
129
131
|
"test-app:maestro:ios": "node scripts/run-test-app-maestro-suite.mjs --platform ios",
|
|
130
132
|
"test-app:maestro:android": "node scripts/run-test-app-maestro-suite.mjs --platform android",
|
|
131
|
-
"test": "vitest run --project unit",
|
|
132
|
-
"test:unit": "vitest run --project unit",
|
|
133
|
+
"test": "vitest run --project unit-core --project android-adb",
|
|
134
|
+
"test:unit": "vitest run --project unit-core --project android-adb",
|
|
133
135
|
"test:coverage": "vitest run --coverage",
|
|
134
136
|
"test:integration:provider": "vitest run --project provider-integration",
|
|
135
137
|
"test:integration:progress": "node --experimental-strip-types scripts/integration-progress.ts",
|
|
@@ -149,13 +151,6 @@
|
|
|
149
151
|
"files": [
|
|
150
152
|
"bin",
|
|
151
153
|
"dist",
|
|
152
|
-
"apple-runner",
|
|
153
|
-
"!apple-runner/**/.build",
|
|
154
|
-
"!apple-runner/**/.swiftpm",
|
|
155
|
-
"!apple-runner/**/xcuserdata",
|
|
156
|
-
"!apple-runner/**/*.xcuserstate",
|
|
157
|
-
"!apple-runner/README.md",
|
|
158
|
-
"!apple-runner/RUNNER_PROTOCOL.md",
|
|
159
154
|
"macos-helper",
|
|
160
155
|
"!macos-helper/**/.build",
|
|
161
156
|
"android-snapshot-helper/dist",
|
|
@@ -218,16 +213,15 @@
|
|
|
218
213
|
"yaml": "^2.9.0"
|
|
219
214
|
},
|
|
220
215
|
"devDependencies": {
|
|
221
|
-
"@microsoft/api-extractor": "^7.58.8",
|
|
222
|
-
"@rslib/core": "0.22.1",
|
|
223
216
|
"@types/node": "^22.19.21",
|
|
224
|
-
"
|
|
217
|
+
"typescript": "^7.0.2",
|
|
225
218
|
"@vitest/coverage-v8": "4.1.8",
|
|
226
219
|
"fallow": "^2.95.0",
|
|
220
|
+
"oxc-parser": "^0.138.0",
|
|
227
221
|
"oxfmt": "^0.42.0",
|
|
228
222
|
"oxlint": "^1.69.0",
|
|
229
223
|
"skillgym": "^0.9.1",
|
|
230
|
-
"
|
|
224
|
+
"tsdown": "^0.22.4",
|
|
231
225
|
"vite": "^8.0.16",
|
|
232
226
|
"vitest": "^4.1.8"
|
|
233
227
|
}
|
package/server.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"url": "https://github.com/callstack/agent-device",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.19.1",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "agent-device",
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.19.1",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
}
|
|
@@ -13,15 +13,18 @@ agent-device --version
|
|
|
13
13
|
|
|
14
14
|
If that fails but the user may have installed `agent-device` globally, check the user's configured login/interactive shell and environment before using `npx`. Resolve the command the same way the user would from a normal terminal session, then run the absolute binary path if found. This may require inspecting shell startup behavior or package-manager/global bin locations; do not assume the Codex process `PATH` is the user's `PATH`.
|
|
15
15
|
|
|
16
|
-
Require `agent-device >= 0.
|
|
16
|
+
Require `agent-device >= 0.19.1`; older CLIs lack these help topics. If older, stop and tell the user to upgrade the trusted install or approve an exact-version npm command. Do not run `npm install -g agent-device@latest` or `npx -y agent-device@latest` autonomously, and do not include version/upgrade commands in final plans.
|
|
17
17
|
|
|
18
|
-
Before your first agent-device command or plan, read the version-matched CLI guide:
|
|
18
|
+
Before your first agent-device command or plan, read the smallest version-matched CLI guide that fits the task:
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
agent-device help
|
|
21
|
+
agent-device help manual-qa # scripted/manual QA, acceptance checks, checklist execution
|
|
22
|
+
agent-device help validate # code/runtime validation, stale build or daemon risk
|
|
23
|
+
agent-device help dogfood # exploratory app dogfooding and evidence collection
|
|
24
|
+
agent-device help workflow # fallback reference for general app driving or mixed tasks
|
|
22
25
|
```
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
Read additional topics only when relevant:
|
|
25
28
|
|
|
26
29
|
```bash
|
|
27
30
|
agent-device help debugging
|
|
@@ -35,8 +38,6 @@ agent-device help dogfood
|
|
|
35
38
|
|
|
36
39
|
Default loop: `open -> snapshot/-i -> get/is/find or press/fill/scroll/wait -> verify -> close`.
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Use this skill only to route into version-matched CLI help. Let `help workflow` provide exact command shapes, platform limits, and current workflow guidance.
|
|
41
|
+
Use this skill only to route into version-matched CLI help. Let the selected help topic provide exact command shapes, platform limits, and current workflow guidance; use `help workflow` as the full reference when a task-specific topic is too narrow.
|
|
41
42
|
|
|
42
43
|
For precise location workflows, read the installed `settings` help before planning so coordinate support and platform limits come from the active CLI version.
|
package/android-multitouch-helper/dist/agent-device-android-multitouch-helper-0.18.3.apk.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ace47651ae6742d57cae188bf9fc23a24fccc4a19973a051f948f84dbd2ac8f7 agent-device-android-multitouch-helper-0.18.3.apk
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
89d37238a2ff1daeecff94ac48434047d2d9e9e591fb2d97b2901cb937c20ffa agent-device-android-snapshot-helper-0.18.3.apk
|
package/apple-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift
DELETED
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import XCTest
|
|
3
|
-
|
|
4
|
-
enum RunnerCommandLifecycleState: String {
|
|
5
|
-
case notAccepted
|
|
6
|
-
case accepted
|
|
7
|
-
case started
|
|
8
|
-
case completed
|
|
9
|
-
case failed
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
struct RunnerCommandJournalEntry {
|
|
13
|
-
let commandId: String
|
|
14
|
-
let command: String
|
|
15
|
-
var state: RunnerCommandLifecycleState
|
|
16
|
-
var responseOk: Bool?
|
|
17
|
-
var responseJson: String?
|
|
18
|
-
var error: ErrorPayload?
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
final class RunnerCommandJournal {
|
|
22
|
-
private let lock = NSLock()
|
|
23
|
-
private let maxEntries = 64
|
|
24
|
-
private let maxResponseJsonBytes = 16 * 1024
|
|
25
|
-
private var entries: [String: RunnerCommandJournalEntry] = [:]
|
|
26
|
-
private var order: [String] = []
|
|
27
|
-
|
|
28
|
-
func accept(command: Command) {
|
|
29
|
-
guard let commandId = normalizedCommandId(command.commandId) else { return }
|
|
30
|
-
lock.lock()
|
|
31
|
-
defer { lock.unlock() }
|
|
32
|
-
entries[commandId] = RunnerCommandJournalEntry(
|
|
33
|
-
commandId: commandId,
|
|
34
|
-
command: command.command.rawValue,
|
|
35
|
-
state: .accepted,
|
|
36
|
-
responseOk: nil,
|
|
37
|
-
responseJson: nil,
|
|
38
|
-
error: nil
|
|
39
|
-
)
|
|
40
|
-
order.removeAll { $0 == commandId }
|
|
41
|
-
order.append(commandId)
|
|
42
|
-
pruneIfNeeded()
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
func start(command: Command) {
|
|
46
|
-
update(command: command, state: .started, responseOk: nil, responseJson: nil, error: nil)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
func finish(command: Command, response: Response) {
|
|
50
|
-
update(
|
|
51
|
-
command: command,
|
|
52
|
-
state: response.ok ? .completed : .failed,
|
|
53
|
-
responseOk: response.ok,
|
|
54
|
-
responseJson: encodeResponseJson(command: command, response: response),
|
|
55
|
-
error: response.error
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
func fail(command: Command, error: Error) {
|
|
60
|
-
update(
|
|
61
|
-
command: command,
|
|
62
|
-
state: .failed,
|
|
63
|
-
responseOk: nil,
|
|
64
|
-
responseJson: nil,
|
|
65
|
-
error: ErrorPayload(message: error.localizedDescription)
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
func status(commandId: String) -> DataPayload {
|
|
70
|
-
guard let normalized = normalizedCommandId(commandId) else {
|
|
71
|
-
return DataPayload(lifecycleState: RunnerCommandLifecycleState.notAccepted.rawValue)
|
|
72
|
-
}
|
|
73
|
-
lock.lock()
|
|
74
|
-
let entry = entries[normalized]
|
|
75
|
-
lock.unlock()
|
|
76
|
-
guard let entry else {
|
|
77
|
-
return DataPayload(
|
|
78
|
-
commandId: normalized,
|
|
79
|
-
lifecycleState: RunnerCommandLifecycleState.notAccepted.rawValue
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
return DataPayload(
|
|
83
|
-
commandId: entry.commandId,
|
|
84
|
-
lifecycleState: entry.state.rawValue,
|
|
85
|
-
lifecycleCommand: entry.command,
|
|
86
|
-
lifecycleResponseOk: entry.responseOk,
|
|
87
|
-
lifecycleResponseJson: entry.responseJson,
|
|
88
|
-
lifecycleErrorCode: entry.error?.code,
|
|
89
|
-
lifecycleErrorMessage: entry.error?.message,
|
|
90
|
-
lifecycleErrorHint: entry.error?.hint
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
private func update(
|
|
95
|
-
command: Command,
|
|
96
|
-
state: RunnerCommandLifecycleState,
|
|
97
|
-
responseOk: Bool?,
|
|
98
|
-
responseJson: String?,
|
|
99
|
-
error: ErrorPayload?
|
|
100
|
-
) {
|
|
101
|
-
guard let commandId = normalizedCommandId(command.commandId) else { return }
|
|
102
|
-
lock.lock()
|
|
103
|
-
defer { lock.unlock() }
|
|
104
|
-
var entry = entries[commandId] ?? RunnerCommandJournalEntry(
|
|
105
|
-
commandId: commandId,
|
|
106
|
-
command: command.command.rawValue,
|
|
107
|
-
state: .accepted,
|
|
108
|
-
responseOk: nil,
|
|
109
|
-
responseJson: nil,
|
|
110
|
-
error: nil
|
|
111
|
-
)
|
|
112
|
-
entry.state = state
|
|
113
|
-
entry.responseOk = responseOk
|
|
114
|
-
entry.responseJson = responseJson
|
|
115
|
-
entry.error = error
|
|
116
|
-
entries[commandId] = entry
|
|
117
|
-
order.removeAll { $0 == commandId }
|
|
118
|
-
order.append(commandId)
|
|
119
|
-
pruneIfNeeded()
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
private func pruneIfNeeded() {
|
|
123
|
-
while order.count > maxEntries {
|
|
124
|
-
let removed = order.removeFirst()
|
|
125
|
-
entries.removeValue(forKey: removed)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
private func normalizedCommandId(_ value: String?) -> String? {
|
|
130
|
-
guard let value else { return nil }
|
|
131
|
-
let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
132
|
-
return trimmed.isEmpty ? nil : trimmed
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
private func encodeResponseJson(command: Command, response: Response) -> String? {
|
|
136
|
-
guard shouldRetainResponseJson(command: command) else { return nil }
|
|
137
|
-
guard let data = try? JSONEncoder().encode(response) else { return nil }
|
|
138
|
-
guard data.count <= maxResponseJsonBytes else { return nil }
|
|
139
|
-
return String(data: data, encoding: .utf8)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
private func shouldRetainResponseJson(command: Command) -> Bool {
|
|
143
|
-
switch command.command {
|
|
144
|
-
case .snapshot, .screenshot:
|
|
145
|
-
return false
|
|
146
|
-
case .tap, .mouseClick, .longPress, .drag,
|
|
147
|
-
.remotePress, .type, .swipe, .scroll, .desktopScroll, .findText, .querySelector, .readText, .back,
|
|
148
|
-
.backInApp, .backSystem, .home, .rotate, .appSwitcher, .keyboardDismiss, .keyboardReturn,
|
|
149
|
-
.alert, .pinch, .sequence, .rotateGesture, .transformGesture, .recordStart, .recordStop,
|
|
150
|
-
.status, .uptime, .shutdown:
|
|
151
|
-
return true
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
#if AGENT_DEVICE_RUNNER_UNIT_TESTS
|
|
157
|
-
extension RunnerTests {
|
|
158
|
-
func testUptimeBypassesCommandJournal() throws {
|
|
159
|
-
let command = runnerJournalCommand("uptime", id: "uptime-probe")
|
|
160
|
-
|
|
161
|
-
let response = try execute(command: command)
|
|
162
|
-
let status = commandJournal.status(commandId: "uptime-probe")
|
|
163
|
-
|
|
164
|
-
XCTAssertEqual(response.ok, true)
|
|
165
|
-
XCTAssertNotNil(response.data?.currentUptimeMs)
|
|
166
|
-
XCTAssertEqual(status.lifecycleState, RunnerCommandLifecycleState.notAccepted.rawValue)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
func testStampingCurrentUptimePreservesPayload() {
|
|
170
|
-
let stamped = Response(ok: true, data: DataPayload(message: "recording started"))
|
|
171
|
-
.stampingCurrentUptimeMs(123.5)
|
|
172
|
-
|
|
173
|
-
XCTAssertEqual(stamped.ok, true)
|
|
174
|
-
XCTAssertEqual(stamped.data?.message, "recording started")
|
|
175
|
-
XCTAssertEqual(stamped.data?.currentUptimeMs, 123.5)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
func testStampingCurrentUptimeCreatesPayloadWhenNil() {
|
|
179
|
-
let stamped = Response(ok: true).stampingCurrentUptimeMs(456.0)
|
|
180
|
-
|
|
181
|
-
XCTAssertEqual(stamped.ok, true)
|
|
182
|
-
XCTAssertEqual(stamped.data?.currentUptimeMs, 456.0)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
func testStampingCurrentUptimeSkipsErrorResponses() {
|
|
186
|
-
let response = Response(ok: false, error: ErrorPayload(message: "boom"))
|
|
187
|
-
let stamped = response.stampingCurrentUptimeMs(789.0)
|
|
188
|
-
|
|
189
|
-
XCTAssertEqual(stamped.ok, false)
|
|
190
|
-
XCTAssertNil(stamped.data)
|
|
191
|
-
XCTAssertEqual(stamped.error?.message, "boom")
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
func testJournalStoredResponseStaysUnstamped() throws {
|
|
195
|
-
let journal = RunnerCommandJournal()
|
|
196
|
-
let recordStart = runnerJournalCommand("recordStart", id: "record-start-anchor")
|
|
197
|
-
|
|
198
|
-
journal.accept(command: recordStart)
|
|
199
|
-
journal.finish(
|
|
200
|
-
command: recordStart,
|
|
201
|
-
response: Response(ok: true, data: DataPayload(message: "recording started"))
|
|
202
|
-
)
|
|
203
|
-
|
|
204
|
-
let status = journal.status(commandId: "record-start-anchor")
|
|
205
|
-
let responseJson = try XCTUnwrap(status.lifecycleResponseJson)
|
|
206
|
-
XCTAssertFalse(responseJson.contains("currentUptimeMs"))
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
func testCommandJournalRetentionPolicy() throws {
|
|
210
|
-
let journal = RunnerCommandJournal()
|
|
211
|
-
|
|
212
|
-
let uptime = runnerJournalCommand("uptime", id: "small-scalar")
|
|
213
|
-
journal.accept(command: uptime)
|
|
214
|
-
journal.finish(
|
|
215
|
-
command: uptime,
|
|
216
|
-
response: Response(ok: true, data: DataPayload(currentUptimeMs: 12.5))
|
|
217
|
-
)
|
|
218
|
-
|
|
219
|
-
let scalarStatus = journal.status(commandId: "small-scalar")
|
|
220
|
-
XCTAssertEqual(scalarStatus.lifecycleState, RunnerCommandLifecycleState.completed.rawValue)
|
|
221
|
-
XCTAssertEqual(scalarStatus.lifecycleResponseOk, true)
|
|
222
|
-
XCTAssertNotNil(scalarStatus.lifecycleResponseJson)
|
|
223
|
-
let scalarResponse = try decodeRunnerJournalResponse(scalarStatus.lifecycleResponseJson)
|
|
224
|
-
XCTAssertEqual(scalarResponse.data?.currentUptimeMs, 12.5)
|
|
225
|
-
|
|
226
|
-
let querySelector = runnerJournalCommand("querySelector", id: "small-object")
|
|
227
|
-
journal.accept(command: querySelector)
|
|
228
|
-
journal.finish(
|
|
229
|
-
command: querySelector,
|
|
230
|
-
response: Response(ok: true, data: DataPayload(found: true, nodes: [runnerJournalNode()]))
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
let objectStatus = journal.status(commandId: "small-object")
|
|
234
|
-
XCTAssertNotNil(objectStatus.lifecycleResponseJson)
|
|
235
|
-
let objectResponse = try decodeRunnerJournalResponse(objectStatus.lifecycleResponseJson)
|
|
236
|
-
XCTAssertEqual(objectResponse.data?.found, true)
|
|
237
|
-
XCTAssertEqual(objectResponse.data?.nodes?.count, 1)
|
|
238
|
-
|
|
239
|
-
let snapshot = runnerJournalCommand("snapshot", id: "snapshot-tree")
|
|
240
|
-
journal.accept(command: snapshot)
|
|
241
|
-
journal.finish(
|
|
242
|
-
command: snapshot,
|
|
243
|
-
response: Response(ok: true, data: DataPayload(nodes: [runnerJournalNode()], truncated: false))
|
|
244
|
-
)
|
|
245
|
-
|
|
246
|
-
let snapshotStatus = journal.status(commandId: "snapshot-tree")
|
|
247
|
-
XCTAssertEqual(snapshotStatus.lifecycleState, RunnerCommandLifecycleState.completed.rawValue)
|
|
248
|
-
XCTAssertEqual(snapshotStatus.lifecycleResponseOk, true)
|
|
249
|
-
XCTAssertNil(snapshotStatus.lifecycleResponseJson)
|
|
250
|
-
|
|
251
|
-
let screenshot = runnerJournalCommand("screenshot", id: "screenshot-artifact")
|
|
252
|
-
journal.accept(command: screenshot)
|
|
253
|
-
journal.finish(
|
|
254
|
-
command: screenshot,
|
|
255
|
-
response: Response(ok: true, data: DataPayload(message: "tmp/screenshot-1.png"))
|
|
256
|
-
)
|
|
257
|
-
|
|
258
|
-
let screenshotStatus = journal.status(commandId: "screenshot-artifact")
|
|
259
|
-
XCTAssertEqual(screenshotStatus.lifecycleState, RunnerCommandLifecycleState.completed.rawValue)
|
|
260
|
-
XCTAssertEqual(screenshotStatus.lifecycleResponseOk, true)
|
|
261
|
-
XCTAssertNil(screenshotStatus.lifecycleResponseJson)
|
|
262
|
-
|
|
263
|
-
let scroll = runnerJournalCommand("scroll", id: "scroll-drag")
|
|
264
|
-
journal.accept(command: scroll)
|
|
265
|
-
journal.finish(
|
|
266
|
-
command: scroll,
|
|
267
|
-
response: Response(
|
|
268
|
-
ok: true,
|
|
269
|
-
data: DataPayload(
|
|
270
|
-
message: "scrolled",
|
|
271
|
-
gestureStartUptimeMs: 1,
|
|
272
|
-
gestureEndUptimeMs: 2,
|
|
273
|
-
x: 155,
|
|
274
|
-
y: 420,
|
|
275
|
-
x2: 155,
|
|
276
|
-
y2: 301,
|
|
277
|
-
referenceWidth: 300,
|
|
278
|
-
referenceHeight: 600
|
|
279
|
-
)
|
|
280
|
-
)
|
|
281
|
-
)
|
|
282
|
-
|
|
283
|
-
let scrollStatus = journal.status(commandId: "scroll-drag")
|
|
284
|
-
XCTAssertEqual(scrollStatus.lifecycleState, RunnerCommandLifecycleState.completed.rawValue)
|
|
285
|
-
XCTAssertEqual(scrollStatus.lifecycleResponseOk, true)
|
|
286
|
-
XCTAssertNotNil(scrollStatus.lifecycleResponseJson)
|
|
287
|
-
let scrollResponse = try decodeRunnerJournalResponse(scrollStatus.lifecycleResponseJson)
|
|
288
|
-
XCTAssertEqual(scrollResponse.data?.x, 155)
|
|
289
|
-
XCTAssertEqual(scrollResponse.data?.y, 420)
|
|
290
|
-
XCTAssertEqual(scrollResponse.data?.x2, 155)
|
|
291
|
-
XCTAssertEqual(scrollResponse.data?.y2, 301)
|
|
292
|
-
XCTAssertEqual(scrollResponse.data?.referenceWidth, 300)
|
|
293
|
-
XCTAssertEqual(scrollResponse.data?.referenceHeight, 600)
|
|
294
|
-
|
|
295
|
-
let largeRead = runnerJournalCommand("readText", id: "large-read")
|
|
296
|
-
journal.accept(command: largeRead)
|
|
297
|
-
journal.finish(
|
|
298
|
-
command: largeRead,
|
|
299
|
-
response: Response(ok: true, data: DataPayload(text: String(repeating: "x", count: 17 * 1024)))
|
|
300
|
-
)
|
|
301
|
-
|
|
302
|
-
let largeReadStatus = journal.status(commandId: "large-read")
|
|
303
|
-
XCTAssertEqual(largeReadStatus.lifecycleState, RunnerCommandLifecycleState.completed.rawValue)
|
|
304
|
-
XCTAssertEqual(largeReadStatus.lifecycleResponseOk, true)
|
|
305
|
-
XCTAssertNil(largeReadStatus.lifecycleResponseJson)
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
func testCommandJournalKeepsErrorMetadataWhenResponseJsonIsDropped() {
|
|
309
|
-
let journal = RunnerCommandJournal()
|
|
310
|
-
let snapshot = runnerJournalCommand("snapshot", id: "snapshot-error")
|
|
311
|
-
let hint = "Try a smaller read such as snapshot -s <visible label or id> -d 8."
|
|
312
|
-
|
|
313
|
-
journal.accept(command: snapshot)
|
|
314
|
-
journal.finish(
|
|
315
|
-
command: snapshot,
|
|
316
|
-
response: Response(
|
|
317
|
-
ok: false,
|
|
318
|
-
error: ErrorPayload(
|
|
319
|
-
code: "IOS_AX_SNAPSHOT_FAILED",
|
|
320
|
-
message: "iOS XCTest snapshot failed while serializing the accessibility tree.",
|
|
321
|
-
hint: hint
|
|
322
|
-
)
|
|
323
|
-
)
|
|
324
|
-
)
|
|
325
|
-
|
|
326
|
-
let status = journal.status(commandId: "snapshot-error")
|
|
327
|
-
XCTAssertEqual(status.lifecycleState, RunnerCommandLifecycleState.failed.rawValue)
|
|
328
|
-
XCTAssertEqual(status.lifecycleResponseOk, false)
|
|
329
|
-
XCTAssertNil(status.lifecycleResponseJson)
|
|
330
|
-
XCTAssertEqual(status.lifecycleErrorCode, "IOS_AX_SNAPSHOT_FAILED")
|
|
331
|
-
XCTAssertEqual(
|
|
332
|
-
status.lifecycleErrorMessage,
|
|
333
|
-
"iOS XCTest snapshot failed while serializing the accessibility tree."
|
|
334
|
-
)
|
|
335
|
-
XCTAssertEqual(status.lifecycleErrorHint, hint)
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
func testCommandJournalRetainsCompletedSequenceResults() throws {
|
|
339
|
-
let journal = RunnerCommandJournal()
|
|
340
|
-
let sequence = runnerJournalCommand("sequence", id: "sequence-completed")
|
|
341
|
-
let results = (0..<20).map { _ in
|
|
342
|
-
SequenceStepResult(
|
|
343
|
-
ok: true,
|
|
344
|
-
kind: "tap",
|
|
345
|
-
errorCode: nil,
|
|
346
|
-
errorMessage: nil,
|
|
347
|
-
gestureStartUptimeMs: 100,
|
|
348
|
-
gestureEndUptimeMs: 120
|
|
349
|
-
)
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
journal.accept(command: sequence)
|
|
353
|
-
journal.finish(
|
|
354
|
-
command: sequence,
|
|
355
|
-
response: Response(
|
|
356
|
-
ok: true,
|
|
357
|
-
data: DataPayload(
|
|
358
|
-
message: "sequence",
|
|
359
|
-
completedSteps: 20,
|
|
360
|
-
failedStepIndex: nil,
|
|
361
|
-
sequenceResults: results
|
|
362
|
-
)
|
|
363
|
-
)
|
|
364
|
-
)
|
|
365
|
-
|
|
366
|
-
let status = journal.status(commandId: "sequence-completed")
|
|
367
|
-
XCTAssertEqual(status.lifecycleState, RunnerCommandLifecycleState.completed.rawValue)
|
|
368
|
-
XCTAssertEqual(status.lifecycleResponseOk, true)
|
|
369
|
-
let json = try XCTUnwrap(status.lifecycleResponseJson)
|
|
370
|
-
// Worst-case 20-step response must stay under the 16KB journal retention cap.
|
|
371
|
-
XCTAssertLessThan(json.utf8.count, 16 * 1024)
|
|
372
|
-
let decoded = try decodeRunnerJournalResponse(status.lifecycleResponseJson)
|
|
373
|
-
XCTAssertEqual(decoded.data?.completedSteps, 20)
|
|
374
|
-
XCTAssertEqual(decoded.data?.sequenceResults?.count, 20)
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
func testCommandJournalRetainsFailedSequenceResults() throws {
|
|
378
|
-
let journal = RunnerCommandJournal()
|
|
379
|
-
let sequence = runnerJournalCommand("sequence", id: "sequence-failed")
|
|
380
|
-
let longError = String(repeating: "z", count: 200)
|
|
381
|
-
let results: [SequenceStepResult] = [
|
|
382
|
-
SequenceStepResult(ok: true, kind: "tap", errorCode: nil, errorMessage: nil,
|
|
383
|
-
gestureStartUptimeMs: 100, gestureEndUptimeMs: 120),
|
|
384
|
-
SequenceStepResult(ok: true, kind: "tap", errorCode: nil, errorMessage: nil,
|
|
385
|
-
gestureStartUptimeMs: 130, gestureEndUptimeMs: 150),
|
|
386
|
-
SequenceStepResult(ok: false, kind: "drag", errorCode: "UNSUPPORTED_OPERATION",
|
|
387
|
-
errorMessage: longError, gestureStartUptimeMs: 160, gestureEndUptimeMs: 180),
|
|
388
|
-
]
|
|
389
|
-
|
|
390
|
-
journal.accept(command: sequence)
|
|
391
|
-
journal.finish(
|
|
392
|
-
command: sequence,
|
|
393
|
-
response: Response(
|
|
394
|
-
ok: true,
|
|
395
|
-
data: DataPayload(
|
|
396
|
-
message: "sequence",
|
|
397
|
-
completedSteps: 2,
|
|
398
|
-
failedStepIndex: 2,
|
|
399
|
-
sequenceResults: results
|
|
400
|
-
)
|
|
401
|
-
)
|
|
402
|
-
)
|
|
403
|
-
|
|
404
|
-
let status = journal.status(commandId: "sequence-failed")
|
|
405
|
-
XCTAssertEqual(status.lifecycleState, RunnerCommandLifecycleState.completed.rawValue)
|
|
406
|
-
let decoded = try decodeRunnerJournalResponse(status.lifecycleResponseJson)
|
|
407
|
-
XCTAssertEqual(decoded.data?.completedSteps, 2)
|
|
408
|
-
XCTAssertEqual(decoded.data?.failedStepIndex, 2)
|
|
409
|
-
XCTAssertEqual(decoded.data?.sequenceResults?.count, 3)
|
|
410
|
-
XCTAssertEqual(decoded.data?.sequenceResults?[2].ok, false)
|
|
411
|
-
XCTAssertEqual(decoded.data?.sequenceResults?[2].errorCode, "UNSUPPORTED_OPERATION")
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
private func runnerJournalCommand(_ command: String, id: String) -> Command {
|
|
415
|
-
let json = #"{"command":"\#(command)","commandId":"\#(id)"}"#
|
|
416
|
-
return try! JSONDecoder().decode(Command.self, from: Data(json.utf8))
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
private func runnerJournalNode() -> SnapshotNode {
|
|
420
|
-
SnapshotNode(
|
|
421
|
-
index: 0,
|
|
422
|
-
type: "button",
|
|
423
|
-
label: "Continue",
|
|
424
|
-
identifier: "continue",
|
|
425
|
-
value: nil,
|
|
426
|
-
rect: SnapshotRect(x: 10, y: 20, width: 100, height: 44),
|
|
427
|
-
enabled: true,
|
|
428
|
-
focused: nil,
|
|
429
|
-
selected: nil,
|
|
430
|
-
hittable: true,
|
|
431
|
-
depth: 0,
|
|
432
|
-
parentIndex: nil,
|
|
433
|
-
hiddenContentAbove: nil,
|
|
434
|
-
hiddenContentBelow: nil
|
|
435
|
-
)
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
private func decodeRunnerJournalResponse(_ responseJson: String?) throws -> Response {
|
|
439
|
-
let responseJson = try XCTUnwrap(responseJson)
|
|
440
|
-
return try JSONDecoder().decode(Response.self, from: Data(responseJson.utf8))
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
#endif
|