mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Add localizations to UI tests target (#118)
This commit is contained in:
@@ -23,17 +23,8 @@ class BugReportUITests: XCTestCase {
|
||||
let app = Application.launch()
|
||||
app.goToScreenWithIdentifier(.bugReport)
|
||||
|
||||
XCTAssert(app.navigationBars["Bug report"].exists)
|
||||
XCTAssert(app.staticTexts["reportBugDescription"].exists)
|
||||
XCTAssert(app.staticTexts["sendLogsDescription"].exists)
|
||||
XCTAssert(app.textViews["reportTextView"].exists)
|
||||
let sendingLogsToggle = app.switches["sendLogsToggle"]
|
||||
XCTAssert(sendingLogsToggle.exists)
|
||||
XCTAssert(sendingLogsToggle.isOn)
|
||||
XCTAssert(app.staticTexts["sendLogsText"].exists)
|
||||
let sendButton = app.buttons["sendButton"]
|
||||
XCTAssert(sendButton.exists)
|
||||
XCTAssertFalse(sendButton.isEnabled)
|
||||
verifyInitialStateComponents(in: app)
|
||||
|
||||
XCTAssertFalse(app.images["screenshotImage"].exists)
|
||||
XCTAssertFalse(app.buttons["removeScreenshotButton"].exists)
|
||||
}
|
||||
@@ -68,22 +59,33 @@ class BugReportUITests: XCTestCase {
|
||||
let app = Application.launch()
|
||||
app.goToScreenWithIdentifier(.bugReportWithScreenshot)
|
||||
|
||||
XCTAssert(app.navigationBars["Bug report"].exists)
|
||||
XCTAssert(app.staticTexts["reportBugDescription"].exists)
|
||||
XCTAssert(app.staticTexts["sendLogsDescription"].exists)
|
||||
|
||||
XCTAssert(app.textViews["reportTextView"].exists)
|
||||
let sendingLogsToggle = app.switches["sendLogsToggle"]
|
||||
XCTAssert(sendingLogsToggle.exists)
|
||||
XCTAssert(sendingLogsToggle.isOn)
|
||||
XCTAssert(app.staticTexts["sendLogsText"].exists)
|
||||
let sendButton = app.buttons["sendButton"]
|
||||
XCTAssert(sendButton.exists)
|
||||
XCTAssertFalse(sendButton.isEnabled)
|
||||
verifyInitialStateComponents(in: app)
|
||||
|
||||
XCTAssert(app.images["screenshotImage"].exists)
|
||||
XCTAssert(app.buttons["removeScreenshotButton"].exists)
|
||||
}
|
||||
|
||||
func verifyInitialStateComponents(in app: XCUIApplication) {
|
||||
XCTAssert(app.navigationBars[ElementL10n.titleActivityBugReport].exists)
|
||||
let descLabel = app.staticTexts["reportBugDescription"]
|
||||
XCTAssert(descLabel.exists)
|
||||
XCTAssertEqual(descLabel.label, ElementL10n.sendBugReportDescription)
|
||||
let sendLogsDescLabel = app.staticTexts["sendLogsDescription"]
|
||||
XCTAssert(sendLogsDescLabel.exists)
|
||||
XCTAssertEqual(sendLogsDescLabel.label, ElementL10n.sendBugReportLogsDescription)
|
||||
XCTAssert(app.textViews["reportTextView"].exists)
|
||||
let sendLogsToggle = app.switches["sendLogsToggle"]
|
||||
XCTAssert(sendLogsToggle.exists)
|
||||
XCTAssert(sendLogsToggle.isOn)
|
||||
let sendLogsLabel = app.staticTexts["sendLogsText"]
|
||||
XCTAssert(sendLogsLabel.exists)
|
||||
XCTAssertEqual(sendLogsLabel.label, ElementL10n.sendBugReportIncludeLogs)
|
||||
let sendButton = app.buttons["sendButton"]
|
||||
XCTAssert(sendButton.exists)
|
||||
XCTAssertEqual(sendButton.label, ElementL10n.actionSend)
|
||||
XCTAssertFalse(sendButton.isEnabled)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension XCUIElement {
|
||||
|
||||
@@ -72,6 +72,7 @@ class LoginScreenUITests: XCTestCase {
|
||||
func validateServerDescriptionIsVisible(for state: String) {
|
||||
let descriptionLabel = app.staticTexts["serverDescriptionText"]
|
||||
XCTAssertTrue(descriptionLabel.exists, "The server description should be shown for \(state).")
|
||||
XCTAssertEqual(descriptionLabel.label, ElementL10n.authenticationServerInfoMatrixDescription)
|
||||
}
|
||||
|
||||
/// Checks that the server description label is hidden.
|
||||
@@ -89,6 +90,7 @@ class LoginScreenUITests: XCTestCase {
|
||||
XCTAssertTrue(usernameTextField.exists, "Username input should be shown for \(state).")
|
||||
XCTAssertTrue(passwordTextField.exists, "Password input should be shown for \(state).")
|
||||
XCTAssertTrue(nextButton.exists, "The next button should be shown for \(state).")
|
||||
XCTAssertEqual(nextButton.label, ElementL10n.loginSignupSubmit)
|
||||
}
|
||||
|
||||
/// Checks that the username and password text fields are hidden along with the next button.
|
||||
@@ -107,6 +109,7 @@ class LoginScreenUITests: XCTestCase {
|
||||
let nextButton = app.buttons["nextButton"]
|
||||
XCTAssertTrue(nextButton.exists, "The next button should be shown.")
|
||||
XCTAssertFalse(nextButton.isEnabled, "The next button should be disabled for \(state).")
|
||||
XCTAssertEqual(nextButton.label, ElementL10n.loginSignupSubmit)
|
||||
}
|
||||
|
||||
/// Checks that the next button is shown and is enabled.
|
||||
@@ -114,12 +117,14 @@ class LoginScreenUITests: XCTestCase {
|
||||
let nextButton = app.buttons["nextButton"]
|
||||
XCTAssertTrue(nextButton.exists, "The next button should be shown.")
|
||||
XCTAssertTrue(nextButton.isEnabled, "The next button should be enabled for \(state).")
|
||||
XCTAssertEqual(nextButton.label, ElementL10n.loginSignupSubmit)
|
||||
}
|
||||
|
||||
/// Checks that the OIDC button is shown on the screen.
|
||||
func validateOIDCButtonIsShown(for state: String) {
|
||||
let oidcButton = app.buttons["oidcButton"]
|
||||
XCTAssertTrue(oidcButton.exists, "The OIDC button should be shown for \(state).")
|
||||
XCTAssertEqual(oidcButton.label, ElementL10n.loginContinue)
|
||||
}
|
||||
|
||||
/// Checks that the OIDC button is not shown on the screen.
|
||||
@@ -132,6 +137,7 @@ class LoginScreenUITests: XCTestCase {
|
||||
func validateUnsupportedServerTextIsShown(for state: String) {
|
||||
let unsupportedText = app.staticTexts["unsupportedServerText"]
|
||||
XCTAssertTrue(unsupportedText.exists, "The unsupported homeserver text should be shown for \(state).")
|
||||
XCTAssertEqual(unsupportedText.label, ElementL10n.autodiscoverWellKnownError)
|
||||
}
|
||||
|
||||
/// Checks that the unsupported homeserver text is not shown on the screen.
|
||||
|
||||
@@ -23,11 +23,19 @@ class SettingsUITests: XCTestCase {
|
||||
let app = Application.launch()
|
||||
app.goToScreenWithIdentifier(.settings)
|
||||
|
||||
XCTAssert(app.navigationBars["Settings"].exists)
|
||||
XCTAssert(app.buttons["reportBugButton"].exists)
|
||||
XCTAssert(app.navigationBars[ElementL10n.settings].exists)
|
||||
let reportBugButton = app.buttons["reportBugButton"]
|
||||
XCTAssert(reportBugButton.exists)
|
||||
XCTAssertEqual(reportBugButton.label, ElementL10n.sendBugReport)
|
||||
XCTAssertEqual(app.buttons["crashButton"].exists, BuildSettings.settingsCrashButtonVisible)
|
||||
XCTAssertEqual(app.buttons["timelineStylePicker"].exists, BuildSettings.settingsShowTimelineStyle)
|
||||
XCTAssert(app.buttons["logoutButton"].exists)
|
||||
let timelineStylePicker = app.buttons["timelineStylePicker"]
|
||||
XCTAssertEqual(timelineStylePicker.exists, BuildSettings.settingsShowTimelineStyle)
|
||||
if BuildSettings.settingsShowTimelineStyle {
|
||||
XCTAssertEqual(timelineStylePicker.staticTexts.firstMatch.label, ElementL10n.settingsTimelineStyle)
|
||||
}
|
||||
let logoutButton = app.buttons["logoutButton"]
|
||||
XCTAssert(logoutButton.exists)
|
||||
XCTAssertEqual(logoutButton.label, ElementL10n.logout)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,9 @@ class SplashScreenUITests: XCTestCase {
|
||||
let app = Application.launch()
|
||||
app.goToScreenWithIdentifier(.splash)
|
||||
|
||||
let getStartedButton = app.buttons["Get started"]
|
||||
let getStartedButton = app.buttons["getStartedButton"]
|
||||
XCTAssertTrue(getStartedButton.exists, "The primary action button should be shown.")
|
||||
XCTAssertEqual(getStartedButton.label, ElementL10n.loginSplashSubmit)
|
||||
}
|
||||
|
||||
func testSwipingBetweenPages() async throws {
|
||||
|
||||
Reference in New Issue
Block a user