Skip to content

Commit 09d30bf

Browse files
committed
test(ios): resolve the host app before stubbing its tree snapshot
Running the suite on a freshly booted simulator, with this test as the first to launch the host app, the runner was killed with SIGTERM about 30 s in ("Test crashed with signal term"). The stub only ever blocks the tree XPC, but a cold first launch adds a slow "Find the Target Application" resolution inside the plan. Resolve the application element before installing the stub, and give the plan wait 60 s instead of 30 so a slow cold path cannot tear the test down while the plan still runs. Verified with three cold-boot runs of the test and one full suite from a fresh boot (248 tests, 0 failures, no runner restart).
1 parent 649d918 commit 09d30bf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ extension RunnerTests {
4646
}
4747
app.launchArguments = ["--agent-device-selector-read-regression"]
4848
app.launch()
49+
// Resolve the application element while nothing is stubbed: on a fresh simulator the first
50+
// resolution is slow, and it must not be the block the plan abandons.
51+
XCTAssertTrue(app.wait(for: .runningForeground, timeout: 10))
52+
XCTAssertFalse(app.frame.isEmpty)
4953
currentApp = app
5054
currentBundleId = "com.callstack.agentdevice.runner.tree-capture-test"
5155
snapshotXCTestPenaltyWarmupExemptionPending = true
@@ -89,7 +93,7 @@ extension RunnerTests {
8993
planned.fulfill()
9094
}
9195

92-
wait(for: [planned], timeout: 30)
96+
wait(for: [planned], timeout: 60)
9397
let drainDeadline = Date().addingTimeInterval(3)
9498
while hasAbandonedMainThreadWork(), Date() < drainDeadline {
9599
sleepFor(0.005)

0 commit comments

Comments
 (0)