craft-native 0.0.204 → 0.0.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,10 @@ import XCTest
4
4
  /// `/script`), one command a line:
5
5
  ///
6
6
  /// launch | activate | terminate | home
7
+ /// notifications Home, then reveal Notification Center's Lock Screen presentation
8
+ /// systemexpect <text> [| secs] / systemabsent <text> / systemtap <text>
9
+ /// assert or tap SpringBoard content, including Live Activities
10
+ /// systemtree <name> SpringBoard accessibility tree → shots/<name>.txt
7
11
  /// background <secs> Home, wait, back to the app
8
12
  /// wait <seconds>
9
13
  /// net offline|online
@@ -71,9 +75,10 @@ final class DriverTests: XCTestCase {
71
75
  XCTAssertTrue(ok, what)
72
76
  }
73
77
 
74
- func element(containing text: String) -> XCUIElement? {
78
+ func element(containing text: String, in target: XCUIApplication? = nil) -> XCUIElement? {
79
+ let root = target ?? app
75
80
  let predicate = NSPredicate(format: "label CONTAINS[c] %@ OR value CONTAINS[c] %@ OR identifier == %@", text, text, text)
76
- for query in [app.buttons, app.links, app.staticTexts, app.otherElements, app.cells, app.textFields] {
81
+ for query in [root.buttons, root.links, root.staticTexts, root.otherElements, root.cells, root.textFields] {
77
82
  let matches = query.matching(predicate)
78
83
  let count = min(matches.count, 25)
79
84
  for index in 0..<count {
@@ -81,7 +86,7 @@ final class DriverTests: XCTestCase {
81
86
  if candidate.exists && candidate.isHittable { return candidate }
82
87
  }
83
88
  }
84
- let any = app.descendants(matching: .any).matching(predicate).firstMatch
89
+ let any = root.descendants(matching: .any).matching(predicate).firstMatch
85
90
  return any.exists ? any : nil
86
91
  }
87
92
 
@@ -141,6 +146,9 @@ final class DriverTests: XCTestCase {
141
146
  }
142
147
 
143
148
  func answerOpenPrompt() {
149
+ // A direct app link has already arrived. Querying an invisible
150
+ // SpringBoard here can stall its accessibility snapshot on iOS 27.
151
+ if app.wait(for: .runningForeground, timeout: 2) { return }
144
152
  let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
145
153
  let open = springboard.buttons["Open"]
146
154
  if open.waitForExistence(timeout: 4) { open.tap() }
@@ -172,6 +180,27 @@ final class DriverTests: XCTestCase {
172
180
  case "activate": app.activate()
173
181
  case "terminate": app.terminate()
174
182
  case "home": XCUIDevice.shared.press(.home)
183
+ case "notifications":
184
+ XCUIDevice.shared.press(.home)
185
+ let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
186
+ let start = springboard.coordinate(withNormalizedOffset: CGVector(dx: 0.1, dy: 0.005))
187
+ let end = springboard.coordinate(withNormalizedOffset: CGVector(dx: 0.1, dy: 0.85))
188
+ start.press(forDuration: 0.1, thenDragTo: end)
189
+ note("notifications: opened")
190
+ case "systemexpect":
191
+ let (text, seconds) = split(arg)
192
+ let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
193
+ check(poll(seconds, { element(containing: text, in: springboard) }) != nil, "systemexpect \(text)")
194
+ case "systemabsent":
195
+ let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
196
+ check(element(containing: arg, in: springboard) == nil, "systemabsent \(arg)")
197
+ case "systemtap":
198
+ let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
199
+ if let target = poll(10, { element(containing: arg, in: springboard) }) { press(target); note("systemtap \(arg): ok") }
200
+ else { XCTFail("System element not found"); note("FAIL systemtap \(arg): NOT FOUND") }
201
+ case "systemtree":
202
+ let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
203
+ post("/save?name=\(arg).txt", Data(springboard.debugDescription.utf8))
175
204
  case "background":
176
205
  XCUIDevice.shared.press(.home)
177
206
  Thread.sleep(forTimeInterval: Double(arg) ?? 3)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.204",
3
+ "version": "0.0.205",
4
4
  "type": "module",
5
5
  "description": "Build desktop apps with web languages - TypeScript SDK for Craft",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",