Disable broken UI Tests and remove navigation. (#577)

Add locale to signalling service name.
Type strings character by character.
Add a default test timeout of 1 minute.

* Directly set UI Tests screens as the root screen.

Speeds up test runs by removing scrolling and searching for buttons.

* Parallelise test runs from Xcode (not fastlane).

* Disable signalling based tests.
This commit is contained in:
Doug
2023-02-14 16:25:24 +00:00
committed by GitHub
parent 944660800a
commit 21154c7eef
25 changed files with 107 additions and 222 deletions
+15 -15
View File
@@ -18,9 +18,12 @@ import SnapshotTesting
import XCTest
struct Application {
static func launch() -> XCUIApplication {
static func launch(_ identifier: UITestsScreenIdentifier) -> XCUIApplication {
let app = XCUIApplication()
app.launchEnvironment = ["IS_RUNNING_UI_TESTS": "1"]
app.launchEnvironment = [
"IS_RUNNING_UI_TESTS": "1",
"UI_TESTS_SCREEN": identifier.rawValue
]
Bundle.elementFallbackLanguage = "en"
app.launch()
return app
@@ -28,22 +31,11 @@ struct Application {
}
extension XCUIApplication {
func goToScreenWithIdentifier(_ identifier: UITestScreenIdentifier) {
let button = buttons[identifier.rawValue]
let lastLabel = staticTexts["lastItem"]
while !button.isHittable, !lastLabel.isHittable {
swipeUp()
}
button.tap()
}
/// Assert screenshot for a screen with the given identifier. Does not fail if a screenshot is newly created.
/// - Parameter identifier: Identifier of the UI test screen
/// - Parameter step: An optional integer that can be used to take multiple snapshots per test identifier.
/// - Parameter insets: Optional insets with which to crop the image by.
func assertScreenshot(_ identifier: UITestScreenIdentifier, step: Int? = nil, insets: UIEdgeInsets? = nil) {
func assertScreenshot(_ identifier: UITestsScreenIdentifier, step: Int? = nil, insets: UIEdgeInsets? = nil) {
var snapshotName = identifier.rawValue
if let step {
snapshotName += "-\(step)"
@@ -72,7 +64,15 @@ extension XCUIApplication {
}
private var deviceName: String {
UIDevice.current.name
var name = UIDevice.current.name
// When running with parallel execution simulators are named "Clone 2 of iPhone 14" etc.
// Tidy this prefix out of the name to generate snapshots with the correct name.
if name.starts(with: "Clone "), let range = name.range(of: " of ") {
name = String(name[range.upperBound...])
}
return name
}
private var languageCode: String {