Skip to content

Commit 1db684c

Browse files
committed
test(ios): prove a private-AX-pinned plan serves regular --depth through acquisition
The presentation-package test passes with the old backend depth gate restored, because it calls presentation directly. This runner-bundle test pins private AX, asks for regular depth 1 against the launched host app, and requires the plan to reach acquisition and presentation: a private-ax verdict that is not sparse, more than one node, a real root rect, and a payload no larger than the unscoped capture from the same backend. With the gate restored the plan logs SNAPSHOT_BACKEND_DEPTH_UNSUPPORTED and returns the zero-rect sparse root, and the test fails.
1 parent bb3dfdc commit 1db684c

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

‎.github/workflows/ios.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ jobs:
241241
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testCustomActionCoverageParsesOnlyCompletePairs \
242242
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testPartialCustomActionPassIsDisclosedAndCompleteOneIsNot \
243243
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testActionNamesAreCappedPerElementAndReported \
244-
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testHungCustomActionReadIsContainedAndRecovers 2>&1 | tee /tmp/agent-device-runner-regressions.log
244+
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testHungCustomActionReadIsContainedAndRecovers \
245+
-only-testing:AgentDeviceRunnerUITests/RunnerTests/testPrivateAXPinnedRegularDepthReachesAcquisitionAndPresentation 2>&1 | tee /tmp/agent-device-runner-regressions.log
245246
node --input-type=module -e '
246247
import { readFileSync } from "node:fs";
247248
const log = readFileSync("/tmp/agent-device-runner-regressions.log", "utf8");

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SnapshotCapturePlan.swift‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,5 +1176,52 @@ extension RunnerTests {
11761176
)
11771177
)
11781178
}
1179+
1180+
#if os(iOS)
1181+
/// #2403: a plan pinned to private AX serves a regular `--depth` request through acquisition
1182+
/// and presentation. With a backend depth gate in `captureWithBackend`, private AX returns no
1183+
/// capture, the plan falls through to the synthetic sparse root, and the daemon rejects that
1184+
/// zero-rect root as a missing viewport.
1185+
func testPrivateAXPinnedRegularDepthReachesAcquisitionAndPresentation() throws {
1186+
app.launchArguments = ["--agent-device-selector-read-regression"]
1187+
app.launch()
1188+
currentApp = app
1189+
currentBundleId = nil
1190+
defer {
1191+
currentApp = nil
1192+
clearPrivateAXAcceptedDepth(reason: "test-cleanup")
1193+
app.terminate()
1194+
}
1195+
func capture(depth: Int?) throws -> DataPayload {
1196+
try runSnapshotCapturePlan(
1197+
Self.regularVisiblePlan,
1198+
app: app,
1199+
options: PresentationOptions(
1200+
interactiveOnly: false,
1201+
depth: depth,
1202+
scope: nil,
1203+
raw: false,
1204+
preferredBackend: SnapshotBackendKind.privateAX.rawValue
1205+
),
1206+
terminal: .sparseWithFatalOnAXFailure
1207+
)
1208+
}
1209+
1210+
let capped = try capture(depth: 1)
1211+
1212+
let quality = try XCTUnwrap(capped.snapshotQuality)
1213+
XCTAssertEqual(quality.backend, SnapshotBackendKind.privateAX.rawValue)
1214+
XCTAssertNotEqual(quality.state, "sparse")
1215+
let nodes = try XCTUnwrap(capped.nodes)
1216+
XCTAssertGreaterThan(nodes.count, 1)
1217+
XCTAssertEqual(nodes.map(\.depth).max(), 1)
1218+
XCTAssertNotEqual(nodes[0].rect, SnapshotRect(x: 0, y: 0, width: 0, height: 0))
1219+
XCTAssertTrue(nodes.contains { $0.label == "Readable target" })
1220+
1221+
// The presented cut only ever narrows the unscoped capture from the same backend.
1222+
let unscoped = try XCTUnwrap(try capture(depth: nil).nodes)
1223+
XCTAssertLessThanOrEqual(nodes.count, unscoped.count)
1224+
}
1225+
#endif
11791226
}
11801227
#endif

0 commit comments

Comments
 (0)