mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Fixing Tests for Xcode 14.3 (#888)
* settting macOS to 13, and let's runa test of... the tests * I want the artifacts of the test, might give me some more insight in Xcode * archive artifact * trying a thing with the xcode version * push notifications alert makes this test fail * test improvement * let's try with a very long time * let's disable autocorrection * sleep * 1 seconds fixed 90% of the issue, 2 should fix 100% * waiting some more time in flaky tests and updated the content of a test that was failing * updated a screenshot test that had a notification * this integration test is a bit so flaky increased the timing * controlled delay waited a bit moe for the timeline to settle * try await * MainActor everywhere * milliseconds fix * trying with a bit more waiting time after the tap and a slow velocity for the swipe * let's try waiting more time
This commit is contained in:
@@ -40,34 +40,34 @@ class LoginTests: XCTestCase {
|
||||
|
||||
let getStartedButton = app.buttons[A11yIdentifiers.onboardingScreen.signIn]
|
||||
|
||||
XCTAssertTrue(getStartedButton.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(getStartedButton.waitForExistence(timeout: 10.0))
|
||||
getStartedButton.tap()
|
||||
|
||||
|
||||
let editHomeserverButton = app.buttons[A11yIdentifiers.loginScreen.changeServer]
|
||||
XCTAssertTrue(editHomeserverButton.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(editHomeserverButton.waitForExistence(timeout: 10.0))
|
||||
editHomeserverButton.tap()
|
||||
|
||||
let homeserverTextField = app.textFields[A11yIdentifiers.changeServerScreen.server]
|
||||
XCTAssertTrue(homeserverTextField.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(homeserverTextField.waitForExistence(timeout: 10.0))
|
||||
|
||||
homeserverTextField.clearAndTypeText(app.homeserver)
|
||||
|
||||
let confirmButton = app.buttons[A11yIdentifiers.changeServerScreen.continue]
|
||||
XCTAssertTrue(confirmButton.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(confirmButton.waitForExistence(timeout: 10.0))
|
||||
confirmButton.tap()
|
||||
|
||||
let usernameTextField = app.textFields[A11yIdentifiers.loginScreen.emailUsername]
|
||||
XCTAssertTrue(usernameTextField.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(usernameTextField.waitForExistence(timeout: 10.0))
|
||||
|
||||
usernameTextField.clearAndTypeText(app.username)
|
||||
|
||||
let passwordTextField = app.secureTextFields[A11yIdentifiers.loginScreen.password]
|
||||
XCTAssertTrue(passwordTextField.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(passwordTextField.waitForExistence(timeout: 10.0))
|
||||
|
||||
passwordTextField.clearAndTypeText(app.password)
|
||||
|
||||
let nextButton = app.buttons[A11yIdentifiers.loginScreen.continue]
|
||||
XCTAssertTrue(nextButton.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(nextButton.waitForExistence(timeout: 10.0))
|
||||
XCTAssertTrue(nextButton.isEnabled)
|
||||
|
||||
nextButton.tap()
|
||||
@@ -79,38 +79,38 @@ class LoginTests: XCTestCase {
|
||||
|
||||
// Handle save password sheet
|
||||
let savePasswordButton = app.buttons["Save Password"]
|
||||
if savePasswordButton.waitForExistence(timeout: 1.0) {
|
||||
if savePasswordButton.waitForExistence(timeout: 10.0) {
|
||||
savePasswordButton.tap()
|
||||
}
|
||||
|
||||
// Handle analytics prompt screen
|
||||
if app.staticTexts[A11yIdentifiers.analyticsPromptScreen.title].waitForExistence(timeout: 1.0) {
|
||||
let enableButton = app.buttons[A11yIdentifiers.analyticsPromptScreen.enable]
|
||||
XCTAssertTrue(enableButton.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(enableButton.waitForExistence(timeout: 10.0))
|
||||
enableButton.tap()
|
||||
}
|
||||
|
||||
// Handle the notifications permission alert https://stackoverflow.com/a/58171074/730924
|
||||
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
|
||||
let alertAllowButton = springboard.buttons.element(boundBy: 1)
|
||||
if alertAllowButton.waitForExistence(timeout: 1.0) {
|
||||
if alertAllowButton.waitForExistence(timeout: 10.0) {
|
||||
alertAllowButton.tap()
|
||||
}
|
||||
|
||||
let profileButton = app.buttons[A11yIdentifiers.homeScreen.userAvatar]
|
||||
XCTAssertTrue(profileButton.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(profileButton.waitForExistence(timeout: 10.0))
|
||||
|
||||
// `Failed to scroll to visible (by AX action) Button` https://stackoverflow.com/a/33534187/730924
|
||||
profileButton.forceTap()
|
||||
|
||||
let menuLogoutButton = app.buttons["Sign out"]
|
||||
XCTAssertTrue(menuLogoutButton.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(menuLogoutButton.waitForExistence(timeout: 10.0))
|
||||
menuLogoutButton.tap()
|
||||
|
||||
let alertLogoutButton = app.buttons["Sign out"]
|
||||
XCTAssertTrue(alertLogoutButton.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(alertLogoutButton.waitForExistence(timeout: 10.0))
|
||||
alertLogoutButton.tap()
|
||||
|
||||
XCTAssertTrue(getStartedButton.waitForExistence(timeout: 1.0))
|
||||
XCTAssertTrue(getStartedButton.waitForExistence(timeout: 10.0))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user