diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 975e0efe0c..102f8faa92 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -14,6 +14,8 @@ // One entry per line, so each pinned runner request changes as one reviewable diff line. "contracts/fixtures/runner-requests.json", // One captured node per line, so the real keyboard capture stays a compact reviewable table. - "packages/capture-kit/src/snapshot-chrome.fixtures.ts" + "packages/capture-kit/src/snapshot-chrome.fixtures.ts", + // One recorded node per line, so a recapture reads as a reviewable diff of changed nodes. + "apple/snapshot-presentation/Tests/AlertSurfaceCorpus/*.json" ] } diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertVerification.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertVerification.swift index 3413ef9ed3..bdff3215c5 100644 --- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertVerification.swift +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerAlertVerification.swift @@ -1,11 +1,7 @@ -struct RunnerAlertPresentation: Equatable { - let title: String - let content: [String] - let buttons: [String] -} +import AgentDeviceSnapshotPresentation enum RunnerAlertObservation { - case visible(RunnerAlertPresentation) + case visible(AlertSurfacePresentation) case absent case unavailable case deadlineExceeded @@ -19,7 +15,7 @@ enum RunnerAlertVerification: Equatable { case timedOut static func verify( - original: RunnerAlertPresentation, + original: AlertSurfacePresentation, observation: RunnerAlertObservation ) -> RunnerAlertVerification { switch observation { diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift index 880e7ad563..5c32808afe 100644 --- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift @@ -1,18 +1,12 @@ import XCTest +import AgentDeviceSnapshotPresentation extension RunnerTests { - enum RunnerAlertSource { - case blockingSystemModal - case appAlert - case safariDialog - case dismissPopup - } - struct RunnerAlert { let root: XCUIElement let ownerApp: XCUIApplication let buttons: [XCUIElement] - let source: RunnerAlertSource + let source: AlertSurfaceSource /// The window hosting a SpringBoard modal; nil routes through `ownerApp`. let window: XCUIElement? } @@ -58,7 +52,7 @@ extension RunnerTests { return runnerAlert(root: alert, ownerApp: activeApp, source: .appAlert) } if let dialog = firstExistingElement(in: safeElementsQuery { - activeApp.otherElements.matching(identifier: Self.safariDialogIdentifier).allElementsBoundByIndex + activeApp.otherElements.matching(identifier: AlertSurface.safariDialogIdentifier).allElementsBoundByIndex }) { return runnerAlert(root: dialog, ownerApp: activeApp, source: .safariDialog) } @@ -255,7 +249,7 @@ extension RunnerTests { private func runnerAlert( root: XCUIElement, ownerApp: XCUIApplication, - source: RunnerAlertSource + source: AlertSurfaceSource ) -> RunnerAlert? { let buttons = actionableElements(in: root).filter { isEnabledElement($0) } guard !buttons.isEmpty else { @@ -268,10 +262,6 @@ extension RunnerTests { elements.first { isVisibleElement($0) } } - /// Safari draws its page prompts, such as "Open this page in …?" and JavaScript dialogs, as a - /// view rather than an alert, so they are found by the view's identifier. - static let safariDialogIdentifier = "SFDialogView" - /// The marker is matched inside XCTest's query, so the screen is read once per query. Reading each /// descendant instead costs one round trip per element, and on a screen whose tree changes while /// it is read (a loading web view) each vanished element adds XCTest's retry cycle. `containing` @@ -282,15 +272,11 @@ extension RunnerTests { }) } - /// The one definition of a popover's dismiss region: a label or identifier that reads "dismiss - /// popup", in any case, with any surrounding whitespace. XCTest queries take it as a format predicate. - private static let dismissPopupMarkerPattern = #"\s*dismiss popup\s*"# private static let dismissPopupMarker = NSPredicate( format: "label MATCHES[c] %@ OR identifier MATCHES[c] %@", - dismissPopupMarkerPattern, - dismissPopupMarkerPattern + AlertSurface.dismissPopupMarkerPattern, + AlertSurface.dismissPopupMarkerPattern ) - private static let dismissPopupMarkerText = NSPredicate(format: "SELF MATCHES[c] %@", dismissPopupMarkerPattern) // Internal, not private: the dismiss-popup wiring is pinned by // RunnerTests+AlertTests, and the label rule itself by RunnerAlertButtonChoice. @@ -349,7 +335,7 @@ extension RunnerTests { private func isGenericAlertLabel(_ label: String) -> Bool { let normalized = label.trimmingCharacters(in: .whitespacesAndNewlines).lowercased() - return isDismissPopupMarker(normalized) || + return AlertSurface.isDismissPopupMarker(normalized) || normalized.hasPrefix("vertical scroll bar") || normalized.hasPrefix("horizontal scroll bar") || normalized == "tab bar" @@ -399,8 +385,4 @@ extension RunnerTests { }) return hittable } - - func isDismissPopupMarker(_ text: String) -> Bool { - Self.dismissPopupMarkerText.evaluate(with: text) - } } diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift index 9ed0e068d6..b82c6a8f9b 100644 --- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift @@ -2,18 +2,18 @@ import XCTest import AgentDeviceSnapshotPresentation extension RunnerTests { - func captureAlertPresentation(_ element: XCUIElement) -> RunnerAlertPresentation? { - var presentation: RunnerAlertPresentation? + func captureAlertPresentation(_ element: XCUIElement) -> AlertSurfacePresentation? { + var presentation: AlertSurfacePresentation? _ = RunnerObjCExceptionCatcher.catchException { guard let snapshot = try? element.snapshot() else { return } - presentation = self.alertPresentation(snapshot) + presentation = AlertSurface.presentation(of: self.alertSurfaceNode(snapshot)) } return presentation } func observeAlert( in ownerApp: XCUIApplication, - source: RunnerAlertSource, + source: AlertSurfaceSource, observesApplicationRoot: Bool, deadline: Date ) -> RunnerAlertObservation { @@ -37,62 +37,33 @@ extension RunnerTests { } guard Date() < deadline, let snapshot = try? ownerApp.snapshot(), !snapshot.children.isEmpty, !snapshot.frame.isNull, !snapshot.frame.isEmpty else { return } + let root = self.alertSurfaceNode(snapshot) if observesApplicationRoot { - observation = .visible(self.alertPresentation(snapshot)) + observation = .visible(AlertSurface.presentation(of: root)) return } - let candidates = self.alertSnapshots(in: snapshot, source: source, viewport: snapshot.frame) + let candidates = AlertSurface.candidates(in: root, source: source, viewport: root.frame) guard candidates.count <= 1 else { return } - observation = candidates.first.map { .visible(self.alertPresentation($0)) } ?? .absent + observation = candidates.first.map { .visible(AlertSurface.presentation(of: $0)) } ?? .absent } return Date() < deadline ? observation : .deadlineExceeded } - func alertSnapshots( - in snapshot: XCUIElementSnapshot, - source: RunnerAlertSource, - viewport: CGRect - ) -> [XCUIElementSnapshot] { - let frame = snapshot.frame - let matches: Bool - switch source { - case .blockingSystemModal: - matches = snapshot.elementType == .alert || snapshot.elementType == .sheet - case .appAlert: - matches = snapshot.elementType == .alert - case .safariDialog: - matches = snapshot.identifier == Self.safariDialogIdentifier - case .dismissPopup: - matches = snapshot.elementType == .window && containsDismissPopupMarker(snapshot) + /// The tree the alert rules read. Snapshot output has no names for alerts and sheets, so the + /// rules name them here. + func alertSurfaceNode(_ snapshot: XCUIElementSnapshot) -> AlertSurfaceNode { + let type: String + switch snapshot.elementType { + case .alert: type = "Alert" + case .sheet: type = "Sheet" + default: type = elementTypeName(snapshot.elementType) } - if matches && Self.isPlaced(frame, in: viewport) { return [snapshot] } - // A window is placed in the box it sits in, and is itself the box of what it hosts. - let childViewport = snapshot.elementType == .window && SnapshotGeometry.isPositiveFinite(frame) ? frame : viewport - return snapshot.children.flatMap { alertSnapshots(in: $0, source: source, viewport: childViewport) } - } - - private func containsDismissPopupMarker(_ snapshot: XCUIElementSnapshot) -> Bool { - [snapshot.label, snapshot.identifier].contains { isDismissPopupMarker($0) } || - snapshot.children.contains { containsDismissPopupMarker($0) } - } - - private func alertPresentation(_ snapshot: XCUIElementSnapshot) -> RunnerAlertPresentation { - var content: [String] = [] - var buttons: [String] = [] - func collect(_ node: XCUIElementSnapshot) { - let label = node.label.trimmingCharacters(in: .whitespacesAndNewlines) - if actionableTypes.contains(node.elementType) { - buttons.append(label) - } else if !label.isEmpty { - content.append(label) - } - node.children.forEach(collect) - } - snapshot.children.forEach(collect) - return RunnerAlertPresentation( - title: snapshot.label.trimmingCharacters(in: .whitespacesAndNewlines), - content: content, - buttons: buttons + return AlertSurfaceNode( + type: type, + identifier: snapshot.identifier, + label: snapshot.label, + frame: snapshot.frame, + children: snapshot.children.map { alertSurfaceNode($0) } ) } diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift index 41e35882dc..c38ba53996 100644 --- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift @@ -159,14 +159,7 @@ extension RunnerTests { } private func isBlockingSystemModal(_ element: XCUIElement, in window: XCUIElement) -> Bool { - element.exists && Self.isPlaced(element.frame, in: window.frame) - } - - /// Whether a modal is on screen in the window that hosts it. A foldable's SpringBoard has a - /// window on each panel, and the application frame names only one of them. - static func isPlaced(_ frame: CGRect, in hostWindow: CGRect) -> Bool { - SnapshotGeometry.isPositiveFinite(frame) && SnapshotGeometry.isPositiveFinite(hostWindow) - && hostWindow.contains(CGPoint(x: frame.midX, y: frame.midY)) + element.exists && AlertSurface.isPlaced(element.frame, in: window.frame) } func actionableElements(in element: XCUIElement) -> [XCUIElement] { diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift index 557fd8afbd..12146eb9d7 100644 --- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift @@ -235,15 +235,11 @@ final class RunnerTests: XCTestCase { var textInputProbeIssues: TextInputProbeIssues? let suppressedIssueLock = NSLock() var suppressedAxSnapshotIssueCount = 0 - // Keep blocker actions narrow to avoid false positives from generic hittable containers. - let actionableTypes: Set = [ - .button, - .cell, - .link, - .menuItem, - .checkBox, - .switch - ] + let actionableTypes: Set = Set( + RunnerTests.elementTypeNamesByRawValue.compactMap { rawValue, name in + AlertSurface.actionableTypes.contains(name) ? XCUIElement.ElementType(rawValue: rawValue) : nil + } + ) // MARK: - XCTest Entry diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertObservationTests.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertObservationTests.swift index a8d5311a40..2e7e4c614f 100644 --- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertObservationTests.swift +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertObservationTests.swift @@ -327,38 +327,5 @@ extension RunnerTests { XCTAssertEqual(inspection.data?.items?.sorted(), ["Cancel", "OK"]) XCTAssertEqual(app.staticTexts["agent-device-alert-actions"].label, "First actions: 1; replacement actions: 0") } - - @MainActor - func testSafariDialogObservationMatchesOnlyTheDialogView() { - let dialog = ElementAttributesFixture(.other, CGRect(x: 20, y: 300, width: 360, height: 120), identifier: Self.safariDialogIdentifier) - let alert = ElementAttributesFixture(.alert, CGRect(x: 20, y: 500, width: 360, height: 120)) - let page = ElementAttributesFixture(.other, CGRect(x: 0, y: 100, width: 402, height: 600), identifier: "WebView") - let window = ElementAttributesFixture(.window, CGRect(x: 0, y: 0, width: 402, height: 874), children: [page, alert, dialog]) - XCTAssertEqual( - alertSnapshots(in: window, source: .safariDialog, viewport: window.frame).map(\.identifier), - [Self.safariDialogIdentifier] - ) - XCTAssertEqual(alertSnapshots(in: window, source: .appAlert, viewport: window.frame).map(\.elementType), [.alert]) - } - - @MainActor - func testDismissPopupWindowIsPlacedInTheBoxItSitsIn() { - let viewport = CGRect(x: 0, y: 0, width: 402, height: 874) - let popup = { (x: CGFloat) in - ElementAttributesFixture(.window, CGRect(x: x, y: 0, width: 402, height: 874), children: [ - ElementAttributesFixture(.other, CGRect(x: x, y: 0, width: 402, height: 874), label: "dismiss popup") - ]) - } - XCTAssertEqual(alertSnapshots(in: popup(0), source: .dismissPopup, viewport: viewport).count, 1) - XCTAssertTrue(alertSnapshots(in: popup(1000), source: .dismissPopup, viewport: viewport).isEmpty) - } - - @MainActor - func testAnInnerPanelAlertIsPlacedInItsWindowNotTheApplicationFrame() { - let alert = ElementAttributesFixture(.alert, CGRect(x: 341, y: 250, width: 270, height: 170)) - let innerPanel = ElementAttributesFixture(.window, CGRect(x: 0, y: 0, width: 951, height: 669), children: [alert]) - let root = ElementAttributesFixture(.application, CGRect(x: 0, y: 0, width: 466, height: 678), children: [innerPanel]) - XCTAssertEqual(alertSnapshots(in: root, source: .appAlert, viewport: root.frame).map(\.elementType), [.alert]) - } #endif } diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertSurfaceTests.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertSurfaceTests.swift new file mode 100644 index 0000000000..1b04a05999 --- /dev/null +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertSurfaceTests.swift @@ -0,0 +1,68 @@ +import XCTest +import AgentDeviceSnapshotPresentation + +#if AGENT_DEVICE_RUNNER_UNIT_TESTS +/// A frame as the corpus spells it: the `FixtureRect` spelling, so an unusable box is named. +private struct RecordedAlertSurfaceRect: Encodable { + let frame: CGRect + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + if frame.isInfinite { + try container.encode(true, forKey: .infinite) + } else if ![frame.minX, frame.minY, frame.width, frame.height].allSatisfy(\.isFinite) { + try container.encode(true, forKey: .nonFinite) + } else { + try container.encode(frame.minX, forKey: .x) + try container.encode(frame.minY, forKey: .y) + try container.encode(frame.width, forKey: .width) + try container.encode(frame.height, forKey: .height) + } + } + + private enum CodingKeys: String, CodingKey { + case x, y, width, height, infinite, nonFinite + } +} + +private struct RecordedAlertSurfaceNode: Encodable { + let index: Int + let parentIndex: Int? + let type: String + let identifier: String + let label: String + let rect: RecordedAlertSurfaceRect +} + +extension RunnerTests { + /// Records an app's whole accessibility tree for the alert surface corpus. It runs only from + /// `pnpm capture:alert-surface`, which sets the bundle and the output path. + @MainActor + func testCaptureAlertSurfaceTree() throws { + let environment = ProcessInfo.processInfo.environment + guard let bundleId = environment["AGENT_DEVICE_ALERT_SURFACE_BUNDLE_ID"], + let output = environment["AGENT_DEVICE_ALERT_SURFACE_OUTPUT"] + else { + throw XCTSkip("Run through pnpm capture:alert-surface") + } + let snapshot = try XCUIApplication(bundleIdentifier: bundleId).snapshot() + var nodes: [RecordedAlertSurfaceNode] = [] + func record(_ node: AlertSurfaceNode, parentIndex: Int?) { + let index = nodes.count + nodes.append(RecordedAlertSurfaceNode( + index: index, + parentIndex: parentIndex, + type: node.type, + identifier: node.identifier, + label: node.label, + rect: RecordedAlertSurfaceRect(frame: node.frame) + )) + node.children.forEach { record($0, parentIndex: index) } + } + record(alertSurfaceNode(snapshot), parentIndex: nil) + let encoder = JSONEncoder() + encoder.outputFormatting = [.sortedKeys] + try encoder.encode(nodes).write(to: URL(fileURLWithPath: output)) + } +} +#endif diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertTests.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertTests.swift index 168f510b98..0824a023e1 100644 --- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertTests.swift +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertTests.swift @@ -1,4 +1,5 @@ import XCTest +import AgentDeviceSnapshotPresentation #if AGENT_DEVICE_RUNNER_UNIT_TESTS extension RunnerTests { diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertVerificationTests.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertVerificationTests.swift index ec9aa22abe..10cb4f37f0 100644 --- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertVerificationTests.swift +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+AlertVerificationTests.swift @@ -1,10 +1,11 @@ import XCTest +import AgentDeviceSnapshotPresentation extension RunnerTests { #if AGENT_DEVICE_RUNNER_UNIT_TESTS func testAlertVerificationDoesNotConfuseASharedButtonWithTheOriginalPresentation() { - let original = RunnerAlertPresentation(title: "First permission", content: ["First body"], buttons: ["Allow"]) - let replacement = RunnerAlertPresentation(title: "Next permission", content: ["Next body"], buttons: ["Allow"]) + let original = AlertSurfacePresentation(title: "First permission", content: ["First body"], buttons: ["Allow"]) + let replacement = AlertSurfacePresentation(title: "Next permission", content: ["Next body"], buttons: ["Allow"]) XCTAssertEqual( RunnerAlertVerification.verify(original: original, observation: .visible(replacement)), .presentationChanged @@ -12,9 +13,9 @@ extension RunnerTests { } func testAlertVerificationComparesMoreThanTheTitle() { - let original = RunnerAlertPresentation(title: "Confirmation", content: ["First body"], buttons: ["Cancel", "OK"]) - let changedBody = RunnerAlertPresentation(title: "Confirmation", content: ["Next body"], buttons: ["Cancel", "OK"]) - let changedButtons = RunnerAlertPresentation(title: "Confirmation", content: ["First body"], buttons: ["Not now", "OK"]) + let original = AlertSurfacePresentation(title: "Confirmation", content: ["First body"], buttons: ["Cancel", "OK"]) + let changedBody = AlertSurfacePresentation(title: "Confirmation", content: ["Next body"], buttons: ["Cancel", "OK"]) + let changedButtons = AlertSurfacePresentation(title: "Confirmation", content: ["First body"], buttons: ["Not now", "OK"]) for replacement in [changedBody, changedButtons] { XCTAssertEqual( RunnerAlertVerification.verify(original: original, observation: .visible(replacement)), @@ -25,7 +26,7 @@ extension RunnerTests { func testAlertVerificationKeepsIdenticalOrTitlelessPresentationsUnconfirmed() { for title in ["Confirmation", ""] { - let original = RunnerAlertPresentation(title: title, content: [], buttons: ["OK"]) + let original = AlertSurfacePresentation(title: title, content: [], buttons: ["OK"]) XCTAssertEqual( RunnerAlertVerification.verify(original: original, observation: .visible(original)), .stillVisible @@ -34,7 +35,7 @@ extension RunnerTests { } func testAlertVerificationRequiresProvenAbsence() { - let original = RunnerAlertPresentation(title: "Confirmation", content: [], buttons: ["OK"]) + let original = AlertSurfacePresentation(title: "Confirmation", content: [], buttons: ["OK"]) XCTAssertEqual( RunnerAlertVerification.verify(original: original, observation: .absent), .disappeared diff --git a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+SystemModalTests.swift b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+SystemModalTests.swift index c78c5b46d9..d848007beb 100644 --- a/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+SystemModalTests.swift +++ b/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+SystemModalTests.swift @@ -21,15 +21,5 @@ extension RunnerTests { XCTAssertEqual(off.value, "0") XCTAssertEqual(on.value, "1") } - - func testSpringBoardModalIsPlacedInItsOwnPanelWindow() { - let outerPanel = CGRect(x: 0, y: 0, width: 466, height: 678) - let innerPanel = CGRect(x: 0, y: 0, width: 951, height: 669) - let innerPanelAlert = CGRect(x: 341, y: 250, width: 270, height: 170) - XCTAssertTrue(Self.isPlaced(innerPanelAlert, in: innerPanel)) - XCTAssertFalse(Self.isPlaced(innerPanelAlert, in: outerPanel)) - XCTAssertFalse(Self.isPlaced(innerPanelAlert, in: CGRect(x: 0, y: 0, width: CGFloat.infinity, height: 669))) - XCTAssertFalse(Self.isPlaced(.zero, in: innerPanel)) - } #endif } diff --git a/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/AlertSurface.swift b/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/AlertSurface.swift new file mode 100644 index 0000000000..a2f2f396bd --- /dev/null +++ b/apple/snapshot-presentation/Sources/AgentDeviceSnapshotPresentation/AlertSurface.swift @@ -0,0 +1,112 @@ +import CoreGraphics +import Foundation + +/// One node of an accessibility tree as the alert rules read it. `type` is the XCUIElement type +/// name ("Window", "Alert", "Other", ...), so a recorded tree and a live snapshot read the same. +public struct AlertSurfaceNode: Equatable { + public let type: String + public let identifier: String + public let label: String + public let frame: CGRect + public let children: [AlertSurfaceNode] + + public init(type: String, identifier: String, label: String, frame: CGRect, children: [AlertSurfaceNode]) { + self.type = type + self.identifier = identifier + self.label = label + self.frame = frame + self.children = children + } +} + +/// Which kind of surface an `alert` command answers. +public enum AlertSurfaceSource: String, CaseIterable, Codable { + case blockingSystemModal + case appAlert + case safariDialog + case dismissPopup +} + +public struct AlertSurfacePresentation: Equatable { + public let title: String + public let content: [String] + public let buttons: [String] + + public init(title: String, content: [String], buttons: [String]) { + self.title = title + self.content = content + self.buttons = buttons + } +} + +/// The rules that decide which node of a tree is an alert surface. The runner observes alerts +/// through these rules, and recorded trees in the test corpus replay them on the host. +public enum AlertSurface { + /// Safari draws its page prompts, such as "Open this page in …?" and JavaScript dialogs, as a + /// view rather than an alert, so they are found by the view's identifier. + public static let safariDialogIdentifier = "SFDialogView" + + /// A popover's dismiss region: a label or identifier that reads "dismiss popup", in any case, + /// with any surrounding whitespace. XCTest queries take it as a `MATCHES[c]` pattern. + public static let dismissPopupMarkerPattern = #"\s*dismiss popup\s*"# + + /// Element types an alert action can be. Kept narrow to avoid generic hittable containers. + public static let actionableTypes: Set = ["Button", "Cell", "Link", "MenuItem", "CheckBox", "Switch"] + + public static func isDismissPopupMarker(_ text: String) -> Bool { + text.range(of: "^\(dismissPopupMarkerPattern)$", options: [.regularExpression, .caseInsensitive]) != nil + } + + /// Whether a node is on screen in the window that hosts it. A foldable's SpringBoard has a + /// window on each panel, and the application frame names only one of them. + public static func isPlaced(_ frame: CGRect, in hostWindow: CGRect) -> Bool { + SnapshotGeometry.isPositiveFinite(frame) && SnapshotGeometry.isPositiveFinite(hostWindow) + && hostWindow.contains(CGPoint(x: frame.midX, y: frame.midY)) + } + + /// The surfaces of `source` in `root`, each placed in the box it sits in. A window is placed in + /// its parent's box and is itself the box of what it hosts. + public static func candidates(in root: AlertSurfaceNode, source: AlertSurfaceSource, viewport: CGRect) -> [AlertSurfaceNode] { + if matches(root, source: source) && isPlaced(root.frame, in: viewport) { return [root] } + let childViewport = root.type == "Window" && SnapshotGeometry.isPositiveFinite(root.frame) ? root.frame : viewport + return root.children.flatMap { candidates(in: $0, source: source, viewport: childViewport) } + } + + public static func presentation(of surface: AlertSurfaceNode) -> AlertSurfacePresentation { + var content: [String] = [] + var buttons: [String] = [] + func collect(_ node: AlertSurfaceNode) { + let label = node.label.trimmingCharacters(in: .whitespacesAndNewlines) + if actionableTypes.contains(node.type) { + buttons.append(label) + } else if !label.isEmpty { + content.append(label) + } + node.children.forEach(collect) + } + surface.children.forEach(collect) + return AlertSurfacePresentation( + title: surface.label.trimmingCharacters(in: .whitespacesAndNewlines), + content: content, + buttons: buttons + ) + } + + private static func matches(_ node: AlertSurfaceNode, source: AlertSurfaceSource) -> Bool { + switch source { + case .blockingSystemModal: + return node.type == "Alert" || node.type == "Sheet" + case .appAlert: + return node.type == "Alert" + case .safariDialog: + return node.identifier == safariDialogIdentifier + case .dismissPopup: + return node.type == "Window" && containsDismissPopupMarker(node) + } + } + + private static func containsDismissPopupMarker(_ node: AlertSurfaceNode) -> Bool { + isDismissPopupMarker(node.label) || isDismissPopupMarker(node.identifier) + || node.children.contains { containsDismissPopupMarker($0) } + } +} diff --git a/apple/snapshot-presentation/Tests/AgentDeviceSnapshotPresentationTests/AlertSurfaceTests.swift b/apple/snapshot-presentation/Tests/AgentDeviceSnapshotPresentationTests/AlertSurfaceTests.swift new file mode 100644 index 0000000000..b9d350121b --- /dev/null +++ b/apple/snapshot-presentation/Tests/AgentDeviceSnapshotPresentationTests/AlertSurfaceTests.swift @@ -0,0 +1,118 @@ +import CoreGraphics +import Foundation +import XCTest +@testable import AgentDeviceSnapshotPresentation + +/// A tree recorded by `pnpm capture:alert-surface`, and what the alert rules must find in it. +/// `nodes` are never edited by hand. `expect` names, for each source, the one surface that source +/// must find; a source it does not name must find nothing. +private struct RecordedAlertSurface: Decodable { + struct Node: Decodable { + let index: Int + let parentIndex: Int? + let type: String + let identifier: String + let label: String + let rect: FixtureRect + } + + struct Expectation: Decodable { + let title: String + let buttons: [String] + } + + let capture: [String: String] + let expect: [String: Expectation] + let nodes: [Node] + + func tree() throws -> AlertSurfaceNode { + var children: [Int: [Int]] = [:] + for node in nodes { + if let parent = node.parentIndex { children[parent, default: []].append(node.index) } + } + func build(_ index: Int) -> AlertSurfaceNode { + let node = nodes[index] + return AlertSurfaceNode( + type: node.type, + identifier: node.identifier, + label: node.label, + frame: node.rect.cgRect, + children: (children[index] ?? []).map(build) + ) + } + // A preorder list: each node's index is its position, and its parent comes before it. + let wellFormed = nodes.indices.allSatisfy { position in + let node = nodes[position] + guard node.index == position else { return false } + guard let parent = node.parentIndex else { return position == 0 } + return parent >= 0 && parent < position + } + guard wellFormed, !nodes.isEmpty else { throw CocoaError(.coderReadCorrupt) } + return build(0) + } +} + +final class AlertSurfaceTests: XCTestCase { + func testEveryRecordedSurfaceIsFoundByItsSourceOnly() throws { + let files = try FileManager.default.contentsOfDirectory(at: alertSurfaceCorpusURL(), includingPropertiesForKeys: nil) + .filter { $0.pathExtension == "json" } + .sorted { $0.lastPathComponent < $1.lastPathComponent } + XCTAssertFalse(files.isEmpty) + let decoder = JSONDecoder() + for file in files { + let name = file.lastPathComponent + let recorded = try decoder.decode(RecordedAlertSurface.self, from: Data(contentsOf: file)) + let root = try recorded.tree() + for key in recorded.expect.keys { + XCTAssertNotNil(AlertSurfaceSource(rawValue: key), "\(name): unknown source \(key)") + } + for source in AlertSurfaceSource.allCases { + let found = AlertSurface.candidates(in: root, source: source, viewport: root.frame) + .map { AlertSurface.presentation(of: $0) } + let expected = recorded.expect[source.rawValue] + XCTAssertEqual(found.map(\.title), expected.map { [$0.title] } ?? [], "\(name): \(source) title") + XCTAssertEqual(found.map(\.buttons), expected.map { [$0.buttons] } ?? [], "\(name): \(source) buttons") + } + } + } + + func testAModalIsPlacedInItsOwnPanelWindow() { + let outerPanel = CGRect(x: 0, y: 0, width: 466, height: 678) + let innerPanel = CGRect(x: 0, y: 0, width: 951, height: 669) + let innerPanelAlert = CGRect(x: 341, y: 250, width: 270, height: 170) + XCTAssertTrue(AlertSurface.isPlaced(innerPanelAlert, in: innerPanel)) + XCTAssertFalse(AlertSurface.isPlaced(innerPanelAlert, in: outerPanel)) + XCTAssertFalse(AlertSurface.isPlaced(innerPanelAlert, in: CGRect(x: 0, y: 0, width: CGFloat.infinity, height: 669))) + XCTAssertFalse(AlertSurface.isPlaced(.zero, in: innerPanel)) + } + + func testAnInnerPanelAlertIsPlacedInItsWindowNotTheApplicationFrame() { + let alert = AlertSurfaceNode(type: "Alert", identifier: "", label: "", frame: CGRect(x: 341, y: 250, width: 270, height: 170), children: []) + let innerPanel = AlertSurfaceNode(type: "Window", identifier: "", label: "", frame: CGRect(x: 0, y: 0, width: 951, height: 669), children: [alert]) + let root = AlertSurfaceNode(type: "Application", identifier: "", label: "", frame: CGRect(x: 0, y: 0, width: 466, height: 678), children: [innerPanel]) + XCTAssertEqual(AlertSurface.candidates(in: root, source: .appAlert, viewport: root.frame), [alert]) + } + + func testADismissPopupWindowIsPlacedInTheBoxItSitsIn() { + let viewport = CGRect(x: 0, y: 0, width: 402, height: 874) + func popup(x: CGFloat) -> AlertSurfaceNode { + let frame = CGRect(x: x, y: 0, width: 402, height: 874) + let marker = AlertSurfaceNode(type: "Other", identifier: "", label: "dismiss popup", frame: frame, children: []) + return AlertSurfaceNode(type: "Window", identifier: "", label: "", frame: frame, children: [marker]) + } + XCTAssertEqual(AlertSurface.candidates(in: popup(x: 0), source: .dismissPopup, viewport: viewport).count, 1) + XCTAssertTrue(AlertSurface.candidates(in: popup(x: 1000), source: .dismissPopup, viewport: viewport).isEmpty) + } + + func testTheDismissPopupMarkerMatchesTheWholeLabelInAnyCase() { + XCTAssertTrue(AlertSurface.isDismissPopupMarker(" Dismiss Popup ")) + XCTAssertFalse(AlertSurface.isDismissPopupMarker("dismiss popup now")) + } +} + +private func alertSurfaceCorpusURL(from filePath: String = #filePath) -> URL { + URL(fileURLWithPath: filePath) + .deletingLastPathComponent() // AgentDeviceSnapshotPresentationTests + .deletingLastPathComponent() // Tests + .appendingPathComponent("AlertSurfaceCorpus") +} diff --git a/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/README.md b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/README.md new file mode 100644 index 0000000000..de61848cc9 --- /dev/null +++ b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/README.md @@ -0,0 +1,30 @@ +# Alert surface corpus + +Each file is a whole accessibility tree recorded from a real simulator, and what the alert rules in +`AlertSurface` must find in it. `AlertSurfaceTests` replays every file on the host with +`swift test --package-path apple/snapshot-presentation`, so a rule change that loses a real prompt +fails without a device. + +## Add a fixture + +1. Put the screen in the state you want, using an agent-device session: open the app, `fold`, and + raise the prompt. For prompt recipes, see `examples/test-app/README.md`. +2. Release the runner, because the capture runs its own XCTest process on the same simulator: + `agent-device daemon stop --state-dir --clean`. +3. Capture the app that hosts the prompt (`com.apple.springboard` for a system alert): + `pnpm capture:alert-surface --udid --bundle --name ---`. +4. Add `expect` from the screenshot. For each source that must find the prompt, give its title and + buttons. A source you leave out must find nothing, and `{}` marks a screen with no prompt. + +Don't edit `nodes` by hand. Capture again instead; the script keeps the existing `expect`. + +## What it covers + +The corpus tests the rules that read `XCUIApplication.snapshot()` trees: what counts as each kind of +prompt, which window hosts it, and the presentation the runner compares after a tap. The +SpringBoard probe and button taps read `XCUIElement.frame` instead. On a foldable, those frames use +the interface orientation, while snapshot frames use the panel's native orientation, so this corpus +does not cover them. + +A title is the prompt node's own label. Safari's `SFDialogView` has none, so its title is empty here. +`alert get` reads the message text instead. diff --git a/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-folded-safari-open-this-page-in-app.json b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-folded-safari-open-this-page-in-app.json new file mode 100644 index 0000000000..68cbe8bd4a --- /dev/null +++ b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-folded-safari-open-this-page-in-app.json @@ -0,0 +1,143 @@ +{ + "capture": { + "bundle": "com.apple.mobilesafari", + "device": "iPhone Duo", + "runtime": "iOS-27-1", + "commit": "f3b09b4748" + }, + "expect": { + "safariDialog": { + "title": "", + "buttons": [ + "Cancel", + "Open" + ] + } + }, + "nodes": [ + {"identifier":"","index":0,"label":"Safari","rect":{"height":678,"width":466,"x":0,"y":0},"type":"Application"}, + {"identifier":"","index":1,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":2,"label":"","parentIndex":1,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":3,"label":"","parentIndex":2,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"SafariWindow?View=Narrow&BarsKeptMinimized=false&UUID=FE93DE75-8A2C-42A5-A6C4-438F93942A9A&UsingLoweredBar=true&IsSecure=true&IsTabBarAvailable=true","index":4,"label":"","parentIndex":3,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":5,"label":"","parentIndex":4,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":6,"label":"","parentIndex":5,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":7,"label":"","parentIndex":6,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"ScrollView"}, + {"identifier":"TabDocument?IsLoadedUsingDesktopUserAgent=false&InReaderMode=false&UUID=A0E72B5C-A901-499B-8650-6061BBB358C5&IsPrivate=false&IsPageLoaded=true&WebViewProcessID=79910","index":8,"label":"","parentIndex":7,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"WebView","index":9,"label":"","parentIndex":8,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"WebView"}, + {"identifier":"","index":10,"label":"","parentIndex":9,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":11,"label":"","parentIndex":10,"rect":{"height":358,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"SFDialogView","index":12,"label":"","parentIndex":10,"rect":{"height":119,"width":342,"x":20,"y":119.66666666666669},"type":"Other"}, + {"identifier":"SFDialogViewMessageText","index":13,"label":"","parentIndex":12,"rect":{"height":76,"width":342,"x":20,"y":119.66666666666669},"type":"StaticText"}, + {"identifier":"","index":14,"label":"","parentIndex":13,"rect":{"height":76,"width":342,"x":20,"y":119.66666666666669},"type":"TextView"}, + {"identifier":"","index":15,"label":"Open this page in “Agent Device Tester”?","parentIndex":14,"rect":{"height":44,"width":249.0234375,"x":40,"y":135.66666666666669},"type":"TextView"}, + {"identifier":"","index":16,"label":"Vertical scroll bar, 1 page","parentIndex":14,"rect":{"height":76,"width":30,"x":329,"y":119.66666666666669},"type":"Other"}, + {"identifier":"","index":17,"label":"","parentIndex":16,"rect":{"height":70,"width":3,"x":356,"y":122.66666666666669},"type":"Other"}, + {"identifier":"","index":18,"label":"Horizontal scroll bar, 1 page","parentIndex":14,"rect":{"height":30,"width":342,"x":20,"y":162.66666666666669},"type":"Other"}, + {"identifier":"","index":19,"label":"","parentIndex":18,"rect":{"height":3,"width":336,"x":23,"y":189.66666666666669},"type":"Other"}, + {"identifier":"","index":20,"label":"Cancel","parentIndex":12,"rect":{"height":33,"width":53,"x":226,"y":195.66666666666669},"type":"Button"}, + {"identifier":"","index":21,"label":"Cancel","parentIndex":20,"rect":{"height":21,"width":53,"x":226,"y":201.66666666666669},"type":"StaticText"}, + {"identifier":"","index":22,"label":"Open","parentIndex":12,"rect":{"height":33,"width":43,"x":299,"y":195.66666666666669},"type":"Button"}, + {"identifier":"","index":23,"label":"Open","parentIndex":22,"rect":{"height":21,"width":43,"x":299,"y":201.66666666666669},"type":"StaticText"}, + {"identifier":"","index":24,"label":"","parentIndex":10,"rect":{"height":320,"width":466,"x":0,"y":358},"type":"Other"}, + {"identifier":"","index":25,"label":"Horizontal scroll bar, 1 page","parentIndex":7,"rect":{"height":30,"width":399,"x":8,"y":645},"type":"Other"}, + {"identifier":"","index":26,"label":"","parentIndex":25,"rect":{"height":3,"width":393,"x":11,"y":672},"type":"Other"}, + {"identifier":"","index":27,"label":"Horizontal scroll bar, 1 page","parentIndex":7,"rect":{"height":30,"width":399,"x":8,"y":645},"type":"Other"}, + {"identifier":"","index":28,"label":"","parentIndex":27,"rect":{"height":3,"width":393,"x":11,"y":672},"type":"Other"}, + {"identifier":"CapsuleViewController","index":29,"label":"","parentIndex":4,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":30,"label":"","parentIndex":29,"rect":{"height":678,"width":84,"x":382,"y":0},"type":"Other"}, + {"identifier":"","index":31,"label":"","parentIndex":30,"rect":{"height":678,"width":84,"x":382,"y":0},"type":"Other"}, + {"identifier":"","index":32,"label":"","parentIndex":31,"rect":{"height":678,"width":84,"x":382,"y":0},"type":"Other"}, + {"identifier":"","index":33,"label":"","parentIndex":32,"rect":{"height":678,"width":84,"x":382,"y":0},"type":"Other"}, + {"identifier":"","index":34,"label":"","parentIndex":33,"rect":{"height":678,"width":84,"x":382,"y":0},"type":"Other"}, + {"identifier":"","index":35,"label":"","parentIndex":34,"rect":{"height":678,"width":84,"x":382,"y":0},"type":"Other"}, + {"identifier":"","index":36,"label":"","parentIndex":35,"rect":{"height":678,"width":84,"x":382,"y":0},"type":"Other"}, + {"identifier":"","index":37,"label":"","parentIndex":33,"rect":{"height":678,"width":84,"x":382,"y":0},"type":"Other"}, + {"identifier":"","index":38,"label":"","parentIndex":37,"rect":{"height":678,"width":84,"x":382,"y":0},"type":"Other"}, + {"identifier":"","index":39,"label":"","parentIndex":30,"rect":{"height":474,"width":48,"x":394,"y":170},"type":"Other"}, + {"identifier":"","index":40,"label":"","parentIndex":39,"rect":{"height":450,"width":48,"x":394,"y":194},"type":"Other"}, + {"identifier":"","index":41,"label":"","parentIndex":40,"rect":{"height":108,"width":48,"x":394,"y":194},"type":"Other"}, + {"identifier":"","index":42,"label":"","parentIndex":41,"rect":{"height":48,"width":48,"x":394,"y":194},"type":"Other"}, + {"identifier":"BackButton","index":43,"label":"Back","parentIndex":42,"rect":{"height":48,"width":48,"x":394,"y":194},"type":"Button"}, + {"identifier":"","index":44,"label":"","parentIndex":41,"rect":{"height":48,"width":48,"x":394,"y":254},"type":"Other"}, + {"identifier":"SidebarButton","index":45,"label":"Show Bookmarks","parentIndex":44,"rect":{"height":48,"width":48,"x":394,"y":254},"type":"Button"}, + {"identifier":"","index":46,"label":"","parentIndex":40,"rect":{"height":102,"width":48,"x":394,"y":542},"type":"Other"}, + {"identifier":"","index":47,"label":"","parentIndex":46,"rect":{"height":102,"width":48,"x":394,"y":542},"type":"Other"}, + {"identifier":"NewTabButton","index":48,"label":"New tab","parentIndex":47,"rect":{"height":48,"width":48,"x":394,"y":542},"type":"Button"}, + {"identifier":"TabOverviewButton","index":49,"label":"Tabs","parentIndex":47,"rect":{"height":48,"width":48,"x":394,"y":596},"type":"Button"}, + {"identifier":"","index":50,"label":"","parentIndex":29,"rect":{"height":98,"width":466,"x":0,"y":580},"type":"Other"}, + {"identifier":"","index":51,"label":"","parentIndex":50,"rect":{"height":98,"width":466,"x":0,"y":580},"type":"Other"}, + {"identifier":"","index":52,"label":"","parentIndex":51,"rect":{"height":98,"width":466,"x":0,"y":580},"type":"Other"}, + {"identifier":"","index":53,"label":"","parentIndex":52,"rect":{"height":98,"width":466,"x":0,"y":580},"type":"Other"}, + {"identifier":"","index":54,"label":"","parentIndex":53,"rect":{"height":98,"width":466,"x":0,"y":580},"type":"Other"}, + {"identifier":"","index":55,"label":"","parentIndex":54,"rect":{"height":98,"width":466,"x":0,"y":580},"type":"Other"}, + {"identifier":"","index":56,"label":"","parentIndex":55,"rect":{"height":98,"width":466,"x":0,"y":580},"type":"Other"}, + {"identifier":"","index":57,"label":"","parentIndex":53,"rect":{"height":98,"width":466,"x":0,"y":580},"type":"Other"}, + {"identifier":"","index":58,"label":"","parentIndex":57,"rect":{"height":98,"width":466,"x":0,"y":580},"type":"Other"}, + {"identifier":"","index":59,"label":"","parentIndex":50,"rect":{"height":48,"width":334,"x":24,"y":596},"type":"Other"}, + {"identifier":"","index":60,"label":"","parentIndex":59,"rect":{"height":48,"width":334,"x":24,"y":596},"type":"Other"}, + {"identifier":"","index":61,"label":"","parentIndex":60,"rect":{"height":48,"width":334,"x":24,"y":596},"type":"Other"}, + {"identifier":"CapsuleNavigationBar?isSelected=true&isDistractionControlOverlayUp=false","index":62,"label":"","parentIndex":61,"rect":{"height":48,"width":334,"x":24,"y":596},"type":"Other"}, + {"identifier":"","index":63,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":64,"label":"","parentIndex":63,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":65,"label":"","parentIndex":64,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":66,"label":"","parentIndex":64,"rect":{"height":320,"width":466,"x":0,"y":358},"type":"Other"}, + {"identifier":"","index":67,"label":"","parentIndex":66,"rect":{"height":68,"width":466,"x":0,"y":358},"type":"Other"}, + {"identifier":"inputView","index":68,"label":"","parentIndex":66,"rect":{"height":252,"width":346,"x":60,"y":426},"type":"Other"}, + {"identifier":"","index":69,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":70,"label":"","parentIndex":69,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":71,"label":"","parentIndex":70,"rect":{"height":320,"width":466,"x":0,"y":358},"type":"Other"}, + {"identifier":"","index":72,"label":"","parentIndex":71,"rect":{"height":68,"width":466,"x":0,"y":358},"type":"Other"}, + {"identifier":"","index":73,"label":"","parentIndex":71,"rect":{"height":253,"width":466,"x":0,"y":426},"type":"Other"}, + {"identifier":"","index":74,"label":"","parentIndex":73,"rect":{"height":253,"width":466,"x":0,"y":426},"type":"Other"}, + {"identifier":"","index":75,"label":"","parentIndex":74,"rect":{"height":253,"width":466,"x":0,"y":426},"type":"Other"}, + {"identifier":"","index":76,"label":"","parentIndex":71,"rect":{"height":245,"width":466,"x":0,"y":433},"type":"Other"}, + {"identifier":"","index":77,"label":"Next keyboard","parentIndex":76,"rect":{"height":68.73516393505099,"width":68.0852958475086,"x":3.957352076245698,"y":587.6324180324746},"type":"Button"}, + {"identifier":"","index":78,"label":"","parentIndex":77,"rect":{"height":0,"width":0,"x":3.957352076245698,"y":587.6324180324746},"type":"StaticText"}, + {"identifier":"dictation","index":79,"label":"Dictate","parentIndex":76,"rect":{"height":68.73516393505099,"width":68.08529584750863,"x":393.9573520762457,"y":587.6324180324746},"type":"Button"}, + {"identifier":"","index":80,"label":"","parentIndex":79,"rect":{"height":0,"width":0,"x":393.9573520762457,"y":587.6324180324746},"type":"StaticText"}, + {"identifier":"","index":81,"label":"","parentIndex":71,"rect":{"height":230,"width":438.66666666666674,"x":13.666666666666657,"y":433},"type":"Other"}, + {"identifier":"","index":82,"label":"","parentIndex":81,"rect":{"height":230,"width":438.66666666666674,"x":13.666666666666657,"y":433},"type":"Keyboard"}, + {"identifier":"","index":83,"label":"","parentIndex":82,"rect":{"height":230,"width":438.66666666666674,"x":13.666666666666657,"y":433},"type":"Other"}, + {"identifier":"UIKeyboardLayoutStar Preview","index":84,"label":"","parentIndex":83,"rect":{"height":230,"width":438.66666666666674,"x":13.666666666666657,"y":433},"type":"Other"}, + {"identifier":"","index":85,"label":"Padding-Left","parentIndex":84,"rect":{"height":0,"width":0,"x":13.666666666666657,"y":433},"type":"Key"}, + {"identifier":"","index":86,"label":"q","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.666666666666664,"x":15.666666666666657,"y":438},"type":"Key"}, + {"identifier":"","index":87,"label":"w","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.66666666666667,"x":59.33333333333333,"y":438},"type":"Key"}, + {"identifier":"","index":88,"label":"e","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.66666666666667,"x":102.99999999999999,"y":438},"type":"Key"}, + {"identifier":"","index":89,"label":"r","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.66666666666666,"x":146.66666666666666,"y":438},"type":"Key"}, + {"identifier":"","index":90,"label":"t","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.66666666666666,"x":190.33333333333334,"y":438},"type":"Key"}, + {"identifier":"","index":91,"label":"y","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.66666666666663,"x":234,"y":438},"type":"Key"}, + {"identifier":"","index":92,"label":"u","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.66666666666674,"x":277.66666666666663,"y":438},"type":"Key"}, + {"identifier":"","index":93,"label":"i","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.66666666666674,"x":321.33333333333326,"y":438},"type":"Key"}, + {"identifier":"","index":94,"label":"o","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.66666666666663,"x":365,"y":438},"type":"Key"}, + {"identifier":"","index":95,"label":"p","parentIndex":84,"rect":{"height":52.666666666666686,"width":43.66666666666674,"x":408.66666666666663,"y":438},"type":"Key"}, + {"identifier":"","index":96,"label":"Padding-Right","parentIndex":84,"rect":{"height":0,"width":0,"x":13.666666666666657,"y":433},"type":"Key"}, + {"identifier":"","index":97,"label":"Padding-Left","parentIndex":84,"rect":{"height":0,"width":0,"x":13.666666666666657,"y":433},"type":"Key"}, + {"identifier":"","index":98,"label":"a","parentIndex":84,"rect":{"height":53,"width":43.66666666666666,"x":37.33333333333333,"y":490.66666666666663},"type":"Key"}, + {"identifier":"","index":99,"label":"s","parentIndex":84,"rect":{"height":53,"width":43.66666666666667,"x":80.99999999999999,"y":490.66666666666663},"type":"Key"}, + {"identifier":"","index":100,"label":"d","parentIndex":84,"rect":{"height":53,"width":43.66666666666667,"x":124.66666666666667,"y":490.66666666666663},"type":"Key"}, + {"identifier":"","index":101,"label":"f","parentIndex":84,"rect":{"height":53,"width":43.66666666666666,"x":168.33333333333334,"y":490.66666666666663},"type":"Key"}, + {"identifier":"","index":102,"label":"g","parentIndex":84,"rect":{"height":53,"width":44,"x":212,"y":490.66666666666663},"type":"Key"}, + {"identifier":"","index":103,"label":"h","parentIndex":84,"rect":{"height":53,"width":43.66666666666663,"x":256,"y":490.66666666666663},"type":"Key"}, + {"identifier":"","index":104,"label":"j","parentIndex":84,"rect":{"height":53,"width":43.66666666666674,"x":299.66666666666663,"y":490.66666666666663},"type":"Key"}, + {"identifier":"","index":105,"label":"k","parentIndex":84,"rect":{"height":53,"width":43.66666666666674,"x":343.33333333333326,"y":490.66666666666663},"type":"Key"}, + {"identifier":"","index":106,"label":"l","parentIndex":84,"rect":{"height":53,"width":43.66666666666663,"x":387,"y":490.66666666666663},"type":"Key"}, + {"identifier":"","index":107,"label":"Padding-Right","parentIndex":84,"rect":{"height":0,"width":0,"x":13.666666666666657,"y":433},"type":"Key"}, + {"identifier":"shift","index":108,"label":"shift","parentIndex":84,"rect":{"height":52.66666666666663,"width":56.66666666666666,"x":15.666666666666657,"y":543.6666666666666},"type":"Button"}, + {"identifier":"","index":109,"label":"Padding-Left","parentIndex":84,"rect":{"height":0,"width":0,"x":13.666666666666657,"y":433},"type":"Key"}, + {"identifier":"","index":110,"label":"z","parentIndex":84,"rect":{"height":52.66666666666663,"width":43.66666666666667,"x":80.99999999999999,"y":543.6666666666666},"type":"Key"}, + {"identifier":"","index":111,"label":"x","parentIndex":84,"rect":{"height":52.66666666666663,"width":43.66666666666667,"x":124.66666666666667,"y":543.6666666666666},"type":"Key"}, + {"identifier":"","index":112,"label":"c","parentIndex":84,"rect":{"height":52.66666666666663,"width":43.66666666666666,"x":168.33333333333334,"y":543.6666666666666},"type":"Key"}, + {"identifier":"","index":113,"label":"v","parentIndex":84,"rect":{"height":52.66666666666663,"width":44,"x":212,"y":543.6666666666666},"type":"Key"}, + {"identifier":"","index":114,"label":"b","parentIndex":84,"rect":{"height":52.66666666666663,"width":43.66666666666663,"x":256,"y":543.6666666666666},"type":"Key"}, + {"identifier":"","index":115,"label":"n","parentIndex":84,"rect":{"height":52.66666666666663,"width":43.66666666666674,"x":299.66666666666663,"y":543.6666666666666},"type":"Key"}, + {"identifier":"","index":116,"label":"m","parentIndex":84,"rect":{"height":52.66666666666663,"width":43.66666666666674,"x":343.33333333333326,"y":543.6666666666666},"type":"Key"}, + {"identifier":"","index":117,"label":"Padding-Right","parentIndex":84,"rect":{"height":0,"width":0,"x":13.666666666666657,"y":433},"type":"Key"}, + {"identifier":"delete","index":118,"label":"delete","parentIndex":84,"rect":{"height":52.66666666666663,"width":56.66666666666674,"x":395.66666666666663,"y":543.6666666666666},"type":"Key"}, + {"identifier":"more","index":119,"label":"numbers","parentIndex":84,"rect":{"height":52.66666666666663,"width":43.66666666666666,"x":63.66666666666666,"y":596.3333333333334},"type":"Key"}, + {"identifier":"emoji","index":120,"label":"Emoji","parentIndex":84,"rect":{"height":52.66666666666663,"width":43.66666666666666,"x":107.33333333333331,"y":596.3333333333334},"type":"Button"}, + {"identifier":"space","index":121,"label":"space","parentIndex":84,"rect":{"height":52.66666666666663,"width":157.3333333333333,"x":150.99999999999997,"y":596.3333333333334},"type":"Key"}, + {"identifier":"","index":122,"label":".","parentIndex":84,"rect":{"height":52.66666666666663,"width":35,"x":308.33333333333326,"y":596.3333333333334},"type":"Key"}, + {"identifier":"Go","index":123,"label":"go","parentIndex":84,"rect":{"height":52.66666666666663,"width":61,"x":343.33333333333326,"y":596.3333333333334},"type":"Button"} + ] +} diff --git a/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-folded-springboard-open-in-app.json b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-folded-springboard-open-in-app.json new file mode 100644 index 0000000000..25a567066d --- /dev/null +++ b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-folded-springboard-open-in-app.json @@ -0,0 +1,67 @@ +{ + "capture": { + "bundle": "com.apple.springboard", + "device": "iPhone Duo (fixtures)", + "runtime": "iOS-27-1", + "commit": "f3b09b4748" + }, + "expect": { + "blockingSystemModal": { + "title": "Open in “Agent Device Tester”?", + "buttons": [ + "Cancel", + "Open" + ] + }, + "appAlert": { + "title": "Open in “Agent Device Tester”?", + "buttons": [ + "Cancel", + "Open" + ] + } + }, + "nodes": [ + {"identifier":"","index":0,"label":" ","rect":{"height":678,"width":466,"x":0,"y":0},"type":"Application"}, + {"identifier":"","index":1,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":2,"label":"","parentIndex":1,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":3,"label":"Open in “Agent Device Tester”?","parentIndex":2,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Alert"}, + {"identifier":"","index":4,"label":"","parentIndex":3,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":5,"label":"","parentIndex":4,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":6,"label":"","parentIndex":5,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":7,"label":"","parentIndex":5,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":8,"label":"","parentIndex":7,"rect":{"height":46,"width":320,"x":61,"y":272},"type":"ScrollView"}, + {"identifier":"","index":9,"label":"","parentIndex":8,"rect":{"height":46,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":10,"label":"Open in “Agent Device Tester”?","parentIndex":9,"rect":{"height":20.333333333333314,"width":260,"x":91,"y":293.6666666666667},"type":"StaticText"}, + {"identifier":"","index":11,"label":"","parentIndex":8,"rect":{"height":2,"width":320,"x":61,"y":316},"type":"Other"}, + {"identifier":"","index":12,"label":"Vertical scroll bar, 2 pages","parentIndex":8,"rect":{"height":46,"width":30,"x":348,"y":272},"type":"Other"}, + {"identifier":"","index":13,"label":"","parentIndex":12,"rect":{"height":36,"width":3,"x":375,"y":233},"type":"Other"}, + {"identifier":"","index":14,"label":"Horizontal scroll bar, 1 page","parentIndex":8,"rect":{"height":23,"width":320,"x":61,"y":292},"type":"Other"}, + {"identifier":"","index":15,"label":"","parentIndex":14,"rect":{"height":3,"width":36,"x":22,"y":312},"type":"Other"}, + {"identifier":"","index":16,"label":"Vertical scroll bar, 2 pages","parentIndex":8,"rect":{"height":46,"width":30,"x":348,"y":272},"type":"Other"}, + {"identifier":"","index":17,"label":"","parentIndex":16,"rect":{"height":36,"width":3,"x":375,"y":233},"type":"Other"}, + {"identifier":"","index":18,"label":"Horizontal scroll bar, 1 page","parentIndex":8,"rect":{"height":23,"width":320,"x":61,"y":292},"type":"Other"}, + {"identifier":"","index":19,"label":"","parentIndex":18,"rect":{"height":3,"width":36,"x":22,"y":312},"type":"Other"}, + {"identifier":"","index":20,"label":"","parentIndex":7,"rect":{"height":80,"width":320,"x":61,"y":318},"type":"ScrollView"}, + {"identifier":"","index":21,"label":"","parentIndex":20,"rect":{"height":80,"width":320,"x":61,"y":318},"type":"Other"}, + {"identifier":"","index":22,"label":"","parentIndex":21,"rect":{"height":48,"width":288,"x":77,"y":334},"type":"Other"}, + {"identifier":"","index":23,"label":"Cancel","parentIndex":22,"rect":{"height":48,"width":140,"x":77,"y":334},"type":"Button"}, + {"identifier":"","index":24,"label":"Open","parentIndex":22,"rect":{"height":48,"width":140,"x":225,"y":334},"type":"Button"}, + {"identifier":"","index":25,"label":"Vertical scroll bar, 1 page","parentIndex":20,"rect":{"height":80,"width":30,"x":348,"y":318},"type":"Other"}, + {"identifier":"","index":26,"label":"","parentIndex":25,"rect":{"height":7,"width":3,"x":375,"y":408},"type":"Other"}, + {"identifier":"","index":27,"label":"Horizontal scroll bar, 1 page","parentIndex":20,"rect":{"height":30,"width":320,"x":61,"y":365},"type":"Other"}, + {"identifier":"","index":28,"label":"","parentIndex":27,"rect":{"height":3,"width":7,"x":151,"y":392},"type":"Other"}, + {"identifier":"","index":29,"label":"Vertical scroll bar, 1 page","parentIndex":20,"rect":{"height":80,"width":30,"x":348,"y":318},"type":"Other"}, + {"identifier":"","index":30,"label":"","parentIndex":29,"rect":{"height":7,"width":3,"x":375,"y":408},"type":"Other"}, + {"identifier":"","index":31,"label":"Horizontal scroll bar, 1 page","parentIndex":20,"rect":{"height":30,"width":320,"x":61,"y":365},"type":"Other"}, + {"identifier":"","index":32,"label":"","parentIndex":31,"rect":{"height":3,"width":7,"x":151,"y":392},"type":"Other"}, + {"identifier":"","index":33,"label":"","parentIndex":3,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":34,"label":"","parentIndex":33,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":35,"label":"","parentIndex":34,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":36,"label":"","parentIndex":35,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":37,"label":"","parentIndex":36,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":38,"label":"","parentIndex":37,"rect":{"height":678,"width":466,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":39,"label":"","parentIndex":35,"rect":{"height":126,"width":320,"x":61,"y":272},"type":"Other"}, + {"identifier":"","index":40,"label":"","parentIndex":39,"rect":{"height":678,"width":466,"x":61,"y":272},"type":"Other"} + ] +} diff --git a/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-folded-springboard-without-alert.json b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-folded-springboard-without-alert.json new file mode 100644 index 0000000000..467e8e5d92 --- /dev/null +++ b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-folded-springboard-without-alert.json @@ -0,0 +1,266 @@ +{ + "capture": { + "bundle": "com.apple.springboard", + "device": "iPhone Duo (fixtures)", + "runtime": "iOS-27-1", + "commit": "f3b09b4748" + }, + "expect": {}, + "nodes": [ + {"identifier":"","index":0,"label":" ","rect":{"height":678,"width":466,"x":0,"y":0},"type":"Application"}, + {"identifier":"","index":1,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":2,"label":"","parentIndex":1,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":3,"label":"","parentIndex":2,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":4,"label":"","parentIndex":3,"rect":{"height":951,"width":100,"x":0,"y":0},"type":"Other"}, + {"identifier":"Home screen icons","index":5,"label":"","parentIndex":2,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":6,"label":"","parentIndex":5,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":7,"label":"","parentIndex":6,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":8,"label":"","parentIndex":7,"rect":{"height":0,"width":0,"x":0,"y":0},"type":"Element(44)"}, + {"identifier":"Settings","index":9,"label":"Settings","parentIndex":8,"rect":{"height":68,"width":86.66666666666666,"x":52,"y":814.3333333333335},"type":"Element(44)"}, + {"identifier":"","index":10,"label":"","parentIndex":9,"rect":{"height":60,"width":74,"x":54,"y":818},"type":"Other"}, + {"identifier":"","index":11,"label":"","parentIndex":10,"rect":{"height":60,"width":60,"x":54,"y":818},"type":"Other"}, + {"identifier":"","index":12,"label":"","parentIndex":11,"rect":{"height":60,"width":60,"x":54,"y":818},"type":"Other"}, + {"identifier":"","index":13,"label":"","parentIndex":12,"rect":{"height":60,"width":60,"x":54,"y":818},"type":"Other"}, + {"identifier":"label-view","index":14,"label":"","parentIndex":10,"rect":{"height":64,"width":19.666666666666657,"x":117,"y":816.3333333333335},"type":"Other"}, + {"identifier":"","index":15,"label":"","parentIndex":14,"rect":{"height":64,"width":19.666666666666657,"x":117,"y":816.3333333333335},"type":"Other"}, + {"identifier":"","index":16,"label":"","parentIndex":15,"rect":{"height":64,"width":19.666666666666657,"x":117,"y":816.3333333333335},"type":"Other"}, + {"identifier":"","index":17,"label":"","parentIndex":16,"rect":{"height":130,"width":87.66666666666669,"x":82.39062799999999,"y":782.8411293333334},"type":"Image"}, + {"identifier":"","index":18,"label":"","parentIndex":16,"rect":{"height":64,"width":19.666666666666657,"x":117,"y":816.3333333333335},"type":"Image"}, + {"identifier":"","index":19,"label":"","parentIndex":7,"rect":{"height":0,"width":0,"x":0,"y":0},"type":"Element(44)"}, + {"identifier":"Agent Device Tester","index":20,"label":"Agent Device Tester","parentIndex":19,"rect":{"height":79.67999999999998,"width":89.36000000000001,"x":33.00000000000001,"y":86.20000000000002},"type":"Element(44)"}, + {"identifier":"","index":21,"label":"","parentIndex":20,"rect":{"height":65.12,"width":52.8,"x":51.72000000000001,"y":88.20000000000002},"type":"Other"}, + {"identifier":"","index":22,"label":"","parentIndex":21,"rect":{"height":52.80000000000001,"width":52.8,"x":51.72000000000001,"y":88.20000000000002},"type":"Other"}, + {"identifier":"","index":23,"label":"","parentIndex":22,"rect":{"height":52.80000000000001,"width":52.8,"x":51.72000000000001,"y":88.20000000000002},"type":"Other"}, + {"identifier":"","index":24,"label":"","parentIndex":23,"rect":{"height":52.80000000000001,"width":52.8,"x":51.72000000000001,"y":88.20000000000002},"type":"Other"}, + {"identifier":"label-view","index":25,"label":"","parentIndex":21,"rect":{"height":22.879999999999995,"width":85.36000000000001,"x":35.00000000000001,"y":141},"type":"Other"}, + {"identifier":"","index":26,"label":"","parentIndex":25,"rect":{"height":22.879999999999995,"width":85.36000000000001,"x":35.00000000000001,"y":141},"type":"Other"}, + {"identifier":"","index":27,"label":"","parentIndex":26,"rect":{"height":22.879999999999995,"width":85.36000000000001,"x":35.00000000000001,"y":141},"type":"Other"}, + {"identifier":"","index":28,"label":"","parentIndex":27,"rect":{"height":82.72000000000001,"width":143.44,"x":6.686472853333388,"y":110.39708597333335},"type":"Image"}, + {"identifier":"","index":29,"label":"","parentIndex":27,"rect":{"height":22.879999999999995,"width":85.36000000000001,"x":35.00000000000001,"y":141},"type":"Image"}, + {"identifier":"AgentDeviceRunnerUITests-Runner","index":30,"label":"AgentDeviceRunnerUITests-Runner","parentIndex":19,"rect":{"height":98.66666666666663,"width":86.66666666666666,"x":52,"y":314.0000000000001},"type":"Element(44)"}, + {"identifier":"","index":31,"label":"","parentIndex":30,"rect":{"height":60,"width":74,"x":54,"y":333.0000000000002},"type":"Other"}, + {"identifier":"label-view","index":32,"label":"","parentIndex":31,"rect":{"height":94.66666666666663,"width":19.666666666666657,"x":117,"y":316.0000000000001},"type":"Other"}, + {"identifier":"","index":33,"label":"","parentIndex":32,"rect":{"height":94.66666666666663,"width":19.666666666666657,"x":117,"y":316.0000000000001},"type":"Other"}, + {"identifier":"","index":34,"label":"","parentIndex":33,"rect":{"height":94.66666666666663,"width":19.666666666666657,"x":117,"y":316.0000000000001},"type":"Other"}, + {"identifier":"","index":35,"label":"","parentIndex":34,"rect":{"height":160.66666666666669,"width":87.66666666666669,"x":82.39062799999999,"y":282.5077960000001},"type":"Image"}, + {"identifier":"","index":36,"label":"","parentIndex":34,"rect":{"height":94.66666666666663,"width":19.666666666666657,"x":117,"y":316.0000000000001},"type":"Image"}, + {"identifier":"","index":37,"label":"","parentIndex":31,"rect":{"height":60,"width":60,"x":54,"y":333.0000000000002},"type":"Other"}, + {"identifier":"","index":38,"label":"","parentIndex":37,"rect":{"height":60,"width":60,"x":54,"y":333.0000000000002},"type":"Other"}, + {"identifier":"","index":39,"label":"","parentIndex":38,"rect":{"height":60,"width":60,"x":54,"y":333.0000000000002},"type":"Other"}, + {"identifier":"","index":40,"label":"","parentIndex":7,"rect":{"height":55.333333333333314,"width":35.33333333333337,"x":618.6666666666666,"y":489.6666666666667},"type":"Other"}, + {"identifier":"Page control","index":41,"label":"","parentIndex":40,"rect":{"height":55.333333333333314,"width":35.33333333333337,"x":618.6666666666666,"y":489.6666666666667},"type":"Element(34)"}, + {"identifier":"","index":42,"label":"","parentIndex":5,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":43,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":44,"label":"","parentIndex":43,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":45,"label":"","parentIndex":44,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":46,"label":"","parentIndex":45,"rect":{"height":100,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":47,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":48,"label":"","parentIndex":47,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":49,"label":"","parentIndex":48,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":50,"label":"","parentIndex":49,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":51,"label":"","parentIndex":49,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"Multitasking Dock","index":52,"label":"","parentIndex":49,"rect":{"height":84,"width":669,"x":45,"y":5.833333333333371},"type":"Other"}, + {"identifier":"user icon list view","index":53,"label":"Dock","parentIndex":52,"rect":{"height":48,"width":48,"x":355.6666666666667,"y":23.83333333333337},"type":"Other"}, + {"identifier":"Safari","index":54,"label":"Safari","parentIndex":53,"rect":{"height":64,"width":64,"x":347.6666666666667,"y":15.833333333333371},"type":"Element(44)"}, + {"identifier":"","index":55,"label":"","parentIndex":54,"rect":{"height":48,"width":48,"x":355.6666666666667,"y":23.83333333333337},"type":"Other"}, + {"identifier":"","index":56,"label":"","parentIndex":55,"rect":{"height":48,"width":48,"x":355.6666666666667,"y":23.83333333333337},"type":"Other"}, + {"identifier":"","index":57,"label":"","parentIndex":56,"rect":{"height":48,"width":48,"x":355.6666666666667,"y":23.83333333333337},"type":"Other"}, + {"identifier":"","index":58,"label":"","parentIndex":57,"rect":{"height":48,"width":48,"x":355.6666666666667,"y":23.83333333333337},"type":"Other"}, + {"identifier":"Recent icon list view","index":59,"label":"Suggestions","parentIndex":52,"rect":{"height":0,"width":0,"x":343.6666666666667,"y":83.83333333333337},"type":"Other"}, + {"identifier":"utilities icon list view","index":60,"label":"Utilities","parentIndex":52,"rect":{"height":0,"width":0,"x":343.6666666666667,"y":83.83333333333337},"type":"Other"}, + {"identifier":"","index":61,"label":"","parentIndex":48,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":62,"label":"","parentIndex":48,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":63,"label":"","parentIndex":62,"rect":{"height":951,"width":48,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":64,"label":"","parentIndex":63,"rect":{"height":951,"width":48,"x":0,"y":0},"type":"Other"}, + {"identifier":"spotlight-search-button","index":65,"label":"Options","parentIndex":62,"rect":{"height":48,"width":48,"x":597,"y":23.66666666666663},"type":"Button"}, + {"identifier":"","index":66,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":67,"label":"","parentIndex":66,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":68,"label":"","parentIndex":67,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":69,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":70,"label":"","parentIndex":69,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":71,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":72,"label":"","parentIndex":71,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":73,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":74,"label":"","parentIndex":73,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":75,"label":"","parentIndex":74,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":76,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":77,"label":"","parentIndex":76,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":78,"label":"","parentIndex":77,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":79,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":80,"label":"","parentIndex":79,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":81,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":82,"label":"","parentIndex":81,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":83,"label":"","parentIndex":82,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":84,"label":"","parentIndex":83,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":85,"label":"","parentIndex":83,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":86,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":87,"label":"","parentIndex":86,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":88,"label":"","parentIndex":87,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":89,"label":"","parentIndex":88,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":90,"label":"","parentIndex":88,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":91,"label":"","parentIndex":88,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":92,"label":"","parentIndex":88,"rect":{"height":4.666666666666657,"width":5,"x":37,"y":229.33333333333334},"type":"Other"}, + {"identifier":"","index":93,"label":"","parentIndex":0,"rect":{"height":2853,"width":2007,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":94,"label":"","parentIndex":93,"rect":{"height":2853,"width":2007,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":95,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":96,"label":"","parentIndex":95,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":97,"label":"","parentIndex":96,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":98,"label":"","parentIndex":97,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":99,"label":"","parentIndex":97,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":100,"label":"","parentIndex":97,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":101,"label":"","parentIndex":100,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":102,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":103,"label":"","parentIndex":102,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":104,"label":"","parentIndex":103,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":105,"label":"","parentIndex":104,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":106,"label":"","parentIndex":105,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":107,"label":"","parentIndex":106,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":108,"label":"","parentIndex":106,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":109,"label":"","parentIndex":108,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":110,"label":"","parentIndex":106,"rect":{"height":35,"width":35,"x":400.6666666666667,"y":30.33333333333333},"type":"Other"}, + {"identifier":"","index":111,"label":"","parentIndex":104,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":112,"label":"","parentIndex":111,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":113,"label":"","parentIndex":112,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":114,"label":"","parentIndex":111,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":115,"label":"","parentIndex":114,"rect":{"height":35.66666666666666,"width":35.666666666666686,"x":400.33333333333337,"y":29.999999999999996},"type":"Other"}, + {"identifier":"","index":116,"label":"","parentIndex":104,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":117,"label":"","parentIndex":116,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":118,"label":"","parentIndex":117,"rect":{"height":53,"width":53,"x":391.6666666666667,"y":21.333333333333332},"type":"Other"}, + {"identifier":"","index":119,"label":"","parentIndex":117,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":120,"label":"","parentIndex":119,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":121,"label":"","parentIndex":120,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":122,"label":"","parentIndex":119,"rect":{"height":37,"width":37,"x":399.6666666666667,"y":29.33333333333333},"type":"Other"}, + {"identifier":"","index":123,"label":"","parentIndex":0,"rect":{"height":2034,"width":1398,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":124,"label":"","parentIndex":123,"rect":{"height":2034,"width":1398,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":125,"label":"","parentIndex":124,"rect":{"height":2034,"width":1398,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":126,"label":"","parentIndex":124,"rect":{"height":2034,"width":1398,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":127,"label":"","parentIndex":124,"rect":{"height":2034,"width":1398,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":128,"label":"","parentIndex":0,"rect":{"height":2034,"width":1398,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":129,"label":"","parentIndex":128,"rect":{"height":2034,"width":1398,"x":0,"y":0},"type":"Other"}, + {"identifier":"SBSwitcherWindow:Main","index":130,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":131,"label":"","parentIndex":130,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":132,"label":"","parentIndex":131,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":133,"label":"","parentIndex":132,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":134,"label":"","parentIndex":133,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":135,"label":"","parentIndex":134,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"ScrollView"}, + {"identifier":"AppSwitcherContentView","index":136,"label":"","parentIndex":134,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":137,"label":"","parentIndex":136,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":138,"label":"","parentIndex":137,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":139,"label":"","parentIndex":138,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"card:com.callstack.agentdevicelab:sceneID:com.callstack.agentdevicelab-default","index":140,"label":"Agent Device Tester","parentIndex":136,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":141,"label":"","parentIndex":140,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":142,"label":"","parentIndex":141,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":143,"label":"","parentIndex":142,"rect":{"height":1266,"width":858,"x":-196,"y":-294},"type":"Other"}, + {"identifier":"","index":144,"label":"","parentIndex":143,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":145,"label":"","parentIndex":144,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":146,"label":"","parentIndex":145,"rect":{"height":1017,"width":466,"x":0,"y":-339},"type":"ScrollView"}, + {"identifier":"","index":147,"label":"","parentIndex":146,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":148,"label":"","parentIndex":147,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":149,"label":"","parentIndex":148,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":150,"label":"","parentIndex":149,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":151,"label":"","parentIndex":150,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":152,"label":"","parentIndex":151,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":153,"label":"","parentIndex":152,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":154,"label":"","parentIndex":153,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":155,"label":"","parentIndex":154,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"Scroll To Top Region","index":156,"label":"","parentIndex":155,"rect":{"height":20,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":157,"label":"","parentIndex":152,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":158,"label":"","parentIndex":157,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":159,"label":"","parentIndex":158,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":160,"label":"","parentIndex":159,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Element(25)"}, + {"identifier":"","index":161,"label":"","parentIndex":160,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":162,"label":"","parentIndex":161,"rect":{"height":176.33333333333334,"width":88,"x":378,"y":0},"type":"Other"}, + {"identifier":"","index":163,"label":"","parentIndex":162,"rect":{"height":137.33333333333334,"width":55,"x":390.66666666666674,"y":20.333333333333314},"type":"Other"}, + {"identifier":"","index":164,"label":"","parentIndex":163,"rect":{"height":137.33333333333331,"width":55,"x":390.66666666666674,"y":20.333333333333314},"type":"Other"}, + {"identifier":"","index":165,"label":"","parentIndex":164,"rect":{"height":137.33333333333331,"width":55,"x":390.66666666666674,"y":20.333333333333314},"type":"Other"}, + {"identifier":"","index":166,"label":"","parentIndex":165,"rect":{"height":137.33333333333331,"width":55,"x":390.66666666666674,"y":20.333333333333314},"type":"Other"}, + {"identifier":"","index":167,"label":"","parentIndex":162,"rect":{"height":37,"width":37,"x":399,"y":30},"type":"Other"}, + {"identifier":"","index":168,"label":"9:14 AM","parentIndex":162,"rect":{"height":19.33333333333333,"width":34.666666666666686,"x":400.66666666666674,"y":83},"type":"StaticText"}, + {"identifier":"","index":169,"label":"","parentIndex":162,"rect":{"height":47,"width":47,"x":394.66666666666674,"y":106.66666666666669},"type":"Other"}, + {"identifier":"","index":170,"label":"","parentIndex":169,"rect":{"height":47,"width":47,"x":394.66666666666674,"y":106.66666666666669},"type":"Other"}, + {"identifier":"","index":171,"label":"","parentIndex":162,"rect":{"height":47,"width":47,"x":394.66666666666674,"y":106.66666666666669},"type":"Other"}, + {"identifier":"","index":172,"label":"","parentIndex":171,"rect":{"height":47,"width":47,"x":394.66666666666674,"y":106.66666666666669},"type":"Other"}, + {"identifier":"","index":173,"label":"","parentIndex":172,"rect":{"height":47,"width":47,"x":394.66666666666674,"y":106.66666666666669},"type":"Other"}, + {"identifier":"","index":174,"label":"wifi_68_status_bar_C2","parentIndex":173,"rect":{"height":13.333333969116211,"width":18.33333396911621,"x":409,"y":123.33333333333334},"type":"Image"}, + {"identifier":"","index":175,"label":"","parentIndex":152,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":176,"label":"","parentIndex":175,"rect":{"height":678,"width":386,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":177,"label":"","parentIndex":175,"rect":{"height":678,"width":386,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":178,"label":"","parentIndex":177,"rect":{"height":678,"width":386,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":179,"label":"","parentIndex":178,"rect":{"height":678,"width":386,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":180,"label":"","parentIndex":148,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":181,"label":"","parentIndex":148,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":182,"label":"","parentIndex":136,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":183,"label":"","parentIndex":182,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":184,"label":"","parentIndex":183,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":185,"label":"","parentIndex":184,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"Home Grabber","index":186,"label":"","parentIndex":185,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":187,"label":"","parentIndex":186,"rect":{"height":5,"width":166.99999999999997,"x":149.66666666666666,"y":665},"type":"Other"}, + {"identifier":"","index":188,"label":"","parentIndex":187,"rect":{"height":5,"width":166.99999999999997,"x":149.66666666666666,"y":665},"type":"Other"}, + {"identifier":"","index":189,"label":"","parentIndex":188,"rect":{"height":5,"width":166.99999999999997,"x":149.66666666666666,"y":665},"type":"Other"}, + {"identifier":"","index":190,"label":"","parentIndex":189,"rect":{"height":5,"width":166.99999999999997,"x":149.66666666666666,"y":665},"type":"Other"}, + {"identifier":"","index":191,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":192,"label":"","parentIndex":191,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":193,"label":"","parentIndex":192,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":194,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":195,"label":"","parentIndex":194,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":196,"label":"","parentIndex":195,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":197,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":198,"label":"","parentIndex":197,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":199,"label":"","parentIndex":198,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":200,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":201,"label":"","parentIndex":200,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":202,"label":"","parentIndex":201,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":203,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":204,"label":"","parentIndex":203,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":205,"label":"","parentIndex":204,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":206,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":207,"label":"","parentIndex":206,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":208,"label":"","parentIndex":207,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":209,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":210,"label":"","parentIndex":209,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":211,"label":"","parentIndex":210,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":212,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":213,"label":"","parentIndex":212,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":214,"label":"","parentIndex":213,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":215,"label":"","parentIndex":0,"rect":{"height":2853,"width":2007,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":216,"label":"","parentIndex":215,"rect":{"height":15,"width":15,"x":2292,"y":-300},"type":"Other"}, + {"identifier":"","index":217,"label":"","parentIndex":215,"rect":{"height":15,"width":15,"x":2292,"y":-300},"type":"Other"}, + {"identifier":"","index":218,"label":"","parentIndex":215,"rect":{"height":5,"width":5,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":219,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":220,"label":"","parentIndex":219,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Element(25)"}, + {"identifier":"","index":221,"label":"","parentIndex":220,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":222,"label":"","parentIndex":221,"rect":{"height":88,"width":123.66666666666667,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":223,"label":"9:14 AM","parentIndex":222,"rect":{"height":34.66666666666663,"width":19.333333333333336,"x":30.333333333333336,"y":30.666666666666742},"type":"StaticText"}, + {"identifier":"","index":224,"label":"","parentIndex":222,"rect":{"height":47,"width":47,"x":54,"y":24.33333333333337},"type":"Other"}, + {"identifier":"","index":225,"label":"","parentIndex":224,"rect":{"height":47,"width":47,"x":54,"y":24.33333333333337},"type":"Other"}, + {"identifier":"","index":226,"label":"","parentIndex":222,"rect":{"height":47,"width":47,"x":54,"y":24.33333333333337},"type":"Other"}, + {"identifier":"","index":227,"label":"","parentIndex":226,"rect":{"height":47,"width":47,"x":54,"y":24.33333333333337},"type":"Other"}, + {"identifier":"","index":228,"label":"","parentIndex":227,"rect":{"height":47,"width":47,"x":54,"y":24.33333333333337},"type":"Other"}, + {"identifier":"","index":229,"label":"wifi_68_status_bar_C2","parentIndex":228,"rect":{"height":18.33333396911621,"width":13.333333969116211,"x":70.66666666666666,"y":38.66666603088379},"type":"Image"}, + {"identifier":"","index":230,"label":"","parentIndex":219,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":231,"label":"","parentIndex":0,"rect":{"height":2034,"width":1398,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":232,"label":"","parentIndex":231,"rect":{"height":15,"width":15,"x":1683,"y":-300},"type":"Other"}, + {"identifier":"","index":233,"label":"","parentIndex":231,"rect":{"height":15,"width":15,"x":1683,"y":-300},"type":"Other"}, + {"identifier":"","index":234,"label":"","parentIndex":231,"rect":{"height":5,"width":5,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":235,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":236,"label":"","parentIndex":235,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Element(25)"}, + {"identifier":"","index":237,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":238,"label":"","parentIndex":237,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":239,"label":"","parentIndex":238,"rect":{"height":2.333333333333334,"width":52,"x":12,"y":12},"type":"Other"}, + {"identifier":"","index":240,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":241,"label":"","parentIndex":240,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":242,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":243,"label":"","parentIndex":242,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":244,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":245,"label":"","parentIndex":244,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":246,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":247,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":248,"label":"","parentIndex":247,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":249,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":250,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":251,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":252,"label":"","parentIndex":0,"rect":{"height":678,"width":466,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":253,"label":"","parentIndex":0,"rect":{"height":2853,"width":2007,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":254,"label":"","parentIndex":0,"rect":{"height":2034,"width":1398,"x":0,"y":0},"type":"Window"} + ] +} diff --git a/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-unfolded-safari-open-this-page-in-app.json b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-unfolded-safari-open-this-page-in-app.json new file mode 100644 index 0000000000..0ffd708c65 --- /dev/null +++ b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-unfolded-safari-open-this-page-in-app.json @@ -0,0 +1,93 @@ +{ + "capture": { + "bundle": "com.apple.mobilesafari", + "device": "iPhone Duo", + "runtime": "iOS-27-1", + "commit": "f3b09b4748" + }, + "expect": { + "safariDialog": { + "title": "", + "buttons": [ + "Cancel", + "Open" + ] + } + }, + "nodes": [ + {"identifier":"","index":0,"label":"Safari","rect":{"height":951,"width":669,"x":0,"y":0},"type":"Application"}, + {"identifier":"","index":1,"label":"","parentIndex":0,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":2,"label":"","parentIndex":1,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":3,"label":"","parentIndex":2,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Other"}, + {"identifier":"SafariWindow?View=Regular&BarsKeptMinimized=false&UUID=FE93DE75-8A2C-42A5-A6C4-438F93942A9A&UsingLoweredBar=false&IsSecure=true&IsTabBarAvailable=true","index":4,"label":"","parentIndex":3,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":5,"label":"","parentIndex":4,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":6,"label":"","parentIndex":5,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Other"}, + {"identifier":"Toolbar","index":7,"label":"","parentIndex":6,"rect":{"height":54,"width":951,"x":0,"y":26},"type":"Other"}, + {"identifier":"","index":8,"label":"","parentIndex":7,"rect":{"height":80,"width":951,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":9,"label":"","parentIndex":7,"rect":{"height":54,"width":951,"x":0,"y":26},"type":"Other"}, + {"identifier":"","index":10,"label":"","parentIndex":9,"rect":{"height":54,"width":951,"x":0,"y":26},"type":"Other"}, + {"identifier":"","index":11,"label":"","parentIndex":10,"rect":{"height":54,"width":951,"x":0,"y":26},"type":"Other"}, + {"identifier":"","index":12,"label":"","parentIndex":11,"rect":{"height":54,"width":951,"x":0,"y":26},"type":"Other"}, + {"identifier":"","index":13,"label":"","parentIndex":12,"rect":{"height":54,"width":951,"x":0,"y":26},"type":"Other"}, + {"identifier":"","index":14,"label":"","parentIndex":13,"rect":{"height":54,"width":951,"x":0,"y":26},"type":"Other"}, + {"identifier":"","index":15,"label":"","parentIndex":12,"rect":{"height":54,"width":951,"x":0,"y":26},"type":"Other"}, + {"identifier":"","index":16,"label":"","parentIndex":9,"rect":{"height":44,"width":100,"x":16,"y":26},"type":"Other"}, + {"identifier":"","index":17,"label":"","parentIndex":16,"rect":{"height":44,"width":44,"x":16,"y":26},"type":"Other"}, + {"identifier":"","index":18,"label":"","parentIndex":17,"rect":{"height":44,"width":44,"x":16,"y":26},"type":"Other"}, + {"identifier":"BackButton","index":19,"label":"Back","parentIndex":18,"rect":{"height":44,"width":44,"x":16,"y":26},"type":"Button"}, + {"identifier":"","index":20,"label":"","parentIndex":19,"rect":{"height":44,"width":44,"x":16,"y":26},"type":"Other"}, + {"identifier":"chevron.backward","index":21,"label":"Back","parentIndex":20,"rect":{"height":46.33333333333333,"width":44,"x":16,"y":24.999999999999996},"type":"Image"}, + {"identifier":"","index":22,"label":"","parentIndex":19,"rect":{"height":0,"width":0,"x":16,"y":26},"type":"StaticText"}, + {"identifier":"SidebarButton","index":23,"label":"Bookmarks","parentIndex":16,"rect":{"height":44,"width":44,"x":72,"y":26},"type":"Button"}, + {"identifier":"","index":24,"label":"","parentIndex":23,"rect":{"height":44,"width":44,"x":72,"y":26},"type":"Other"}, + {"identifier":"","index":25,"label":"","parentIndex":24,"rect":{"height":44,"width":44,"x":72,"y":26},"type":"Other"}, + {"identifier":"book","index":26,"label":"bookmark","parentIndex":25,"rect":{"height":47.66666666666667,"width":44,"x":72,"y":24.333333333333332},"type":"Image"}, + {"identifier":"","index":27,"label":"","parentIndex":23,"rect":{"height":0,"width":0,"x":72,"y":26},"type":"StaticText"}, + {"identifier":"","index":28,"label":"","parentIndex":9,"rect":{"height":44,"width":589,"x":128,"y":26},"type":"Other"}, + {"identifier":"","index":29,"label":"","parentIndex":28,"rect":{"height":44,"width":589,"x":128,"y":26},"type":"ScrollView"}, + {"identifier":"","index":30,"label":"","parentIndex":29,"rect":{"height":44,"width":589,"x":128,"y":26},"type":"Other"}, + {"identifier":"SearchFieldItemView?isActive=true&UUID=A0E72B5C-A901-499B-8650-6061BBB358C5&isPinned=false&isDistractionControlOverlayUp=false","index":31,"label":"Address","parentIndex":29,"rect":{"height":44,"width":360,"x":295.33333333333337,"y":26},"type":"Button"}, + {"identifier":"","index":32,"label":"","parentIndex":31,"rect":{"height":0,"width":0,"x":475.33333333333337,"y":48},"type":"Image"}, + {"identifier":"","index":33,"label":"","parentIndex":31,"rect":{"height":0,"width":0,"x":295.33333333333337,"y":26},"type":"StaticText"}, + {"identifier":"","index":34,"label":"","parentIndex":31,"rect":{"height":44,"width":360,"x":295.33333333333337,"y":26},"type":"Other"}, + {"identifier":"","index":35,"label":"","parentIndex":34,"rect":{"height":44,"width":360,"x":295.33333333333337,"y":26},"type":"Other"}, + {"identifier":"TabBarItemTitleContainer","index":36,"label":"Address","parentIndex":35,"rect":{"height":44,"width":360,"x":295.33333333333337,"y":26},"type":"TextField"}, + {"identifier":"MoreMenuButton","index":37,"label":"Page Menu","parentIndex":35,"rect":{"height":44,"width":44,"x":295.33333333333337,"y":26},"type":"Button"}, + {"identifier":"ReloadButton","index":38,"label":"Reload Page","parentIndex":35,"rect":{"height":44,"width":29.66666666666663,"x":616.6666666666667,"y":26},"type":"Button"}, + {"identifier":"","index":39,"label":"","parentIndex":9,"rect":{"height":44,"width":88,"x":729,"y":26},"type":"Other"}, + {"identifier":"","index":40,"label":"","parentIndex":39,"rect":{"height":44,"width":88,"x":729,"y":26},"type":"Other"}, + {"identifier":"","index":41,"label":"","parentIndex":40,"rect":{"height":44,"width":88,"x":729,"y":26},"type":"Other"}, + {"identifier":"NewTabButton","index":42,"label":"New tab","parentIndex":41,"rect":{"height":44,"width":44,"x":729,"y":26},"type":"Button"}, + {"identifier":"","index":43,"label":"","parentIndex":42,"rect":{"height":44,"width":44,"x":729,"y":26},"type":"Other"}, + {"identifier":"plus","index":44,"label":"add","parentIndex":43,"rect":{"height":45.66666666666667,"width":44,"x":729,"y":25.333333333333332},"type":"Image"}, + {"identifier":"","index":45,"label":"","parentIndex":42,"rect":{"height":0,"width":0,"x":729,"y":26},"type":"StaticText"}, + {"identifier":"TabOverviewButton","index":46,"label":"Tabs","parentIndex":41,"rect":{"height":44,"width":44,"x":773,"y":26},"type":"Button"}, + {"identifier":"","index":47,"label":"","parentIndex":46,"rect":{"height":44,"width":44,"x":773,"y":26},"type":"Other"}, + {"identifier":"square.on.square","index":48,"label":"Tabs","parentIndex":47,"rect":{"height":50.33333333333333,"width":44,"x":773,"y":22.999999999999996},"type":"Image"}, + {"identifier":"","index":49,"label":"","parentIndex":46,"rect":{"height":0,"width":0,"x":773,"y":26},"type":"StaticText"}, + {"identifier":"","index":50,"label":"","parentIndex":6,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"ScrollView"}, + {"identifier":"TabDocument?IsLoadedUsingDesktopUserAgent=false&InReaderMode=false&UUID=A0E72B5C-A901-499B-8650-6061BBB358C5&IsPrivate=false&IsPageLoaded=true&WebViewProcessID=79910","index":51,"label":"","parentIndex":50,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Other"}, + {"identifier":"WebView","index":52,"label":"","parentIndex":51,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"WebView"}, + {"identifier":"","index":53,"label":"","parentIndex":52,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":54,"label":"","parentIndex":53,"rect":{"height":589,"width":951,"x":0,"y":80},"type":"Other"}, + {"identifier":"SFDialogView","index":55,"label":"","parentIndex":53,"rect":{"height":97,"width":440,"x":255.66666666666663,"y":326},"type":"Other"}, + {"identifier":"SFDialogViewMessageText","index":56,"label":"","parentIndex":55,"rect":{"height":54,"width":440,"x":255.66666666666663,"y":326},"type":"StaticText"}, + {"identifier":"","index":57,"label":"","parentIndex":56,"rect":{"height":54,"width":440,"x":255.66666666666663,"y":326},"type":"TextView"}, + {"identifier":"","index":58,"label":"Open this page in “Agent Device Tester”?","parentIndex":57,"rect":{"height":22,"width":313.04736328125,"x":275.66666666666663,"y":342},"type":"TextView"}, + {"identifier":"","index":59,"label":"Vertical scroll bar, 1 page","parentIndex":57,"rect":{"height":54,"width":30,"x":662.6666666666666,"y":326},"type":"Other"}, + {"identifier":"","index":60,"label":"","parentIndex":59,"rect":{"height":48,"width":3,"x":689.6666666666666,"y":329},"type":"Other"}, + {"identifier":"","index":61,"label":"Horizontal scroll bar, 1 page","parentIndex":57,"rect":{"height":27,"width":440,"x":255.66666666666663,"y":350},"type":"Other"}, + {"identifier":"","index":62,"label":"","parentIndex":61,"rect":{"height":3,"width":434,"x":258.66666666666663,"y":374},"type":"Other"}, + {"identifier":"","index":63,"label":"Cancel","parentIndex":55,"rect":{"height":33,"width":53,"x":559.6666666666666,"y":380},"type":"Button"}, + {"identifier":"","index":64,"label":"Cancel","parentIndex":63,"rect":{"height":21,"width":53,"x":559.6666666666666,"y":386},"type":"StaticText"}, + {"identifier":"","index":65,"label":"Open","parentIndex":55,"rect":{"height":33,"width":43,"x":632.6666666666666,"y":380},"type":"Button"}, + {"identifier":"","index":66,"label":"Open","parentIndex":65,"rect":{"height":21,"width":43,"x":632.6666666666666,"y":386},"type":"StaticText"}, + {"identifier":"","index":67,"label":"Horizontal scroll bar, 1 page","parentIndex":50,"rect":{"height":30,"width":841,"x":55,"y":636},"type":"Other"}, + {"identifier":"","index":68,"label":"","parentIndex":67,"rect":{"height":3,"width":835,"x":58,"y":663},"type":"Other"}, + {"identifier":"","index":69,"label":"Horizontal scroll bar, 1 page","parentIndex":50,"rect":{"height":30,"width":841,"x":55,"y":636},"type":"Other"}, + {"identifier":"","index":70,"label":"","parentIndex":69,"rect":{"height":3,"width":835,"x":58,"y":663},"type":"Other"}, + {"identifier":"","index":71,"label":"","parentIndex":0,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":72,"label":"","parentIndex":71,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":73,"label":"","parentIndex":72,"rect":{"height":669,"width":951,"x":0,"y":0},"type":"Other"} + ] +} diff --git a/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-unfolded-springboard-open-in-app.json b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-unfolded-springboard-open-in-app.json new file mode 100644 index 0000000000..e4df8700e8 --- /dev/null +++ b/apple/snapshot-presentation/Tests/AlertSurfaceCorpus/iphone-duo-unfolded-springboard-open-in-app.json @@ -0,0 +1,66 @@ +{ + "capture": { + "bundle": "com.apple.springboard", + "device": "iPhone Duo (fixtures)", + "runtime": "iOS-27-1", + "commit": "f3b09b4748" + }, + "expect": { + "blockingSystemModal": { + "title": "Open in “Agent Device Tester”?", + "buttons": [ + "Cancel", + "Open" + ] + }, + "appAlert": { + "title": "Open in “Agent Device Tester”?", + "buttons": [ + "Cancel", + "Open" + ] + } + }, + "nodes": [ + {"identifier":"","index":0,"label":" ","rect":{"height":678,"width":466,"x":0,"y":0},"type":"Application"}, + {"identifier":"","index":1,"label":"","parentIndex":0,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Window"}, + {"identifier":"","index":2,"label":"","parentIndex":1,"rect":{"height":951,"width":669,"x":0,"y":0},"type":"Other"}, + {"identifier":"","index":3,"label":"Open in “Agent Device Tester”?","parentIndex":2,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Alert"}, + {"identifier":"","index":4,"label":"","parentIndex":3,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":5,"label":"","parentIndex":4,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":6,"label":"","parentIndex":5,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":7,"label":"","parentIndex":5,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":8,"label":"","parentIndex":7,"rect":{"height":320,"width":46.333333333333314,"x":267.3333333333333,"y":315.33333333333326},"type":"ScrollView"}, + {"identifier":"","index":9,"label":"","parentIndex":8,"rect":{"height":320,"width":46.333333333333314,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":10,"label":"Open in “Agent Device Tester”?","parentIndex":9,"rect":{"height":260,"width":20.333333333333314,"x":289.3333333333333,"y":345.33333333333326},"type":"StaticText"}, + {"identifier":"","index":11,"label":"Vertical scroll bar, 1 page","parentIndex":8,"rect":{"height":30,"width":46.333333333333314,"x":267.3333333333333,"y":318.33333333333326},"type":"Other"}, + {"identifier":"","index":12,"label":"","parentIndex":11,"rect":{"height":3,"width":36,"x":228.33333333333331,"y":318.33333333333326},"type":"Other"}, + {"identifier":"","index":13,"label":"Horizontal scroll bar, 1 page","parentIndex":8,"rect":{"height":320,"width":23.16666666666663,"x":287.5,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":14,"label":"","parentIndex":13,"rect":{"height":36,"width":3,"x":307.66666666666663,"y":638.3333333333333},"type":"Other"}, + {"identifier":"","index":15,"label":"Vertical scroll bar, 1 page","parentIndex":8,"rect":{"height":30,"width":46.333333333333314,"x":267.3333333333333,"y":318.33333333333326},"type":"Other"}, + {"identifier":"","index":16,"label":"","parentIndex":15,"rect":{"height":3,"width":36,"x":228.33333333333331,"y":318.33333333333326},"type":"Other"}, + {"identifier":"","index":17,"label":"Horizontal scroll bar, 1 page","parentIndex":8,"rect":{"height":320,"width":23.16666666666663,"x":287.5,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":18,"label":"","parentIndex":17,"rect":{"height":36,"width":3,"x":307.66666666666663,"y":638.3333333333333},"type":"Other"}, + {"identifier":"","index":19,"label":"","parentIndex":7,"rect":{"height":320,"width":80,"x":313.6666666666667,"y":315.33333333333326},"type":"ScrollView"}, + {"identifier":"","index":20,"label":"","parentIndex":19,"rect":{"height":320,"width":80,"x":313.6666666666667,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":21,"label":"","parentIndex":20,"rect":{"height":288,"width":48,"x":329.6666666666667,"y":331.33333333333326},"type":"Other"}, + {"identifier":"","index":22,"label":"Cancel","parentIndex":21,"rect":{"height":139.99999999999994,"width":48,"x":329.6666666666667,"y":479.3333333333333},"type":"Button"}, + {"identifier":"","index":23,"label":"Open","parentIndex":21,"rect":{"height":140.00000000000006,"width":48,"x":329.6666666666667,"y":331.33333333333326},"type":"Button"}, + {"identifier":"","index":24,"label":"Vertical scroll bar, 1 page","parentIndex":19,"rect":{"height":30,"width":80,"x":313.6666666666667,"y":318.33333333333326},"type":"Other"}, + {"identifier":"","index":25,"label":"","parentIndex":24,"rect":{"height":3,"width":7,"x":403.6666666666667,"y":318.33333333333326},"type":"Other"}, + {"identifier":"","index":26,"label":"Horizontal scroll bar, 1 page","parentIndex":19,"rect":{"height":320,"width":30,"x":360.6666666666667,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":27,"label":"","parentIndex":26,"rect":{"height":7,"width":3,"x":387.6666666666667,"y":538.3333333333333},"type":"Other"}, + {"identifier":"","index":28,"label":"Vertical scroll bar, 1 page","parentIndex":19,"rect":{"height":30,"width":80,"x":313.6666666666667,"y":318.33333333333326},"type":"Other"}, + {"identifier":"","index":29,"label":"","parentIndex":28,"rect":{"height":3,"width":7,"x":403.6666666666667,"y":318.33333333333326},"type":"Other"}, + {"identifier":"","index":30,"label":"Horizontal scroll bar, 1 page","parentIndex":19,"rect":{"height":320,"width":30,"x":360.6666666666667,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":31,"label":"","parentIndex":30,"rect":{"height":7,"width":3,"x":387.6666666666667,"y":538.3333333333333},"type":"Other"}, + {"identifier":"","index":32,"label":"","parentIndex":3,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":33,"label":"","parentIndex":32,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":34,"label":"","parentIndex":33,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":35,"label":"","parentIndex":34,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":36,"label":"","parentIndex":35,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":37,"label":"","parentIndex":36,"rect":{"height":466,"width":678,"x":267.3333333333333,"y":169.33333333333326},"type":"Other"}, + {"identifier":"","index":38,"label":"","parentIndex":34,"rect":{"height":320,"width":126.33333333333331,"x":267.3333333333333,"y":315.33333333333326},"type":"Other"}, + {"identifier":"","index":39,"label":"","parentIndex":38,"rect":{"height":466,"width":678,"x":267.3333333333333,"y":169.33333333333326},"type":"Other"} + ] +} diff --git a/package.json b/package.json index 39ecd5c08a..cd0abe1a1a 100644 --- a/package.json +++ b/package.json @@ -223,7 +223,8 @@ "test:replay:macos": "node --experimental-strip-types src/bin.ts test test/integration/replays/macos", "test:replay:linux": "node --experimental-strip-types src/bin.ts test test/integration/replays/linux", "test:linux:command-evidence": "node --experimental-strip-types test/integration/linux-e2e/live-runner.ts", - "prepublishOnly": "echo 'agent-device publishes from .github/workflows/release.yml; see CONTRIBUTING.md.' >&2 && exit 1" + "prepublishOnly": "echo 'agent-device publishes from .github/workflows/release.yml; see CONTRIBUTING.md.' >&2 && exit 1", + "capture:alert-surface": "node --experimental-strip-types scripts/capture-alert-surface.ts" }, "files": [ "bin", diff --git a/scripts/capture-alert-surface.ts b/scripts/capture-alert-surface.ts new file mode 100644 index 0000000000..d161a5a89f --- /dev/null +++ b/scripts/capture-alert-surface.ts @@ -0,0 +1,108 @@ +// Records an app's whole accessibility tree from a booted iOS simulator into the alert surface +// corpus that `swift test --package-path apple/snapshot-presentation` replays. See +// apple/snapshot-presentation/Tests/AlertSurfaceCorpus/README.md. +import { execFileSync } from 'node:child_process'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import { parseArgs } from 'node:util'; + +const { values } = parseArgs({ + options: { + udid: { type: 'string' }, + bundle: { type: 'string' }, + name: { type: 'string' }, + }, +}); +const { udid, bundle, name } = values; +if (!udid || !bundle || !name || !/^[a-z0-9-]+$/.test(name)) { + throw new Error( + 'Usage: pnpm capture:alert-surface --udid --bundle --name ', + ); +} + +const root = path.resolve(import.meta.dirname, '..'); +const derived = path.join(root, '.tmp', 'alert-surface-runner'); +const fixture = path.join( + root, + 'apple/snapshot-presentation/Tests/AlertSurfaceCorpus', + `${name}.json`, +); + +execFileSync('sh', ['./scripts/build-xcuitest-apple.sh'], { + cwd: root, + stdio: 'inherit', + env: { + ...process.env, + AGENT_DEVICE_XCUITEST_PLATFORM: 'ios', + AGENT_DEVICE_XCUITEST_INCLUDE_UNIT_TESTS: '1', + AGENT_DEVICE_XCUITEST_ARCHS: 'arm64', + AGENT_DEVICE_IOS_RUNNER_DERIVED_PATH: derived, + AGENT_DEVICE_XCUITEST_DESTINATION: 'generic/platform=iOS Simulator', + }, +}); +const products = path.join(derived, 'Build', 'Products'); +const xctestrun = fs.readdirSync(products).find((file) => file.endsWith('.xctestrun')); +if (!xctestrun) throw new Error(`No .xctestrun in ${products}`); + +const outputDir = fs.mkdtempSync(path.join(os.tmpdir(), 'alert-surface-')); +const output = path.join(outputDir, 'tree.json'); +let nodes: unknown[]; +try { + execFileSync( + 'xcodebuild', + [ + 'test-without-building', + '-xctestrun', + path.join(products, xctestrun), + '-destination', + `platform=iOS Simulator,id=${udid}`, + '-only-testing:AgentDeviceRunnerUITests/RunnerTests/testCaptureAlertSurfaceTree', + ], + { + stdio: 'inherit', + // xcodebuild strips the TEST_RUNNER_ prefix before the test process reads these. + env: { + ...process.env, + TEST_RUNNER_AGENT_DEVICE_ALERT_SURFACE_BUNDLE_ID: bundle, + TEST_RUNNER_AGENT_DEVICE_ALERT_SURFACE_OUTPUT: output, + }, + }, + ); + if (!fs.existsSync(output)) throw new Error('The capture test wrote no tree'); + nodes = JSON.parse(fs.readFileSync(output, 'utf8')) as unknown[]; +} finally { + fs.rmSync(outputDir, { recursive: true, force: true }); +} + +const devices = JSON.parse( + execFileSync('xcrun', ['simctl', 'list', 'devices', '-j'], { encoding: 'utf8' }), +) as { devices: Record> }; +const [runtime, device] = + Object.entries(devices.devices) + .flatMap(([key, list]) => list.map((entry) => [key, entry] as const)) + .find(([, entry]) => entry.udid === udid) ?? []; +const previous = fs.existsSync(fixture) + ? (JSON.parse(fs.readFileSync(fixture, 'utf8')) as { expect?: unknown }) + : {}; +const recorded = { + capture: { + bundle, + device: device?.name ?? udid, + runtime: runtime?.replace('com.apple.CoreSimulator.SimRuntime.', '') ?? 'unknown', + commit: execFileSync('git', ['rev-parse', '--short', 'HEAD'], { + cwd: root, + encoding: 'utf8', + }).trim(), + }, + ...(previous.expect === undefined ? {} : { expect: previous.expect }), +}; +// One node per line, so a recapture reads as a reviewable diff of changed nodes. +const header = JSON.stringify(recorded, null, 2).replace(/\n}$/, ''); +const body = nodes.map((node) => ` ${JSON.stringify(node)}`).join(',\n'); +fs.writeFileSync(fixture, `${header},\n "nodes": [\n${body}\n ]\n}\n`); +console.log( + previous.expect === undefined + ? `Wrote ${path.relative(root, fixture)}. Add "expect" from what the screen shows.` + : `Wrote ${path.relative(root, fixture)}. Kept its "expect".`, +);