Full rename ahead of App Store submission: project, targets, bundle identifiers (dev.bchen.Severed -> dev.bchen.OpenAppLock), entitlements file, app entry point, user-facing onboarding strings, test helpers, and docs. Verified: all 62 unit tests pass.
49 lines
1.5 KiB
Swift
49 lines
1.5 KiB
Swift
//
|
|
// UITestSupport.swift
|
|
// OpenAppLockUITests
|
|
//
|
|
|
|
import XCTest
|
|
|
|
extension XCUIApplication {
|
|
/// Launches the app in UI-testing mode: in-memory storage, mocked Screen
|
|
/// Time authorization, and no shield side effects.
|
|
static func launchOpenAppLock(
|
|
onboardingCompleted: Bool = true,
|
|
seedScenario: String? = nil
|
|
) -> XCUIApplication {
|
|
let app = XCUIApplication()
|
|
var arguments = ["-ui-testing"]
|
|
arguments.append(onboardingCompleted ? "-onboarding-completed" : "-onboarding-required")
|
|
if let seedScenario {
|
|
arguments.append("-seed-scenario=\(seedScenario)")
|
|
}
|
|
app.launchArguments = arguments
|
|
app.launch()
|
|
return app
|
|
}
|
|
}
|
|
|
|
extension XCUIApplication {
|
|
/// Finds an element by accessibility identifier regardless of how SwiftUI
|
|
/// exposes it (Other, StaticText, Button, …).
|
|
func element(_ identifier: String) -> XCUIElement {
|
|
descendants(matching: .any).matching(identifier: identifier).firstMatch
|
|
}
|
|
}
|
|
|
|
extension XCUIElement {
|
|
/// Asserts the element appears within the timeout, then returns it.
|
|
@discardableResult
|
|
func waitToAppear(
|
|
timeout: TimeInterval = 5, file: StaticString = #filePath, line: UInt = #line
|
|
) -> XCUIElement {
|
|
XCTAssertTrue(
|
|
waitForExistence(timeout: timeout),
|
|
"Expected \(self) to exist within \(timeout)s",
|
|
file: file, line: line
|
|
)
|
|
return self
|
|
}
|
|
}
|