Skip to content

Commit ba93660

Browse files
committed
test(ios): stop cold-host timing from failing the occupancy test
testAbandonedTreeCaptureSkipsQuerySweepAndHonorsWarmupExemption runs first in the targeted XCTest lane and absorbed a cold host twice over: - A cold viewport read overran its 1 s cap before the tree capture the test targets, so the abandonment reason read "preparing tree snapshot" (4 CI failures at line 106). The test now pays that read uncapped before the timed section; the production cap is unchanged. - The blocking stub's own 20 s timeout could release the main thread before the test read the abandoned-work count, reading Optional(0) (2 CI failures at line 111). It is now a named leak guard far past the plan deadline, so only the test's release ends the block.
1 parent fa3b729 commit ba93660

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ private enum RunnerBlockingSnapshotGate {
1515
/// read the AX server gave up on. The swap is process-wide while installed, which serial XCTest
1616
/// execution tolerates.
1717
private final class RunnerBlockingSnapshotStub: NSObject {
18+
/// Far past the plan deadline, so only the test's own release ends the block; it only stops a
19+
/// stuck test from holding the main thread.
20+
private static let leakGuard: TimeInterval = 75
21+
1822
@objc(snapshotWithError:)
1923
func snapshot() throws -> XCUIElementSnapshot {
20-
_ = RunnerBlockingSnapshotGate.release.wait(timeout: .now() + 20)
24+
_ = RunnerBlockingSnapshotGate.release.wait(timeout: .now() + Self.leakGuard)
2125
throw NSError(
2226
domain: "AgentDeviceRunner.tests",
2327
code: 1,
@@ -50,6 +54,10 @@ extension RunnerTests {
5054
// resolution is slow, and it must not be the block the plan abandons.
5155
XCTAssertTrue(app.wait(for: .runningForeground, timeout: 10))
5256
XCTAssertFalse(app.frame.isEmpty)
57+
// The traversal context reads the viewport under a 1 s cap; a cold first read can overrun it
58+
// and abandon the wrong block, so pay it here, uncapped.
59+
_ = safeSnapshotViewport(app: app)
60+
_ = capturedInterfaceOrientation(app: app)
5361
currentApp = app
5462
currentBundleId = "com.callstack.agentdevice.runner.tree-capture-test"
5563
snapshotXCTestPenaltyWarmupExemptionPending = true

0 commit comments

Comments
 (0)