mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 00:49:44 +00:00
UI tests fix
This commit is contained in:
@@ -10,6 +10,8 @@ import SwiftUI
|
|||||||
|
|
||||||
struct PollFormScreenCoordinatorParameters {
|
struct PollFormScreenCoordinatorParameters {
|
||||||
let mode: PollFormMode
|
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 {
|
enum PollFormScreenCoordinatorAction {
|
||||||
@@ -28,7 +30,7 @@ final class PollFormScreenCoordinator: CoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(parameters: PollFormScreenCoordinatorParameters) {
|
init(parameters: PollFormScreenCoordinatorParameters) {
|
||||||
viewModel = PollFormScreenViewModel(mode: parameters.mode)
|
viewModel = PollFormScreenViewModel(mode: parameters.mode, maxNumberOfOptions: parameters.maxNumberOfOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start() {
|
||||||
|
|||||||
@@ -15,11 +15,12 @@ enum PollFormScreenViewModelAction: Equatable {
|
|||||||
|
|
||||||
struct PollFormScreenViewState: BindableState {
|
struct PollFormScreenViewState: BindableState {
|
||||||
let mode: PollFormMode
|
let mode: PollFormMode
|
||||||
let maxNumberOfOptions = 20
|
var maxNumberOfOptions: Int
|
||||||
var bindings: PollFormScreenViewStateBindings = .init()
|
var bindings: PollFormScreenViewStateBindings = .init()
|
||||||
|
|
||||||
init(mode: PollFormMode) {
|
init(mode: PollFormMode, maxNumberOfOptions: Int) {
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
|
self.maxNumberOfOptions = maxNumberOfOptions
|
||||||
|
|
||||||
switch mode {
|
switch mode {
|
||||||
case .new:
|
case .new:
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ class PollFormScreenViewModel: PollFormScreenViewModelType, PollFormScreenViewMo
|
|||||||
actionsSubject.eraseToAnyPublisher()
|
actionsSubject.eraseToAnyPublisher()
|
||||||
}
|
}
|
||||||
|
|
||||||
init(mode: PollFormMode) {
|
init(mode: PollFormMode, maxNumberOfOptions: Int) {
|
||||||
super.init(initialViewState: .init(mode: mode))
|
super.init(initialViewState: .init(mode: mode, maxNumberOfOptions: maxNumberOfOptions))
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Public
|
// MARK: - Public
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ class MockScreen: Identifiable {
|
|||||||
return navigationStackCoordinator
|
return navigationStackCoordinator
|
||||||
case .createPoll:
|
case .createPoll:
|
||||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||||
let coordinator = PollFormScreenCoordinator(parameters: .init(mode: .new))
|
let coordinator = PollFormScreenCoordinator(parameters: .init(mode: .new, maxNumberOfOptions: 10))
|
||||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||||
return navigationStackCoordinator
|
return navigationStackCoordinator
|
||||||
case .encryptionSettings, .encryptionSettingsOutOfSync:
|
case .encryptionSettings, .encryptionSettingsOutOfSync:
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class AuthenticationFlowCoordinatorUITests: XCTestCase {
|
|||||||
app.buttons[A11yIdentifiers.serverConfirmationScreen.continue].tap()
|
app.buttons[A11yIdentifiers.serverConfirmationScreen.continue].tap()
|
||||||
|
|
||||||
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
|
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.")
|
"The web authentication prompt should be shown after selecting a homeserver with OIDC.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user