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.
- package/dist/android/src/index.js +90 -0
- package/dist/android/templates/CraftNativeFlatList.kt.template +117 -0
- package/dist/android/templates/CraftNativeShell.kt.template +42 -10
- package/dist/android/templates/MainActivityNative.kt.template +527 -50
- package/dist/cli.js +1 -1
- package/dist/components/index.d.ts +118 -74
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ios/src/testing.d.ts +4 -4
- package/dist/ios/templates/CraftHybrid.swift +17 -3
- package/dist/ios/templates/CraftNativeFlatList.swift +64 -0
- package/dist/ios/templates/CraftNativeScreen.swift +307 -43
- package/dist/ios/templates/testing/DriverTests.swift.template +32 -3
- package/package.json +1 -1
|
@@ -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 [
|
|
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 =
|
|
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)
|