Fix integration tests. (#1793)

There was a bug where another button existed with the same label.
This commit is contained in:
Doug
2023-09-25 13:45:50 +01:00
committed by GitHub
parent 2a6cf390d6
commit a2812525e4
+20 -10
View File
@@ -52,7 +52,7 @@ class UserFlowTests: XCTestCase {
invitesButton.tap() invitesButton.tap()
// Go back to the room list // Go back to the room list
tapOnButton("All Chats") tapOnBackButton("All Chats")
} }
private func checkAttachmentsPicker() { private func checkAttachmentsPicker() {
@@ -84,9 +84,9 @@ class UserFlowTests: XCTestCase {
tapOnButton(A11yIdentifiers.inviteUsersScreen.proceed) tapOnButton(A11yIdentifiers.inviteUsersScreen.proceed)
tapOnButton("Invite people") tapOnBackButton("Invite people")
tapOnButton("Start chat") tapOnBackButton("Start chat")
tapOnButton("Cancel") tapOnButton("Cancel")
@@ -120,16 +120,16 @@ class UserFlowTests: XCTestCase {
firstRoomMember.tap() firstRoomMember.tap()
// Go back to the room member details // Go back to the room member details
tapOnButton("People") tapOnBackButton("People")
// Go back to the room details // Go back to the room details
tapOnButton("Back") tapOnBackButton()
// Go back to the room // Go back to the room
tapOnButton("Back") tapOnBackButton()
// Go back to the room list // Go back to the room list
tapOnButton("All Chats") tapOnBackButton("All Chats")
} }
private func checkSettings() { private func checkSettings() {
@@ -145,19 +145,19 @@ class UserFlowTests: XCTestCase {
tapOnButton(A11yIdentifiers.settingsScreen.analytics) tapOnButton(A11yIdentifiers.settingsScreen.analytics)
// Go back to settings // Go back to settings
tapOnButton("Settings") tapOnBackButton("Settings")
// Open report a bug // Open report a bug
tapOnButton(A11yIdentifiers.settingsScreen.reportBug) tapOnButton(A11yIdentifiers.settingsScreen.reportBug)
// Go back to settings // Go back to settings
tapOnButton("Settings") tapOnBackButton("Settings")
// Open about // Open about
tapOnButton(A11yIdentifiers.settingsScreen.about) tapOnButton(A11yIdentifiers.settingsScreen.about)
// Go back to settings // Go back to settings
tapOnButton("Settings") tapOnBackButton("Settings")
// Close the settings // Close the settings
tapOnButton(A11yIdentifiers.settingsScreen.done) tapOnButton(A11yIdentifiers.settingsScreen.done)
@@ -168,4 +168,14 @@ class UserFlowTests: XCTestCase {
XCTAssertTrue(button.waitForExistence(timeout: 10.0)) XCTAssertTrue(button.waitForExistence(timeout: 10.0))
button.tap() button.tap()
} }
/// Taps on a back button that the system configured with a label but no identifier.
///
/// When there are multiple buttons with the same label in the hierarchy, all the buttons we created
/// should have an identifier set, and so this method will ignore those picking the one with only a label.
private func tapOnBackButton(_ label: String = "Back") {
let button = app.buttons.matching(NSPredicate(format: "label == %@ && identifier == ''", label)).firstMatch
XCTAssertTrue(button.waitForExistence(timeout: 10.0))
button.tap()
}
} }