Skip to content

Commit bca6697

Browse files
committed
fix(tvos): skip SpringBoard system-modal probe on tvOS (#1351)
tvOS has no SpringBoard (it uses PineBoard/HeadBoard), so probing com.apple.springboard for blocking system modals raises an XCTest failure ("Application com.apple.springboard is not running") that safely() cannot trap, terminating the whole runner test. Every snapshot and alert resolution then failed, and the CLI misreported it as the screen "overwhelming the accessibility capture". resolveBlockingSystemModal — the single chokepoint every snapshot/alert path funnels through — assumed a SpringBoard host always exists. Model that assumption explicitly with `hasSpringBoardSystemModalHost` and bail to `.absent` when no host exists, so app-owned alert queries still run. The fourth probe site (shouldRouteToSpringboardBlockingSystemModal) is already `#if os(iOS)` and needs no change. Add tvOS regression tests covering the snapshot and alert-resolution paths.
1 parent b3b9ff5 commit bca6697

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+BlockingSystemModalResolution.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ extension RunnerTests {
1616
func resolveBlockingSystemModal(
1717
deadline: Date
1818
) -> BlockingSystemModalResolution {
19+
guard Self.hasSpringBoardSystemModalHost else {
20+
return .absent
21+
}
22+
1923
guard let springboardModal = firstBlockingSystemModal(
2024
in: springboard,
2125
deadline: deadline
@@ -90,5 +94,20 @@ extension RunnerTests {
9094
XCTAssertFalse(RemoteHostedSystemModalPolicy.isEligibleHostState(.notRunning))
9195
XCTAssertFalse(RemoteHostedSystemModalPolicy.isEligibleHostState(.unknown))
9296
}
97+
98+
// tvOS has no SpringBoard host, so both the snapshot and alert-resolution paths
99+
// must resolve without probing com.apple.springboard (#1351).
100+
#if os(tvOS)
101+
func testResolveBlockingSystemModalIsAbsentWithoutSpringBoardOnTvOS() {
102+
guard case .absent = resolveBlockingSystemModal(deadline: .distantFuture) else {
103+
XCTFail("tvOS blocking system-modal resolution must be .absent")
104+
return
105+
}
106+
}
107+
108+
func testBlockingSystemAlertSnapshotIsNilOnTvOS() {
109+
XCTAssertNil(blockingSystemAlertSnapshot(deadline: .distantFuture))
110+
}
111+
#endif
93112
}
94113
#endif

apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ final class RunnerTests: XCTestCase {
2929
}
3030

3131
static let springboardBundleId = "com.apple.springboard"
32+
// SpringBoard hosts blocking system modals on iOS/visionOS; tvOS (PineBoard/HeadBoard)
33+
// and macOS have no such host, so there is nothing to probe there.
34+
static let hasSpringBoardSystemModalHost: Bool = {
35+
#if os(tvOS) || os(macOS)
36+
return false
37+
#else
38+
return true
39+
#endif
40+
}()
3241
static let defaultRecordingFps: Int32 = 15
3342
var listener: NWListener?
3443
var doneExpectation: XCTestExpectation?

0 commit comments

Comments
 (0)