Skip to content

Commit 56b0ef1

Browse files
committed
perf: avoid app frame query in private AX fallback
1 parent ffd7cd1 commit 56b0ef1

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AXSnapshotFallback.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,11 @@ extension RunnerTests {
4646
return nil
4747
}
4848

49-
// If the app frame is unavailable, the private root's own frame is the reliable screen
50-
// rect here. Avoid public window queries: stale transient windows can record XCTest
49+
// Prefer the private root's own frame as the screen rect; fall back to the public app-frame
50+
// query only when the root frame is empty. Stale transient windows can record XCTest
5151
// failures after the runner already returned a successful command response.
52-
var viewport = safeSnapshotViewport(app: app)
5352
let rootFrame = privateAXRect(root["frame"])
54-
if viewport.isInfinite || viewport.isNull || viewport.isEmpty, !rootFrame.isEmpty {
55-
viewport = rootFrame
56-
}
53+
let viewport = rootFrame.isEmpty ? safeSnapshotViewport(app: app) : rootFrame
5754
var nodes: [SnapshotNode] = []
5855
appendPrivateAXNode(
5956
root,

0 commit comments

Comments
 (0)