Prefix test in-front of UI test methods.

This commit is contained in:
Doug
2022-07-14 17:49:49 +01:00
committed by Doug
parent 0442342fc5
commit e6ea10f3a6
39 changed files with 404 additions and 757 deletions
@@ -17,33 +17,10 @@
import XCTest
import RiotSwiftUI
class AuthenticationServerSelectionUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {
return MockAuthenticationServerSelectionScreenState.self
}
override class func createTest() -> MockScreenTest {
return AuthenticationServerSelectionUITests(selector: #selector(verifyAuthenticationServerSelectionScreen))
}
func verifyAuthenticationServerSelectionScreen() throws {
guard let screenState = screenState as? MockAuthenticationServerSelectionScreenState else { fatalError("no screen") }
switch screenState {
case .matrix:
verifyRegisterState()
case .login:
verifyLoginState()
case .emptyAddress:
verifyEmptyAddress()
case .invalidAddress:
verifyInvalidAddress()
case .nonModal:
verifyNonModalPresentation()
}
}
func verifyRegisterState() {
class AuthenticationServerSelectionUITests: MockScreenTestCase {
func testRegisterState() {
app.goToScreenWithIdentifier(MockAuthenticationServerSelectionScreenState.matrix.title)
let title = app.staticTexts["headerTitle"]
XCTAssertEqual(title.label, VectorL10n.authenticationServerSelectionRegisterTitle)
let message = app.staticTexts["headerMessage"]
@@ -65,14 +42,18 @@ class AuthenticationServerSelectionUITests: MockScreenTest {
}
func verifyLoginState() {
func testLoginState() {
app.goToScreenWithIdentifier(MockAuthenticationServerSelectionScreenState.login.title)
let title = app.staticTexts["headerTitle"]
XCTAssertEqual(title.label, VectorL10n.authenticationServerSelectionLoginTitle)
let message = app.staticTexts["headerMessage"]
XCTAssertEqual(message.label, VectorL10n.authenticationServerSelectionLoginMessage)
}
func verifyEmptyAddress() {
func testEmptyAddress() {
app.goToScreenWithIdentifier(MockAuthenticationServerSelectionScreenState.emptyAddress.title)
let serverTextField = app.textFields.element
XCTAssertEqual(serverTextField.value as? String, VectorL10n.authenticationServerSelectionServerUrl, "The text field should show placeholder text in this state.")
@@ -81,7 +62,9 @@ class AuthenticationServerSelectionUITests: MockScreenTest {
XCTAssertFalse(confirmButton.isEnabled, "The confirm button should be disabled when the address is empty.")
}
func verifyInvalidAddress() {
func testInvalidAddress() {
app.goToScreenWithIdentifier(MockAuthenticationServerSelectionScreenState.invalidAddress.title)
let serverTextField = app.textFields.element
XCTAssertEqual(serverTextField.value as? String, "thisisbad", "The text field should show the entered server.")
@@ -94,7 +77,9 @@ class AuthenticationServerSelectionUITests: MockScreenTest {
XCTAssertEqual(textFieldFooter.label, VectorL10n.errorCommonMessage)
}
func verifyNonModalPresentation() {
func testNonModalPresentation() {
app.goToScreenWithIdentifier(MockAuthenticationServerSelectionScreenState.nonModal.title)
let dismissButton = app.buttons["dismissButton"]
XCTAssertFalse(dismissButton.exists, "The dismiss button should be hidden when not in modal presentation.")