mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user