Skip to content

Commit 8cbac15

Browse files
committed
fix(ios-runner): anchor iOS coordinate interactions at the app origin
`interactionCoordinate` resolved the interaction root through `resolveRunnerWindow`, so an iOS coordinate tap/double-tap/long-press/drag anchored on the first qualifying window and subtracted its frame origin. On SpringBoard that first window is not necessarily the alert's — the wallpaper or status-bar window can qualify first — so `alert accept` (reached via activateElement, tapAt, performCoordinateTap) missed the Open button, which is why iOS Smoke failed at "wait for Automation lab" after the deep-link confirmation. Restore the main-branch iOS app-origin anchor (app.coordinate(0,0) + the snapshot-space point). Reference frames and the synthesized display ID still resolve through `resolveRunnerWindow`, so a foldable tap keeps its panel and routes on the resolved window's display. macOS keeps the window-relative anchor. Refs #2724
1 parent 514b7a5 commit 8cbac15

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,12 +584,23 @@ extension RunnerTests {
584584

585585
#if !os(tvOS)
586586
private func interactionCoordinate(app: XCUIApplication, x: Double, y: Double) -> XCUICoordinate {
587+
#if os(iOS)
588+
// Coordinate taps, double taps, long presses, and drags anchor at the app origin, not the
589+
// resolved window: on iOS the snapshot hands back app-space points, and the first qualifying
590+
// window is not always the one under the finger — a SpringBoard `alert accept` can live in an
591+
// alert window while the wallpaper or status-bar window qualifies first, so a window-relative
592+
// anchor misses the button. Reference frames and the synthesized display ID still resolve
593+
// through `resolveRunnerWindow`, so a foldable tap keeps its panel and stays on its display.
594+
let origin = app.coordinate(withNormalizedOffset: CGVector(dx: 0, dy: 0))
595+
return origin.withOffset(CGVector(dx: x, dy: y))
596+
#else
587597
let resolved = resolveRunnerWindow(app: app)
588598
let root = resolved.window ?? app
589599
let origin = root.coordinate(withNormalizedOffset: CGVector(dx: 0, dy: 0))
590600
let offsetX = x - Double(resolved.frame.origin.x)
591601
let offsetY = y - Double(resolved.frame.origin.y)
592602
return origin.withOffset(CGVector(dx: offsetX, dy: offsetY))
603+
#endif
593604
}
594605
#endif
595606

0 commit comments

Comments
 (0)