agent-device 0.4.2 → 0.5.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.
- package/README.md +2 -9
- package/dist/src/797.js +1 -1
- package/dist/src/bin.js +5 -5
- package/dist/src/daemon.js +16 -20
- package/package.json +7 -9
- package/skills/agent-device/SKILL.md +3 -6
- package/skills/agent-device/references/permissions.md +3 -15
- package/skills/agent-device/references/snapshot-refs.md +1 -4
- package/dist/bin/axsnapshot +0 -0
- package/ios-runner/AXSnapshot/Package.swift +0 -18
- package/ios-runner/AXSnapshot/Sources/AXSnapshot/main.swift +0 -444
- package/src/__tests__/cli-close.test.ts +0 -155
- package/src/__tests__/cli-help.test.ts +0 -102
- package/src/bin.ts +0 -3
- package/src/cli.ts +0 -305
- package/src/core/__tests__/capabilities.test.ts +0 -75
- package/src/core/__tests__/dispatch-open.test.ts +0 -25
- package/src/core/__tests__/open-target.test.ts +0 -55
- package/src/core/capabilities.ts +0 -57
- package/src/core/dispatch.ts +0 -382
- package/src/core/open-target.ts +0 -27
- package/src/daemon/__tests__/device-ready.test.ts +0 -52
- package/src/daemon/__tests__/is-predicates.test.ts +0 -68
- package/src/daemon/__tests__/selectors.test.ts +0 -261
- package/src/daemon/__tests__/session-routing.test.ts +0 -108
- package/src/daemon/__tests__/session-selector.test.ts +0 -64
- package/src/daemon/__tests__/session-store.test.ts +0 -142
- package/src/daemon/__tests__/snapshot-processing.test.ts +0 -47
- package/src/daemon/action-utils.ts +0 -29
- package/src/daemon/context.ts +0 -48
- package/src/daemon/device-ready.ts +0 -155
- package/src/daemon/handlers/__tests__/find.test.ts +0 -99
- package/src/daemon/handlers/__tests__/interaction.test.ts +0 -22
- package/src/daemon/handlers/__tests__/replay-heal.test.ts +0 -509
- package/src/daemon/handlers/__tests__/session-reinstall.test.ts +0 -219
- package/src/daemon/handlers/__tests__/session.test.ts +0 -820
- package/src/daemon/handlers/__tests__/snapshot-handler.test.ts +0 -92
- package/src/daemon/handlers/__tests__/snapshot.test.ts +0 -128
- package/src/daemon/handlers/find.ts +0 -324
- package/src/daemon/handlers/interaction.ts +0 -550
- package/src/daemon/handlers/parse-utils.ts +0 -8
- package/src/daemon/handlers/record-trace.ts +0 -154
- package/src/daemon/handlers/session.ts +0 -1137
- package/src/daemon/handlers/snapshot.ts +0 -439
- package/src/daemon/is-predicates.ts +0 -46
- package/src/daemon/selectors.ts +0 -540
- package/src/daemon/session-routing.ts +0 -22
- package/src/daemon/session-selector.ts +0 -39
- package/src/daemon/session-store.ts +0 -296
- package/src/daemon/snapshot-processing.ts +0 -131
- package/src/daemon/types.ts +0 -56
- package/src/daemon-client.ts +0 -272
- package/src/daemon.ts +0 -295
- package/src/platforms/__tests__/boot-diagnostics.test.ts +0 -59
- package/src/platforms/android/__tests__/index.test.ts +0 -274
- package/src/platforms/android/devices.ts +0 -196
- package/src/platforms/android/index.ts +0 -784
- package/src/platforms/android/ui-hierarchy.ts +0 -312
- package/src/platforms/boot-diagnostics.ts +0 -128
- package/src/platforms/ios/__tests__/index.test.ts +0 -312
- package/src/platforms/ios/__tests__/runner-client.test.ts +0 -155
- package/src/platforms/ios/apps.ts +0 -358
- package/src/platforms/ios/ax-snapshot.ts +0 -207
- package/src/platforms/ios/config.ts +0 -28
- package/src/platforms/ios/devicectl.ts +0 -134
- package/src/platforms/ios/devices.ts +0 -100
- package/src/platforms/ios/index.ts +0 -20
- package/src/platforms/ios/runner-client.ts +0 -994
- package/src/platforms/ios/simulator.ts +0 -164
- package/src/utils/__tests__/args.test.ts +0 -239
- package/src/utils/__tests__/daemon-client.test.ts +0 -95
- package/src/utils/__tests__/exec.test.ts +0 -16
- package/src/utils/__tests__/finders.test.ts +0 -34
- package/src/utils/__tests__/keyed-lock.test.ts +0 -55
- package/src/utils/__tests__/process-identity.test.ts +0 -33
- package/src/utils/__tests__/retry.test.ts +0 -44
- package/src/utils/args.ts +0 -239
- package/src/utils/command-schema.ts +0 -622
- package/src/utils/device.ts +0 -84
- package/src/utils/errors.ts +0 -35
- package/src/utils/exec.ts +0 -339
- package/src/utils/finders.ts +0 -101
- package/src/utils/interactive.ts +0 -4
- package/src/utils/interactors.ts +0 -173
- package/src/utils/keyed-lock.ts +0 -14
- package/src/utils/output.ts +0 -204
- package/src/utils/process-identity.ts +0 -100
- package/src/utils/retry.ts +0 -180
- package/src/utils/snapshot.ts +0 -64
- package/src/utils/timeouts.ts +0 -9
- package/src/utils/version.ts +0 -26
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { promises as fs } from 'node:fs';
|
|
4
|
-
import os from 'node:os';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { listIosApps, openIosApp, parseIosDeviceAppsPayload, resolveIosApp } from '../index.ts';
|
|
7
|
-
import type { DeviceInfo } from '../../../utils/device.ts';
|
|
8
|
-
import { AppError } from '../../../utils/errors.ts';
|
|
9
|
-
|
|
10
|
-
test('openIosApp custom scheme deep links on iOS devices require app bundle context', async () => {
|
|
11
|
-
const device: DeviceInfo = {
|
|
12
|
-
platform: 'ios',
|
|
13
|
-
id: 'ios-device-1',
|
|
14
|
-
name: 'iPhone Device',
|
|
15
|
-
kind: 'device',
|
|
16
|
-
booted: true,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
await assert.rejects(
|
|
20
|
-
() => openIosApp(device, 'myapp://home'),
|
|
21
|
-
(error: unknown) => {
|
|
22
|
-
assert.equal(error instanceof AppError, true);
|
|
23
|
-
assert.equal((error as AppError).code, 'INVALID_ARGS');
|
|
24
|
-
return true;
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('openIosApp web URL on iOS device without app falls back to Safari', async () => {
|
|
30
|
-
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'agent-device-ios-safari-test-'));
|
|
31
|
-
const xcrunPath = path.join(tmpDir, 'xcrun');
|
|
32
|
-
const argsLogPath = path.join(tmpDir, 'args.log');
|
|
33
|
-
await fs.writeFile(
|
|
34
|
-
xcrunPath,
|
|
35
|
-
'#!/bin/sh\nprintf "%s\\n" "$@" > "$AGENT_DEVICE_TEST_ARGS_FILE"\nexit 0\n',
|
|
36
|
-
'utf8',
|
|
37
|
-
);
|
|
38
|
-
await fs.chmod(xcrunPath, 0o755);
|
|
39
|
-
|
|
40
|
-
const previousPath = process.env.PATH;
|
|
41
|
-
const previousArgsFile = process.env.AGENT_DEVICE_TEST_ARGS_FILE;
|
|
42
|
-
process.env.PATH = `${tmpDir}${path.delimiter}${previousPath ?? ''}`;
|
|
43
|
-
process.env.AGENT_DEVICE_TEST_ARGS_FILE = argsLogPath;
|
|
44
|
-
|
|
45
|
-
const device: DeviceInfo = {
|
|
46
|
-
platform: 'ios',
|
|
47
|
-
id: 'ios-device-1',
|
|
48
|
-
name: 'iPhone Device',
|
|
49
|
-
kind: 'device',
|
|
50
|
-
booted: true,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
try {
|
|
54
|
-
await openIosApp(device, 'https://example.com/path');
|
|
55
|
-
const args = (await fs.readFile(argsLogPath, 'utf8'))
|
|
56
|
-
.trim()
|
|
57
|
-
.split('\n')
|
|
58
|
-
.filter(Boolean);
|
|
59
|
-
assert.deepEqual(args, [
|
|
60
|
-
'devicectl',
|
|
61
|
-
'device',
|
|
62
|
-
'process',
|
|
63
|
-
'launch',
|
|
64
|
-
'--device',
|
|
65
|
-
'ios-device-1',
|
|
66
|
-
'com.apple.mobilesafari',
|
|
67
|
-
'--payload-url',
|
|
68
|
-
'https://example.com/path',
|
|
69
|
-
]);
|
|
70
|
-
} finally {
|
|
71
|
-
process.env.PATH = previousPath;
|
|
72
|
-
if (previousArgsFile === undefined) {
|
|
73
|
-
delete process.env.AGENT_DEVICE_TEST_ARGS_FILE;
|
|
74
|
-
} else {
|
|
75
|
-
process.env.AGENT_DEVICE_TEST_ARGS_FILE = previousArgsFile;
|
|
76
|
-
}
|
|
77
|
-
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test('openIosApp custom scheme on iOS device uses active app context', async () => {
|
|
82
|
-
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'agent-device-ios-openurl-test-'));
|
|
83
|
-
const xcrunPath = path.join(tmpDir, 'xcrun');
|
|
84
|
-
const argsLogPath = path.join(tmpDir, 'args.log');
|
|
85
|
-
await fs.writeFile(
|
|
86
|
-
xcrunPath,
|
|
87
|
-
'#!/bin/sh\nprintf "%s\\n" "$@" > "$AGENT_DEVICE_TEST_ARGS_FILE"\nexit 0\n',
|
|
88
|
-
'utf8',
|
|
89
|
-
);
|
|
90
|
-
await fs.chmod(xcrunPath, 0o755);
|
|
91
|
-
|
|
92
|
-
const previousPath = process.env.PATH;
|
|
93
|
-
const previousArgsFile = process.env.AGENT_DEVICE_TEST_ARGS_FILE;
|
|
94
|
-
process.env.PATH = `${tmpDir}${path.delimiter}${previousPath ?? ''}`;
|
|
95
|
-
process.env.AGENT_DEVICE_TEST_ARGS_FILE = argsLogPath;
|
|
96
|
-
|
|
97
|
-
const device: DeviceInfo = {
|
|
98
|
-
platform: 'ios',
|
|
99
|
-
id: 'ios-device-1',
|
|
100
|
-
name: 'iPhone Device',
|
|
101
|
-
kind: 'device',
|
|
102
|
-
booted: true,
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
await openIosApp(device, 'myapp://item/42', { appBundleId: 'com.example.app' });
|
|
107
|
-
const args = (await fs.readFile(argsLogPath, 'utf8'))
|
|
108
|
-
.trim()
|
|
109
|
-
.split('\n')
|
|
110
|
-
.filter(Boolean);
|
|
111
|
-
assert.deepEqual(args, [
|
|
112
|
-
'devicectl',
|
|
113
|
-
'device',
|
|
114
|
-
'process',
|
|
115
|
-
'launch',
|
|
116
|
-
'--device',
|
|
117
|
-
'ios-device-1',
|
|
118
|
-
'com.example.app',
|
|
119
|
-
'--payload-url',
|
|
120
|
-
'myapp://item/42',
|
|
121
|
-
]);
|
|
122
|
-
} finally {
|
|
123
|
-
process.env.PATH = previousPath;
|
|
124
|
-
if (previousArgsFile === undefined) {
|
|
125
|
-
delete process.env.AGENT_DEVICE_TEST_ARGS_FILE;
|
|
126
|
-
} else {
|
|
127
|
-
process.env.AGENT_DEVICE_TEST_ARGS_FILE = previousArgsFile;
|
|
128
|
-
}
|
|
129
|
-
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
test('openIosApp with app and URL on iOS device launches app bundle with payload URL', async () => {
|
|
134
|
-
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'agent-device-ios-open-app-url-test-'));
|
|
135
|
-
const xcrunPath = path.join(tmpDir, 'xcrun');
|
|
136
|
-
const argsLogPath = path.join(tmpDir, 'args.log');
|
|
137
|
-
await fs.writeFile(
|
|
138
|
-
xcrunPath,
|
|
139
|
-
'#!/bin/sh\nprintf "%s\\n" "$@" > "$AGENT_DEVICE_TEST_ARGS_FILE"\nexit 0\n',
|
|
140
|
-
'utf8',
|
|
141
|
-
);
|
|
142
|
-
await fs.chmod(xcrunPath, 0o755);
|
|
143
|
-
|
|
144
|
-
const previousPath = process.env.PATH;
|
|
145
|
-
const previousArgsFile = process.env.AGENT_DEVICE_TEST_ARGS_FILE;
|
|
146
|
-
process.env.PATH = `${tmpDir}${path.delimiter}${previousPath ?? ''}`;
|
|
147
|
-
process.env.AGENT_DEVICE_TEST_ARGS_FILE = argsLogPath;
|
|
148
|
-
|
|
149
|
-
const device: DeviceInfo = {
|
|
150
|
-
platform: 'ios',
|
|
151
|
-
id: 'ios-device-1',
|
|
152
|
-
name: 'iPhone Device',
|
|
153
|
-
kind: 'device',
|
|
154
|
-
booted: true,
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
try {
|
|
158
|
-
await openIosApp(device, 'MyApp', { appBundleId: 'com.example.app', url: 'myapp://screen/to' });
|
|
159
|
-
const args = (await fs.readFile(argsLogPath, 'utf8'))
|
|
160
|
-
.trim()
|
|
161
|
-
.split('\n')
|
|
162
|
-
.filter(Boolean);
|
|
163
|
-
assert.deepEqual(args, [
|
|
164
|
-
'devicectl',
|
|
165
|
-
'device',
|
|
166
|
-
'process',
|
|
167
|
-
'launch',
|
|
168
|
-
'--device',
|
|
169
|
-
'ios-device-1',
|
|
170
|
-
'com.example.app',
|
|
171
|
-
'--payload-url',
|
|
172
|
-
'myapp://screen/to',
|
|
173
|
-
]);
|
|
174
|
-
} finally {
|
|
175
|
-
process.env.PATH = previousPath;
|
|
176
|
-
if (previousArgsFile === undefined) {
|
|
177
|
-
delete process.env.AGENT_DEVICE_TEST_ARGS_FILE;
|
|
178
|
-
} else {
|
|
179
|
-
process.env.AGENT_DEVICE_TEST_ARGS_FILE = previousArgsFile;
|
|
180
|
-
}
|
|
181
|
-
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
test('parseIosDeviceAppsPayload maps devicectl app entries', () => {
|
|
186
|
-
const apps = parseIosDeviceAppsPayload({
|
|
187
|
-
result: {
|
|
188
|
-
apps: [
|
|
189
|
-
{
|
|
190
|
-
bundleIdentifier: 'com.apple.Maps',
|
|
191
|
-
name: 'Maps',
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
bundleIdentifier: 'com.example.NoName',
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
assert.equal(apps.length, 2);
|
|
201
|
-
assert.deepEqual(apps[0], {
|
|
202
|
-
bundleId: 'com.apple.Maps',
|
|
203
|
-
name: 'Maps',
|
|
204
|
-
});
|
|
205
|
-
assert.equal(apps[1].bundleId, 'com.example.NoName');
|
|
206
|
-
assert.equal(apps[1].name, 'com.example.NoName');
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test('parseIosDeviceAppsPayload ignores malformed entries', () => {
|
|
210
|
-
const apps = parseIosDeviceAppsPayload({
|
|
211
|
-
result: {
|
|
212
|
-
apps: [
|
|
213
|
-
null,
|
|
214
|
-
{},
|
|
215
|
-
{ name: 'Missing bundle id' },
|
|
216
|
-
{ bundleIdentifier: '' },
|
|
217
|
-
],
|
|
218
|
-
},
|
|
219
|
-
});
|
|
220
|
-
assert.deepEqual(apps, []);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
test('resolveIosApp resolves app display name on iOS physical devices', async () => {
|
|
224
|
-
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'agent-device-ios-app-resolve-'));
|
|
225
|
-
const xcrunPath = path.join(tmpDir, 'xcrun');
|
|
226
|
-
await fs.writeFile(
|
|
227
|
-
xcrunPath,
|
|
228
|
-
[
|
|
229
|
-
'#!/bin/sh',
|
|
230
|
-
'if [ "$1" = "devicectl" ] && [ "$2" = "device" ] && [ "$3" = "info" ] && [ "$4" = "apps" ]; then',
|
|
231
|
-
' out=""',
|
|
232
|
-
' while [ "$#" -gt 0 ]; do',
|
|
233
|
-
' if [ "$1" = "--json-output" ]; then',
|
|
234
|
-
' out="$2"',
|
|
235
|
-
' shift 2',
|
|
236
|
-
' continue',
|
|
237
|
-
' fi',
|
|
238
|
-
' shift',
|
|
239
|
-
' done',
|
|
240
|
-
" cat > \"$out\" <<'JSON'",
|
|
241
|
-
'{"result":{"apps":[{"bundleIdentifier":"com.apple.Maps","name":"Maps"},{"bundleIdentifier":"com.example.demo","name":"Demo"}]}}',
|
|
242
|
-
'JSON',
|
|
243
|
-
' exit 0',
|
|
244
|
-
'fi',
|
|
245
|
-
'echo "unexpected xcrun args: $@" >&2',
|
|
246
|
-
'exit 1',
|
|
247
|
-
'',
|
|
248
|
-
].join('\n'),
|
|
249
|
-
'utf8',
|
|
250
|
-
);
|
|
251
|
-
await fs.chmod(xcrunPath, 0o755);
|
|
252
|
-
|
|
253
|
-
const previousPath = process.env.PATH;
|
|
254
|
-
process.env.PATH = `${tmpDir}${path.delimiter}${previousPath ?? ''}`;
|
|
255
|
-
|
|
256
|
-
const device: DeviceInfo = {
|
|
257
|
-
platform: 'ios',
|
|
258
|
-
id: 'ios-device-1',
|
|
259
|
-
name: 'iPhone Device',
|
|
260
|
-
kind: 'device',
|
|
261
|
-
booted: true,
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
try {
|
|
265
|
-
const bundleId = await resolveIosApp(device, 'Maps');
|
|
266
|
-
assert.equal(bundleId, 'com.apple.Maps');
|
|
267
|
-
} finally {
|
|
268
|
-
process.env.PATH = previousPath;
|
|
269
|
-
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
test('listIosApps applies user-installed filter on simulator', async () => {
|
|
274
|
-
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'agent-device-ios-list-sim-'));
|
|
275
|
-
const xcrunPath = path.join(tmpDir, 'xcrun');
|
|
276
|
-
await fs.writeFile(
|
|
277
|
-
xcrunPath,
|
|
278
|
-
[
|
|
279
|
-
'#!/bin/sh',
|
|
280
|
-
'if [ "$1" = "simctl" ] && [ "$2" = "listapps" ]; then',
|
|
281
|
-
" cat <<'JSON'",
|
|
282
|
-
'{"com.apple.Maps":{"CFBundleDisplayName":"Maps"},"com.example.demo":{"CFBundleDisplayName":"Demo"}}',
|
|
283
|
-
'JSON',
|
|
284
|
-
' exit 0',
|
|
285
|
-
'fi',
|
|
286
|
-
'echo "unexpected xcrun args: $@" >&2',
|
|
287
|
-
'exit 1',
|
|
288
|
-
'',
|
|
289
|
-
].join('\n'),
|
|
290
|
-
'utf8',
|
|
291
|
-
);
|
|
292
|
-
await fs.chmod(xcrunPath, 0o755);
|
|
293
|
-
|
|
294
|
-
const previousPath = process.env.PATH;
|
|
295
|
-
process.env.PATH = `${tmpDir}${path.delimiter}${previousPath ?? ''}`;
|
|
296
|
-
|
|
297
|
-
const device: DeviceInfo = {
|
|
298
|
-
platform: 'ios',
|
|
299
|
-
id: 'sim-1',
|
|
300
|
-
name: 'iPhone Sim',
|
|
301
|
-
kind: 'simulator',
|
|
302
|
-
booted: true,
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
try {
|
|
306
|
-
const apps = await listIosApps(device, 'user-installed');
|
|
307
|
-
assert.deepEqual(apps, [{ bundleId: 'com.example.demo', name: 'Demo' }]);
|
|
308
|
-
} finally {
|
|
309
|
-
process.env.PATH = previousPath;
|
|
310
|
-
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
311
|
-
}
|
|
312
|
-
});
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import type { DeviceInfo } from '../../../utils/device.ts';
|
|
4
|
-
import { AppError } from '../../../utils/errors.ts';
|
|
5
|
-
import {
|
|
6
|
-
assertSafeDerivedCleanup,
|
|
7
|
-
isRetryableRunnerError,
|
|
8
|
-
resolveRunnerEarlyExitHint,
|
|
9
|
-
resolveRunnerBuildDestination,
|
|
10
|
-
resolveRunnerDestination,
|
|
11
|
-
resolveRunnerMaxConcurrentDestinationsFlag,
|
|
12
|
-
resolveRunnerSigningBuildSettings,
|
|
13
|
-
shouldRetryRunnerConnectError,
|
|
14
|
-
} from '../runner-client.ts';
|
|
15
|
-
|
|
16
|
-
const iosSimulator: DeviceInfo = {
|
|
17
|
-
platform: 'ios',
|
|
18
|
-
id: 'sim-1',
|
|
19
|
-
name: 'iPhone Simulator',
|
|
20
|
-
kind: 'simulator',
|
|
21
|
-
booted: true,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const iosDevice: DeviceInfo = {
|
|
25
|
-
platform: 'ios',
|
|
26
|
-
id: '00008110-000E12341234002E',
|
|
27
|
-
name: 'iPhone',
|
|
28
|
-
kind: 'device',
|
|
29
|
-
booted: true,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
test('resolveRunnerDestination uses simulator destination for simulators', () => {
|
|
33
|
-
assert.equal(resolveRunnerDestination(iosSimulator), 'platform=iOS Simulator,id=sim-1');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('resolveRunnerDestination uses device destination for physical devices', () => {
|
|
37
|
-
assert.equal(
|
|
38
|
-
resolveRunnerDestination(iosDevice),
|
|
39
|
-
'platform=iOS,id=00008110-000E12341234002E',
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('resolveRunnerBuildDestination uses generic iOS destination for physical devices', () => {
|
|
44
|
-
assert.equal(resolveRunnerBuildDestination(iosDevice), 'generic/platform=iOS');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('resolveRunnerMaxConcurrentDestinationsFlag uses simulator flag for simulators', () => {
|
|
48
|
-
assert.equal(
|
|
49
|
-
resolveRunnerMaxConcurrentDestinationsFlag(iosSimulator),
|
|
50
|
-
'-maximum-concurrent-test-simulator-destinations',
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test('resolveRunnerMaxConcurrentDestinationsFlag uses device flag for physical devices', () => {
|
|
55
|
-
assert.equal(
|
|
56
|
-
resolveRunnerMaxConcurrentDestinationsFlag(iosDevice),
|
|
57
|
-
'-maximum-concurrent-test-device-destinations',
|
|
58
|
-
);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test('resolveRunnerSigningBuildSettings returns empty args without env overrides', () => {
|
|
62
|
-
assert.deepEqual(resolveRunnerSigningBuildSettings({}), []);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('resolveRunnerSigningBuildSettings enables automatic signing for device builds without forcing identity', () => {
|
|
66
|
-
assert.deepEqual(resolveRunnerSigningBuildSettings({}, true), [
|
|
67
|
-
'CODE_SIGN_STYLE=Automatic',
|
|
68
|
-
]);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('resolveRunnerSigningBuildSettings ignores device signing overrides for simulator builds', () => {
|
|
72
|
-
assert.deepEqual(resolveRunnerSigningBuildSettings({
|
|
73
|
-
AGENT_DEVICE_IOS_TEAM_ID: 'ABCDE12345',
|
|
74
|
-
AGENT_DEVICE_IOS_SIGNING_IDENTITY: 'Apple Development',
|
|
75
|
-
AGENT_DEVICE_IOS_PROVISIONING_PROFILE: 'My Profile',
|
|
76
|
-
}, false), []);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('resolveRunnerSigningBuildSettings applies optional overrides when provided', () => {
|
|
80
|
-
const settings = resolveRunnerSigningBuildSettings({
|
|
81
|
-
AGENT_DEVICE_IOS_TEAM_ID: 'ABCDE12345',
|
|
82
|
-
AGENT_DEVICE_IOS_SIGNING_IDENTITY: 'Apple Development',
|
|
83
|
-
AGENT_DEVICE_IOS_PROVISIONING_PROFILE: 'My Profile',
|
|
84
|
-
}, true);
|
|
85
|
-
assert.deepEqual(settings, [
|
|
86
|
-
'CODE_SIGN_STYLE=Automatic',
|
|
87
|
-
'DEVELOPMENT_TEAM=ABCDE12345',
|
|
88
|
-
'CODE_SIGN_IDENTITY=Apple Development',
|
|
89
|
-
'PROVISIONING_PROFILE_SPECIFIER=My Profile',
|
|
90
|
-
]);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test('assertSafeDerivedCleanup allows cleaning when no override is set', () => {
|
|
94
|
-
assert.doesNotThrow(() => {
|
|
95
|
-
assertSafeDerivedCleanup('/tmp/derived', {});
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
test('assertSafeDerivedCleanup rejects cleaning override path by default', () => {
|
|
100
|
-
assert.throws(
|
|
101
|
-
() => {
|
|
102
|
-
assertSafeDerivedCleanup('/tmp/custom', {
|
|
103
|
-
AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH: '/tmp/custom',
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
|
-
/Refusing to clean AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH automatically/,
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
test('assertSafeDerivedCleanup allows cleaning override path with explicit opt-in', () => {
|
|
111
|
-
assert.doesNotThrow(() => {
|
|
112
|
-
assertSafeDerivedCleanup('/tmp/custom', {
|
|
113
|
-
AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH: '/tmp/custom',
|
|
114
|
-
AGENT_DEVICE_IOS_ALLOW_OVERRIDE_DERIVED_CLEAN: '1',
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test('resolveRunnerEarlyExitHint surfaces busy-connecting guidance', () => {
|
|
120
|
-
const hint = resolveRunnerEarlyExitHint(
|
|
121
|
-
'Runner did not accept connection (xcodebuild exited early)',
|
|
122
|
-
'Ineligible destinations for the "AgentDeviceRunner" scheme:\n{ error:Device is busy (Connecting to iPhone) }',
|
|
123
|
-
'',
|
|
124
|
-
);
|
|
125
|
-
assert.match(hint, /still connecting/i);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
test('resolveRunnerEarlyExitHint falls back to runner connect timeout hint', () => {
|
|
129
|
-
const hint = resolveRunnerEarlyExitHint(
|
|
130
|
-
'Runner did not accept connection (xcodebuild exited early)',
|
|
131
|
-
'',
|
|
132
|
-
'xcodebuild failed unexpectedly',
|
|
133
|
-
);
|
|
134
|
-
assert.match(hint, /retry runner startup/i);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
test('shouldRetryRunnerConnectError does not retry xcodebuild early-exit errors', () => {
|
|
138
|
-
const err = new AppError('COMMAND_FAILED', 'Runner did not accept connection (xcodebuild exited early)');
|
|
139
|
-
assert.equal(shouldRetryRunnerConnectError(err), false);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
test('shouldRetryRunnerConnectError retries transient connect errors', () => {
|
|
143
|
-
const err = new AppError('COMMAND_FAILED', 'Runner endpoint probe failed');
|
|
144
|
-
assert.equal(shouldRetryRunnerConnectError(err), true);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
test('isRetryableRunnerError does not retry xcodebuild early-exit errors', () => {
|
|
148
|
-
const err = new AppError('COMMAND_FAILED', 'Runner did not accept connection (xcodebuild exited early)');
|
|
149
|
-
assert.equal(isRetryableRunnerError(err), false);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
test('isRetryableRunnerError does not retry busy-connecting errors', () => {
|
|
153
|
-
const err = new AppError('COMMAND_FAILED', 'Device is busy (Connecting to iPhone)');
|
|
154
|
-
assert.equal(isRetryableRunnerError(err), false);
|
|
155
|
-
});
|