Files
letro-ios/IntegrationTests/Sources/Application.swift
Doug 405d0572c5 Fix the integration tests. (#4084)
* Fix logging/alerts during OIDC cancellation.

- Cancelling from within the web view wasn't being handled since moving the UserIndicatorController into the presenter.
- The WAS canceledLogin error code is also used when the system cancels the login. When the system cancels there's a failure reason included in the error.

* Allow UI tests to tap on any point within a view.

* Make the homeserver optional in integration tests.

* Dismiss the keyboard after entering a username to reveal the password text field.

Do the same after entering the password field too, just in case.

* Add a loop while waiting for the WAS prompt to be shown.
2025-05-01 12:07:04 +01:00

53 lines
1.3 KiB
Swift

//
// Copyright 2022-2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
// Please see LICENSE files in the repository root for full details.
//
import XCTest
enum Application {
@discardableResult static func launch() -> XCUIApplication {
let app = XCUIApplication()
let launchEnvironment = [
"IS_RUNNING_INTEGRATION_TESTS": "1"
]
app.launchEnvironment = launchEnvironment
app.launch()
return app
}
}
extension XCUIApplication {
var homeserver: String? {
guard let homeserver = ProcessInfo.processInfo.environment["INTEGRATION_TESTS_HOST"],
homeserver.count > 0 else {
return nil
}
return homeserver
}
var username: String {
guard let username = ProcessInfo.processInfo.environment["INTEGRATION_TESTS_USERNAME"],
username.count > 0 else {
return "default"
}
return username
}
var password: String {
guard let password = ProcessInfo.processInfo.environment["INTEGRATION_TESTS_PASSWORD"],
password.count > 0 else {
return "default"
}
return password
}
}