UI tests fix
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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.")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user