zeno-mobile-runner 0.2.9 → 0.2.11
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/CHANGELOG.md +19 -0
- package/FEATURES.md +1 -1
- package/README.md +1 -1
- package/clients/kotlin/README.md +1 -1
- package/clients/kotlin/build.gradle.kts +1 -1
- package/clients/python/pyproject.toml +1 -1
- package/clients/rust/Cargo.lock +1 -1
- package/clients/rust/Cargo.toml +1 -1
- package/clients/typescript/package.json +1 -1
- package/docs/protocol-fixtures/core-session.responses.jsonl +1 -1
- package/docs/protocol.md +10 -10
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/zmr +0 -0
- package/prebuilds/darwin-x64/zmr +0 -0
- package/prebuilds/linux-arm64/zmr +0 -0
- package/prebuilds/linux-x64/zmr +0 -0
- package/shims/ios/ZMRShim.swift +11 -2
- package/src/runner.zig +82 -0
- package/src/runner_waits.zig +23 -15
- package/src/version.zig +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ All notable changes to Zeno Mobile Runner are tracked here.
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
## 0.2.11 (2026-06-22)
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- iOS `assertHealthy` now retries transient native health-probe failures within
|
|
12
|
+
the assertion timeout and gives XCTest selector queries enough per-probe
|
|
13
|
+
budget to complete on real simulator runs. This avoids falling back to broad
|
|
14
|
+
snapshots after short health-probe timeouts, which could fail otherwise healthy
|
|
15
|
+
Expo dev-client flows.
|
|
16
|
+
|
|
17
|
+
## 0.2.10 (2026-06-18)
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- iOS snapshots now include identifier-bearing `XCUIElementTypeOther` nodes.
|
|
22
|
+
This lets `scrollUntilVisible`, waits, and assertions see React Native
|
|
23
|
+
`testID`/accessibility identifiers that XCTest exposes as `Other` elements
|
|
24
|
+
without flooding traces with unlabeled layout containers.
|
|
25
|
+
|
|
7
26
|
## 0.2.9 (2026-06-17)
|
|
8
27
|
|
|
9
28
|
### Fixed
|
package/FEATURES.md
CHANGED
|
@@ -142,7 +142,7 @@ state, and writes deterministic traces. It does not embed an LLM.
|
|
|
142
142
|
|
|
143
143
|
## Current Limitations
|
|
144
144
|
|
|
145
|
-
- Current release status is `0.2.
|
|
145
|
+
- Current release status is `0.2.11`, a public developer preview rather than
|
|
146
146
|
a production-stable `1.0.0`.
|
|
147
147
|
- Physical iOS log capture is still simulator-first. Physical iOS screenshots
|
|
148
148
|
are available when the XCTest/XCUIAutomation shim is configured.
|
package/README.md
CHANGED
|
@@ -197,7 +197,7 @@ comparisons against your current E2E tool, and multi-device matrices, see
|
|
|
197
197
|
| Cloud device farms | Not included | ZMR focuses on local and self-managed device targets in this preview |
|
|
198
198
|
|
|
199
199
|
Slow CI hardware can extend the iOS shim cold-build timeout with
|
|
200
|
-
`ZMR_IOS_SHIM_TIMEOUT_MS`. Current release: `0.2.
|
|
200
|
+
`ZMR_IOS_SHIM_TIMEOUT_MS`. Current release: `0.2.11` developer preview.
|
|
201
201
|
Protocol version: `2026-04-28`.
|
|
202
202
|
|
|
203
203
|
## Optional protocol clients
|
package/clients/kotlin/README.md
CHANGED
|
@@ -27,7 +27,7 @@ gradle -p clients/kotlin runFakeSession \
|
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
```kotlin
|
|
30
|
-
implementation(files("path/to/zeno-mobile-runner/clients/kotlin/build/libs/zmr-client-0.2.
|
|
30
|
+
implementation(files("path/to/zeno-mobile-runner/clients/kotlin/build/libs/zmr-client-0.2.11.jar"))
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
```kotlin
|
package/clients/rust/Cargo.lock
CHANGED
package/clients/rust/Cargo.toml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{"jsonrpc":"2.0","id":1,"result":{"name":"zmr","version":"0.2.
|
|
1
|
+
{"jsonrpc":"2.0","id":1,"result":{"name":"zmr","version":"0.2.11","protocolVersion":"2026-04-28","protocol":{"version":"2026-04-28","minimumCompatibleVersion":"2026-04-28","stability":"dev-preview","breakingChangePolicy":"version-and-changelog"},"platforms":["android","ios"],"platformSupport":{"android":{"status":"supported","deviceTypes":["emulator","physical"],"automation":["adb","uiautomator","android-shim"]},"ios":{"status":"supported","deviceTypes":["simulator","physical"],"automation":["simctl","devicectl","xctest-shim"],"physicalDevices":true}},"iosPreview":false,"transports":["stdio","tcp"],"methods":["runner.capabilities","device.list","session.create","session.close","app.install","app.launch","app.stop","app.openLink","app.clearState","observe.snapshot","observe.semanticSnapshot","ui.tap","ui.type","ui.eraseText","ui.hideKeyboard","ui.swipe","ui.pressBack","ui.scrollUntilVisible","wait.until","wait.any","wait.gone","assert.visible","assert.notVisible","assert.healthy","scenario.validate","trace.events","trace.explore","trace.discover","trace.explain","trace.export"]}}
|
|
2
2
|
{"jsonrpc":"2.0","id":2,"result":[{"serial":"fake-device-1","state":"device","ready":true}]}
|
|
3
3
|
{"jsonrpc":"2.0","id":3,"result":{"sessionId":"default"}}
|
|
4
4
|
{"jsonrpc":"2.0","id":4,"result":true}
|
package/docs/protocol.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
ZMR exposes newline-delimited JSON-RPC 2.0 over stdio or localhost TCP in v1. Each request is one JSON object followed by `\n`. Each response is one JSON object followed by `\n`.
|
|
4
4
|
|
|
5
|
-
Current runner version: `0.2.
|
|
5
|
+
Current runner version: `0.2.11`.
|
|
6
6
|
|
|
7
7
|
Current protocol version: `2026-04-28`.
|
|
8
8
|
|
|
@@ -47,7 +47,7 @@ and protocol versions. The response is covered by
|
|
|
47
47
|
`schemas/inspect-output.schema.json`:
|
|
48
48
|
|
|
49
49
|
```json
|
|
50
|
-
{"ok":true,"status":"ready","schemaVersion":1,"runnerVersion":"0.2.
|
|
50
|
+
{"ok":true,"status":"ready","schemaVersion":1,"runnerVersion":"0.2.11","protocolVersion":"2026-04-28","dir":".","configPath":".zmr/config.json","configExists":true,"agentInstructionsPath":".zmr/AGENTS.md","agentInstructionsExists":true,"platforms":[{"name":"android","enabled":true,"defaultDevice":"emulator-5554","smokeScenario":".zmr/android-smoke.json","smokeScenarioExists":true,"traceDir":"traces/zmr-android"},{"name":"ios","enabled":true,"defaultDevice":"booted","smokeScenario":".zmr/ios-smoke.json","smokeScenarioExists":true,"traceDir":"traces/zmr-ios"}],"recommendedCommands":["zmr doctor --strict --json --config .zmr/config.json","zmr schemas --json","zmr validate --json .zmr/android-smoke.json","zmr validate --json .zmr/ios-smoke.json","zmr serve --transport stdio --config .zmr/config.json --trace-dir traces/zmr-agent","zmr mcp --config .zmr/config.json --trace-dir traces/zmr-agent"],"claimsPolicy":["verify runs with trace evidence before making readiness claims","do not claim Flutter widget-tree inspection"],"limitations":["inspect is read-only and does not launch devices","autonomous crawling is not shipped; generate or edit scenarios for human review"]}
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
`zmr discover --from-trace <trace-dir> --out <scenario.json> --validate --json`
|
|
@@ -60,7 +60,7 @@ invent credentials, or commit files. The response is covered by
|
|
|
60
60
|
`schemas/discover-output.schema.json`:
|
|
61
61
|
|
|
62
62
|
```json
|
|
63
|
-
{"ok":true,"mode":"discover","schemaVersion":1,"runnerVersion":"0.2.
|
|
63
|
+
{"ok":true,"mode":"discover","schemaVersion":1,"runnerVersion":"0.2.11","protocolVersion":"2026-04-28","out":".zmr/discovered/replay-smoke.json","traceDir":"traces/zmr-agent","sourceSnapshot":"traces/zmr-agent/artifacts/snapshot-2.json","name":"draft from login smoke","appId":"com.example.mobiletest","selectorCount":2,"stepCount":6,"replay":{"enabled":true,"eventCount":4,"stepCount":3,"skippedEventCount":1},"warnings":["draft requires human review before commit"],"validated":true,"validation":{"ok":true,"path":".zmr/discovered/replay-smoke.json","name":"draft from login smoke","appId":"com.example.mobiletest","stepCount":6},"nextCommands":["zmr validate --json .zmr/discovered/replay-smoke.json","zmr run .zmr/discovered/replay-smoke.json --json --trace-dir traces/zmr-agent"]}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
`zmr explore --from-trace <trace-dir> --out <scenario.json> --goal <goal>
|
|
@@ -71,7 +71,7 @@ launch devices, crawl the app, invent missing actions, discover credentials, or
|
|
|
71
71
|
commit files. The response is covered by `schemas/explore-output.schema.json`:
|
|
72
72
|
|
|
73
73
|
```json
|
|
74
|
-
{"ok":true,"mode":"explore","schemaVersion":1,"runnerVersion":"0.2.
|
|
74
|
+
{"ok":true,"mode":"explore","schemaVersion":1,"runnerVersion":"0.2.11","protocolVersion":"2026-04-28","goal":"find a stable login smoke","autonomous":false,"reviewRequired":true,"guardrails":["writes from existing trace evidence only","does not crawl the app","does not discover credentials or secrets","requires human review before commit"],"out":".zmr/discovered/login-smoke.json","traceDir":"traces/zmr-agent","sourceSnapshot":"traces/zmr-agent/artifacts/snapshot-2.json","name":"draft from login smoke","appId":"com.example.mobiletest","selectorCount":2,"stepCount":6,"replay":{"enabled":true,"eventCount":4,"stepCount":3,"skippedEventCount":1},"warnings":["draft requires human review before commit"],"validated":true,"validation":{"ok":true,"path":".zmr/discovered/login-smoke.json","name":"draft from login smoke","appId":"com.example.mobiletest","stepCount":6},"nextCommands":["zmr validate --json .zmr/discovered/login-smoke.json","zmr run .zmr/discovered/login-smoke.json --json --trace-dir traces/zmr-agent"]}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
`zmr draft --from-trace <trace-dir> --out <scenario.json> --json` is the lower
|
|
@@ -84,7 +84,7 @@ into fields, or commit files. The response is covered by
|
|
|
84
84
|
`schemas/draft-output.schema.json`:
|
|
85
85
|
|
|
86
86
|
```json
|
|
87
|
-
{"ok":true,"mode":"draft","schemaVersion":1,"runnerVersion":"0.2.
|
|
87
|
+
{"ok":true,"mode":"draft","schemaVersion":1,"runnerVersion":"0.2.11","protocolVersion":"2026-04-28","out":".zmr/discovered/surface-smoke.json","traceDir":"traces/zmr-agent","sourceSnapshot":"traces/zmr-agent/artifacts/snapshot-2.json","name":"draft from login smoke","appId":"com.example.mobiletest","selectorCount":2,"stepCount":4,"replay":{"enabled":false,"eventCount":0,"stepCount":0,"skippedEventCount":0},"warnings":["draft requires human review before commit"],"nextCommands":["zmr validate --json .zmr/discovered/surface-smoke.json","zmr run .zmr/discovered/surface-smoke.json --json --trace-dir traces/zmr-agent"]}
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
`zmr draft --include-actions` additionally parses `events.jsonl` and prepends
|
|
@@ -214,7 +214,7 @@ installers, setup scripts, and generated clients. The response is covered by
|
|
|
214
214
|
`schemas/version-output.schema.json`:
|
|
215
215
|
|
|
216
216
|
```json
|
|
217
|
-
{"name":"zmr","version":"0.2.
|
|
217
|
+
{"name":"zmr","version":"0.2.11","protocolVersion":"2026-04-28","minimumCompatibleProtocolVersion":"2026-04-28","stability":"dev-preview","breakingChangePolicy":"version-and-changelog"}
|
|
218
218
|
```
|
|
219
219
|
|
|
220
220
|
## Capabilities Output Contract
|
|
@@ -226,7 +226,7 @@ and method inventory for JSON-RPC clients. The result object is covered by
|
|
|
226
226
|
iOS simulator, or physical iOS workflows are available.
|
|
227
227
|
|
|
228
228
|
```json
|
|
229
|
-
{"name":"zmr","version":"0.2.
|
|
229
|
+
{"name":"zmr","version":"0.2.11","protocolVersion":"2026-04-28","protocol":{"version":"2026-04-28","minimumCompatibleVersion":"2026-04-28","stability":"dev-preview","breakingChangePolicy":"version-and-changelog"},"platforms":["android","ios"],"platformSupport":{"android":{"status":"supported","deviceTypes":["emulator","physical"],"automation":["adb","uiautomator","android-shim"]},"ios":{"status":"supported","deviceTypes":["simulator","physical"],"automation":["simctl","devicectl","xctest-shim"],"physicalDevices":true}},"iosPreview":false,"transports":["stdio","tcp"],"methods":["runner.capabilities","device.list","session.create","session.close","app.install","app.launch","app.stop","app.openLink","app.clearState","observe.snapshot","observe.semanticSnapshot","ui.tap","ui.type","ui.eraseText","ui.hideKeyboard","ui.swipe","ui.pressBack","ui.scrollUntilVisible","wait.until","wait.any","wait.gone","assert.visible","assert.notVisible","assert.healthy","scenario.validate","trace.events","trace.explore","trace.discover","trace.explain","trace.export"]}
|
|
230
230
|
```
|
|
231
231
|
|
|
232
232
|
## Doctor Output Contract
|
|
@@ -432,7 +432,7 @@ Request:
|
|
|
432
432
|
Response:
|
|
433
433
|
|
|
434
434
|
```json
|
|
435
|
-
{"jsonrpc":"2.0","id":1,"result":{"name":"zmr","version":"0.2.
|
|
435
|
+
{"jsonrpc":"2.0","id":1,"result":{"name":"zmr","version":"0.2.11","protocolVersion":"2026-04-28","protocol":{"version":"2026-04-28","minimumCompatibleVersion":"2026-04-28","stability":"dev-preview","breakingChangePolicy":"version-and-changelog"},"platforms":["android","ios"],"platformSupport":{"android":{"status":"supported","deviceTypes":["emulator","physical"],"automation":["adb","uiautomator","android-shim"]},"ios":{"status":"supported","deviceTypes":["simulator","physical"],"automation":["simctl","devicectl","xctest-shim"],"physicalDevices":true}},"iosPreview":false,"transports":["stdio","tcp"],"methods":["runner.capabilities","device.list","session.create","session.close","app.install","app.launch","app.stop","app.openLink","app.clearState","observe.snapshot","observe.semanticSnapshot","ui.tap","ui.type","ui.eraseText","ui.hideKeyboard","ui.swipe","ui.pressBack","ui.scrollUntilVisible","wait.until","wait.any","wait.gone","assert.visible","assert.notVisible","assert.healthy","scenario.validate","trace.events","trace.explore","trace.discover","trace.explain","trace.export"]}}
|
|
436
436
|
```
|
|
437
437
|
|
|
438
438
|
### `trace.events`
|
|
@@ -514,7 +514,7 @@ Request:
|
|
|
514
514
|
Response:
|
|
515
515
|
|
|
516
516
|
```json
|
|
517
|
-
{"jsonrpc":"2.0","id":25,"result":{"ok":true,"mode":"discover","schemaVersion":1,"runnerVersion":"0.2.
|
|
517
|
+
{"jsonrpc":"2.0","id":25,"result":{"ok":true,"mode":"discover","schemaVersion":1,"runnerVersion":"0.2.11","protocolVersion":"2026-04-28","out":".zmr/discovered/agent-smoke.json","traceDir":"traces/agent-session","sourceSnapshot":"traces/agent-session/artifacts/snapshot-1.json","name":"agent smoke","appId":"com.example.mobiletest","selectorCount":1,"stepCount":4,"replay":{"enabled":true,"eventCount":2,"stepCount":1,"skippedEventCount":1},"warnings":["draft requires human review before commit"],"validated":true,"validation":{"ok":true,"path":".zmr/discovered/agent-smoke.json","name":"agent smoke","appId":"com.example.mobiletest","stepCount":4},"nextCommands":["zmr validate --json .zmr/discovered/agent-smoke.json","zmr run .zmr/discovered/agent-smoke.json --json --trace-dir traces/agent-session"]}}
|
|
518
518
|
```
|
|
519
519
|
|
|
520
520
|
Without `--trace-dir`, it returns `ok: false` with `traceDir: null`. Generated
|
|
@@ -537,7 +537,7 @@ Request:
|
|
|
537
537
|
Response:
|
|
538
538
|
|
|
539
539
|
```json
|
|
540
|
-
{"jsonrpc":"2.0","id":27,"result":{"ok":true,"mode":"explore","schemaVersion":1,"runnerVersion":"0.2.
|
|
540
|
+
{"jsonrpc":"2.0","id":27,"result":{"ok":true,"mode":"explore","schemaVersion":1,"runnerVersion":"0.2.11","protocolVersion":"2026-04-28","out":".zmr/discovered/agent-goal.json","traceDir":"traces/agent-session","sourceSnapshot":"traces/agent-session/artifacts/snapshot-1.json","name":"agent goal smoke","appId":"com.example.mobiletest","selectorCount":1,"stepCount":4,"replay":{"enabled":true,"eventCount":2,"stepCount":1,"skippedEventCount":1},"warnings":["draft requires human review before commit"],"validated":true,"validation":{"ok":true,"path":".zmr/discovered/agent-goal.json","name":"agent goal smoke","appId":"com.example.mobiletest","stepCount":4},"nextCommands":["zmr validate --json .zmr/discovered/agent-goal.json","zmr run .zmr/discovered/agent-goal.json --json --trace-dir traces/agent-session"],"goal":"find a stable login smoke","autonomous":false,"reviewRequired":true,"guardrails":["writes from existing trace evidence only","does not crawl the app","does not discover credentials or secrets","requires human review before commit"]}}
|
|
541
541
|
```
|
|
542
542
|
|
|
543
543
|
Without `--trace-dir`, it returns `ok: false` with `traceDir: null`.
|
package/package.json
CHANGED
|
Binary file
|
package/prebuilds/darwin-x64/zmr
CHANGED
|
Binary file
|
|
Binary file
|
package/prebuilds/linux-x64/zmr
CHANGED
|
Binary file
|
package/shims/ios/ZMRShim.swift
CHANGED
|
@@ -57,7 +57,8 @@ enum ZMRShim {
|
|
|
57
57
|
.cell,
|
|
58
58
|
.scrollView,
|
|
59
59
|
.table,
|
|
60
|
-
.collectionView
|
|
60
|
+
.collectionView,
|
|
61
|
+
.other
|
|
61
62
|
]
|
|
62
63
|
let queries = types.flatMap { type in snapshotQueries(app: app, type: type) }
|
|
63
64
|
|
|
@@ -89,7 +90,15 @@ enum ZMRShim {
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
private static func snapshotQueries(app: XCUIApplication, type: XCUIElement.ElementType) -> [(XCUIElement.ElementType, XCUIElementQuery)] {
|
|
92
|
-
|
|
93
|
+
if type == .other {
|
|
94
|
+
let hasIdentifier = NSPredicate(format: "identifier != %@", "")
|
|
95
|
+
return [
|
|
96
|
+
(type, app.windows.descendants(matching: type).matching(hasIdentifier)),
|
|
97
|
+
(type, app.descendants(matching: type).matching(hasIdentifier))
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return [
|
|
93
102
|
(type, app.windows.descendants(matching: type)),
|
|
94
103
|
(type, app.descendants(matching: type))
|
|
95
104
|
]
|
package/src/runner.zig
CHANGED
|
@@ -456,6 +456,88 @@ test "assertHealthy retries through a transient observation command failure" {
|
|
|
456
456
|
try std.testing.expect(std.mem.indexOf(u8, events, "\"status\":\"ok\"") != null);
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
+
test "assertHealthy retries native probes after a transient native health probe failure" {
|
|
460
|
+
const allocator = std.testing.allocator;
|
|
461
|
+
const dir = "zig-cache-test-runner-assert-healthy-native-probe-command-failed";
|
|
462
|
+
std.Io.Dir.cwd().deleteTree(stdio.io(), dir) catch {};
|
|
463
|
+
defer std.Io.Dir.cwd().deleteTree(stdio.io(), dir) catch {};
|
|
464
|
+
|
|
465
|
+
const NativeFlakyProbeHealthDevice = struct {
|
|
466
|
+
allocator: std.mem.Allocator,
|
|
467
|
+
native_queries: usize = 0,
|
|
468
|
+
snapshots: usize = 0,
|
|
469
|
+
|
|
470
|
+
pub fn visibleBySelectorWithTimeout(self: *@This(), wanted: selector.Selector, timeout_ms: u64) !?bool {
|
|
471
|
+
_ = wanted;
|
|
472
|
+
_ = timeout_ms;
|
|
473
|
+
self.native_queries += 1;
|
|
474
|
+
if (self.native_queries == 1) return error.CommandTimedOut;
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
pub fn snapshot(self: *@This(), writer: anytype) !types.ObservationSnapshot {
|
|
479
|
+
_ = writer;
|
|
480
|
+
self.snapshots += 1;
|
|
481
|
+
return error.UnexpectedSnapshotFallback;
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
var device = NativeFlakyProbeHealthDevice{ .allocator = allocator };
|
|
486
|
+
var tw = try trace.TraceWriter.init(allocator, dir);
|
|
487
|
+
defer tw.deinit();
|
|
488
|
+
|
|
489
|
+
try std.testing.expect(try assertHealthy(&device, 100, &tw, .{ .settle_ms = 0, .poll_ms = 0 }));
|
|
490
|
+
try std.testing.expect(device.native_queries > 1);
|
|
491
|
+
try std.testing.expectEqual(@as(usize, 0), device.snapshots);
|
|
492
|
+
|
|
493
|
+
const events_path = try std.fs.path.join(allocator, &.{ dir, "events.jsonl" });
|
|
494
|
+
defer allocator.free(events_path);
|
|
495
|
+
const events = try stdio.readFileAlloc(allocator, events_path, 1024 * 1024);
|
|
496
|
+
defer allocator.free(events);
|
|
497
|
+
try std.testing.expect(std.mem.indexOf(u8, events, "\"kind\":\"observe.retry\"") != null);
|
|
498
|
+
try std.testing.expect(std.mem.indexOf(u8, events, "\"error\":\"CommandTimedOut\"") != null);
|
|
499
|
+
try std.testing.expect(std.mem.indexOf(u8, events, "\"kind\":\"assert.healthy\"") != null);
|
|
500
|
+
try std.testing.expect(std.mem.indexOf(u8, events, "\"status\":\"ok\"") != null);
|
|
501
|
+
try std.testing.expect(std.mem.indexOf(u8, events, "\"strategy\":\"nativeSelector\"") != null);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
test "assertHealthy gives native health probes a practical XCTest query budget" {
|
|
505
|
+
const allocator = std.testing.allocator;
|
|
506
|
+
const dir = "zig-cache-test-runner-assert-healthy-native-probe-xctest-budget";
|
|
507
|
+
std.Io.Dir.cwd().deleteTree(stdio.io(), dir) catch {};
|
|
508
|
+
defer std.Io.Dir.cwd().deleteTree(stdio.io(), dir) catch {};
|
|
509
|
+
|
|
510
|
+
const NativeXCTestBudgetHealthDevice = struct {
|
|
511
|
+
allocator: std.mem.Allocator,
|
|
512
|
+
native_queries: usize = 0,
|
|
513
|
+
largest_query_timeout_ms: u64 = 0,
|
|
514
|
+
snapshots: usize = 0,
|
|
515
|
+
|
|
516
|
+
pub fn visibleBySelectorWithTimeout(self: *@This(), wanted: selector.Selector, timeout_ms: u64) !?bool {
|
|
517
|
+
_ = wanted;
|
|
518
|
+
self.native_queries += 1;
|
|
519
|
+
self.largest_query_timeout_ms = @max(self.largest_query_timeout_ms, timeout_ms);
|
|
520
|
+
if (timeout_ms < 1000) return error.CommandTimedOut;
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
pub fn snapshot(self: *@This(), writer: anytype) !types.ObservationSnapshot {
|
|
525
|
+
_ = writer;
|
|
526
|
+
self.snapshots += 1;
|
|
527
|
+
return error.UnexpectedSnapshotFallback;
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
var device = NativeXCTestBudgetHealthDevice{ .allocator = allocator };
|
|
532
|
+
var tw = try trace.TraceWriter.init(allocator, dir);
|
|
533
|
+
defer tw.deinit();
|
|
534
|
+
|
|
535
|
+
try std.testing.expect(try assertHealthy(&device, 5000, &tw, .{ .settle_ms = 0, .poll_ms = 0 }));
|
|
536
|
+
try std.testing.expect(device.native_queries > 0);
|
|
537
|
+
try std.testing.expect(device.largest_query_timeout_ms >= 1000);
|
|
538
|
+
try std.testing.expectEqual(@as(usize, 0), device.snapshots);
|
|
539
|
+
}
|
|
540
|
+
|
|
459
541
|
test "native selector waits pass bounded query timeouts instead of legacy blocking queries" {
|
|
460
542
|
const allocator = std.testing.allocator;
|
|
461
543
|
const dir = "zig-cache-test-runner-native-wait-bounded-query-timeout";
|
package/src/runner_waits.zig
CHANGED
|
@@ -8,7 +8,7 @@ const selector = @import("selector.zig");
|
|
|
8
8
|
const trace = @import("trace.zig");
|
|
9
9
|
|
|
10
10
|
const RunOptions = runner_config.RunOptions;
|
|
11
|
-
const native_health_probe_timeout_ms: u64 =
|
|
11
|
+
const native_health_probe_timeout_ms: u64 = 1000;
|
|
12
12
|
|
|
13
13
|
pub fn waitUntilVisible(
|
|
14
14
|
device: anytype,
|
|
@@ -320,23 +320,31 @@ fn nativeAssertHealthy(
|
|
|
320
320
|
) !?bool {
|
|
321
321
|
if (!hasNativeSelectorQuery(device)) return null;
|
|
322
322
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
323
|
+
const deadline = stdio.nowMs() + @as(i64, @intCast(timeout_ms));
|
|
324
|
+
native_probe: while (true) {
|
|
325
|
+
const remaining_ms = nativeSelectorQueryTimeoutMs(deadline) orelse return null;
|
|
326
|
+
const query_timeout_ms = @min(remaining_ms, nativeHealthProbeTimeoutMs(timeout_ms, options));
|
|
327
|
+
|
|
328
|
+
for (health_selectors, 0..) |wanted, index| {
|
|
329
|
+
const result = nativeVisibleBySelector(device, wanted, query_timeout_ms) catch |err| {
|
|
330
|
+
if (err == error.CommandTimedOut or err == error.CommandFailed) {
|
|
331
|
+
if (writer) |tw| try runner_events.recordObservationRetry(tw, "assert.healthy", err);
|
|
332
|
+
if (stdio.nowMs() >= deadline) return null;
|
|
333
|
+
try sleepMs(options.poll_ms);
|
|
334
|
+
continue :native_probe;
|
|
335
|
+
}
|
|
336
|
+
return err;
|
|
337
|
+
};
|
|
338
|
+
const visible = result orelse return null;
|
|
339
|
+
if (visible) {
|
|
340
|
+
if (writer) |tw| try runner_events.recordNativeSelectorArrayStatus(tw, "assert.healthy", "unhealthy", health_selectors, index, timeout_ms);
|
|
341
|
+
return false;
|
|
328
342
|
}
|
|
329
|
-
return err;
|
|
330
|
-
};
|
|
331
|
-
const visible = result orelse return null;
|
|
332
|
-
if (visible) {
|
|
333
|
-
if (writer) |tw| try runner_events.recordNativeSelectorArrayStatus(tw, "assert.healthy", "unhealthy", health_selectors, index, timeout_ms);
|
|
334
|
-
return false;
|
|
335
343
|
}
|
|
336
|
-
}
|
|
337
344
|
|
|
338
|
-
|
|
339
|
-
|
|
345
|
+
if (writer) |tw| try runner_events.recordNativeSelectorArrayStatus(tw, "assert.healthy", "ok", health_selectors, null, timeout_ms);
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
340
348
|
}
|
|
341
349
|
|
|
342
350
|
pub fn scrollUntilVisible(
|
package/src/version.zig
CHANGED