UI tests fix

This commit is contained in:
Mauro Romito
2025-04-28 15:00:04 +02:00
committed by Mauro
parent ec504ba2b0
commit 07e2329aeb
5 changed files with 10 additions and 7 deletions

View File

@@ -10,6 +10,8 @@ import SwiftUI
struct PollFormScreenCoordinatorParameters {
let mode: PollFormMode
/// The max number of allowed options, default is 20, but for faster UI tests we allow the value to be lower
var maxNumberOfOptions = 20
}
enum PollFormScreenCoordinatorAction {
@@ -28,7 +30,7 @@ final class PollFormScreenCoordinator: CoordinatorProtocol {
}
init(parameters: PollFormScreenCoordinatorParameters) {
viewModel = PollFormScreenViewModel(mode: parameters.mode)
viewModel = PollFormScreenViewModel(mode: parameters.mode, maxNumberOfOptions: parameters.maxNumberOfOptions)
}
func start() {

View File

@@ -15,11 +15,12 @@ enum PollFormScreenViewModelAction: Equatable {
struct PollFormScreenViewState: BindableState {
let mode: PollFormMode
let maxNumberOfOptions = 20
var maxNumberOfOptions: Int
var bindings: PollFormScreenViewStateBindings = .init()
init(mode: PollFormMode) {
init(mode: PollFormMode, maxNumberOfOptions: Int) {
self.mode = mode
self.maxNumberOfOptions = maxNumberOfOptions
switch mode {
case .new:

View File

@@ -17,8 +17,8 @@ class PollFormScreenViewModel: PollFormScreenViewModelType, PollFormScreenViewMo
actionsSubject.eraseToAnyPublisher()
}
init(mode: PollFormMode) {
super.init(initialViewState: .init(mode: mode))
init(mode: PollFormMode, maxNumberOfOptions: Int) {
super.init(initialViewState: .init(mode: mode, maxNumberOfOptions: maxNumberOfOptions))
}
// MARK: - Public

View File

@@ -647,7 +647,7 @@ class MockScreen: Identifiable {
return navigationStackCoordinator
case .createPoll:
let navigationStackCoordinator = NavigationStackCoordinator()
let coordinator = PollFormScreenCoordinator(parameters: .init(mode: .new))
let coordinator = PollFormScreenCoordinator(parameters: .init(mode: .new, maxNumberOfOptions: 10))
navigationStackCoordinator.setRootCoordinator(coordinator)
return navigationStackCoordinator
case .encryptionSettings, .encryptionSettingsOutOfSync:

View File

@@ -115,7 +115,7 @@ class AuthenticationFlowCoordinatorUITests: XCTestCase {
app.buttons[A11yIdentifiers.serverConfirmationScreen.continue].tap()
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
XCTAssertTrue(springboard.staticTexts["“ElementX” Wants to Use “company.com” to Sign In"].waitForExistence(timeout: 2),
XCTAssertTrue(springboard.staticTexts["“ElementX” Wants to Use “company.com” to Sign In"].waitForExistence(timeout: 4),
"The web authentication prompt should be shown after selecting a homeserver with OIDC.")
}
}