Skip to content

Commit fc1a335

Browse files
committed
fix(apple-runner): a penalized snapshot plan falls back to the bounded XCTest probe
1 parent 8fe03de commit fc1a335

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,17 +250,13 @@ extension RunnerTests {
250250
}
251251
let availablePlan = plan.filter { availableBackends.contains($0) }
252252
let recoveryPlan = availablePlan.filter { !$0.usesXCTestAccessibilityChannel }
253-
if !recoveryPlan.isEmpty {
254-
return EffectiveSnapshotCapturePlan(
255-
plan: recoveryPlan,
256-
xCTestChannelState: .deferredToIndependentBackend,
257-
treeCaptureSliceBudgetOverride: nil,
258-
preferredBackend: nil
259-
)
260-
}
253+
let boundedProbePlan = availablePlan.filter(\.usesXCTestAccessibilityChannel)
254+
// The independent backend reads only the app it can match as the active AX application, so
255+
// an out-of-process surface over the app (the Save Password sheet) leaves it empty for the
256+
// whole penalty. The bounded XCTest probe stays behind it as the last tier.
261257
return EffectiveSnapshotCapturePlan(
262-
plan: availablePlan.filter(\.usesXCTestAccessibilityChannel),
263-
xCTestChannelState: .boundedXCTestProbe,
258+
plan: recoveryPlan + boundedProbePlan,
259+
xCTestChannelState: recoveryPlan.isEmpty ? .boundedXCTestProbe : .deferredToIndependentBackend,
264260
treeCaptureSliceBudgetOverride: Self.penalizedXCTestProbeTreeSliceBudget,
265261
preferredBackend: nil
266262
)

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+SnapshotCapturePlanTests.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,14 +403,14 @@ extension RunnerTests {
403403
XCTAssertEqual(pinned.xCTestChannelState, .deferredToIndependentBackend)
404404
}
405405

406-
func testEffectiveSnapshotCapturePlanDefersXCTestBackedTiersOnlyWhenPenalizedRegularPlan() {
406+
func testEffectiveSnapshotCapturePlanPutsXCTestBackedTiersBehindPrivateAXOnlyWhenPenalizedRegularPlan() {
407407
let regular = Self.effectiveSnapshotCapturePlan(
408408
Self.regularVisiblePlan,
409409
xCTestChannelPenalized: true
410410
)
411-
XCTAssertEqual(regular.plan, [.privateAX])
411+
XCTAssertEqual(regular.plan, [.privateAX, .recursiveTree, .querySweep])
412412
XCTAssertEqual(regular.xCTestChannelState, .deferredToIndependentBackend)
413-
XCTAssertNil(regular.treeCaptureSliceBudgetOverride)
413+
XCTAssertEqual(regular.treeCaptureSliceBudgetOverride, Self.penalizedXCTestProbeTreeSliceBudget)
414414

415415
let unpenalized = Self.effectiveSnapshotCapturePlan(
416416
Self.regularVisiblePlan,

0 commit comments

Comments
 (0)