Various integration test tweaks following test homeserver and account change

This commit is contained in:
Stefan Ceriu 2024-01-10 14:08:11 +02:00 committed by Stefan Ceriu
parent 8dfc0bea5b
commit cf7e09e22e
3 changed files with 25 additions and 11 deletions

View File

@ -37,7 +37,7 @@ extension XCUIElement {
if isHittable {
tap()
} else {
let coordinate: XCUICoordinate = coordinate(withNormalizedOffset: .init(dx: 0.0, dy: 0.0))
let coordinate: XCUICoordinate = coordinate(withNormalizedOffset: .init(dx: 0.5, dy: 0.5))
coordinate.tap()
}
}

View File

@ -36,8 +36,9 @@ extension XCUIApplication {
XCTAssertTrue(confirmButton.waitForExistence(timeout: 10.0))
confirmButton.tap()
// Server cofirmation is network bound and might take a while
let continueButton = buttons[A11yIdentifiers.serverConfirmationScreen.continue]
XCTAssertTrue(continueButton.waitForExistence(timeout: 10.0))
XCTAssertTrue(continueButton.waitForExistence(timeout: 30.0))
continueButton.tap()
let usernameTextField = textFields[A11yIdentifiers.loginScreen.emailUsername]
@ -56,10 +57,13 @@ extension XCUIApplication {
nextButton.tap()
sleep(10)
// Wait for login to finish
let doesNotExistPredicate = NSPredicate(format: "exists == 0")
currentTestCase.expectation(for: doesNotExistPredicate, evaluatedWith: usernameTextField)
currentTestCase.waitForExpectations(timeout: 300.0)
// Handle analytics prompt screen
if staticTexts[A11yIdentifiers.analyticsPromptScreen.title].waitForExistence(timeout: 1.0) {
if staticTexts[A11yIdentifiers.analyticsPromptScreen.title].waitForExistence(timeout: 10.0) {
// Wait for login and then handle save password sheet
let savePasswordButton = buttons["Save Password"]
if savePasswordButton.waitForExistence(timeout: 10.0) {
@ -79,9 +83,9 @@ extension XCUIApplication {
// 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: 10.0) {
alertAllowButton.tap()
let notificationAlertDeclineButton = springboard.buttons.element(boundBy: 0)
if notificationAlertDeclineButton.waitForExistence(timeout: 10.0) {
notificationAlertDeclineButton.tap()
}
// Migration screen may be shown as an overlay.
@ -108,6 +112,10 @@ extension XCUIApplication {
}
func logout() {
// On first login when multiple sheets get presented the profile button is not hittable
// Moving the scroll fixed it for some obscure reason
swipeDown()
let profileButton = buttons[A11yIdentifiers.homeScreen.userAvatar]
// `Failed to scroll to visible (by AX action) Button` https://stackoverflow.com/a/33534187/730924

View File

@ -75,6 +75,8 @@ class UserFlowTests: XCTestCase {
// Cancel the upload flow
tapOnButton("Cancel")
sleep(2) // Wait for dismissal
}
private func checkRoomCreation() {
@ -90,7 +92,7 @@ class UserFlowTests: XCTestCase {
tapOnButton("Cancel")
sleep(1)
sleep(2) // Wait for dismissal
}
private func checkTimelineItemActionMenu() {
@ -114,9 +116,9 @@ class UserFlowTests: XCTestCase {
// Open the room member details
tapOnButton(A11yIdentifiers.roomDetailsScreen.people)
// Open the first member's details
// Open the first member's details. Loading members for big rooms can take a while.
let firstRoomMember = app.scrollViews.buttons.firstMatch
XCTAssertTrue(firstRoomMember.waitForExistence(timeout: 10.0))
XCTAssertTrue(firstRoomMember.waitForExistence(timeout: 300.0))
firstRoomMember.tap()
// Go back to the room member details
@ -133,6 +135,10 @@ class UserFlowTests: XCTestCase {
}
private func checkSettings() {
// On first login when multiple sheets get presented the profile button is not hittable
// Moving the scroll fixed it for some obscure reason
app.swipeDown()
let profileButton = app.buttons[A11yIdentifiers.homeScreen.userAvatar]
// `Failed to scroll to visible (by AX action) Button` https://stackoverflow.com/a/33534187/730924