mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Tweak integration tests in an attempt to make them more reliable
This commit is contained in:
parent
789e192253
commit
db48656dda
@ -72,17 +72,14 @@ class UserFlowTests: XCTestCase {
|
|||||||
secondImage.tap()
|
secondImage.tap()
|
||||||
|
|
||||||
// Cancel the upload flow
|
// Cancel the upload flow
|
||||||
tapOnButton("Cancel")
|
tapOnButton("Cancel", waitForDisappearance: true)
|
||||||
|
|
||||||
sleep(2) // Wait for dismissal
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func checkDocumentSharing() {
|
private func checkDocumentSharing() {
|
||||||
tapOnMenu(A11yIdentifiers.roomScreen.composerToolbar.openComposeOptions)
|
tapOnMenu(A11yIdentifiers.roomScreen.composerToolbar.openComposeOptions)
|
||||||
tapOnButton(A11yIdentifiers.roomScreen.attachmentPickerDocuments)
|
tapOnButton(A11yIdentifiers.roomScreen.attachmentPickerDocuments)
|
||||||
tapOnButton("Cancel")
|
|
||||||
|
|
||||||
sleep(2) // Wait for dismissal
|
tapOnButton("Cancel", waitForDisappearance: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func checkLocationSharing() {
|
private func checkLocationSharing() {
|
||||||
@ -101,9 +98,7 @@ class UserFlowTests: XCTestCase {
|
|||||||
|
|
||||||
allowLocationPermissionOnce()
|
allowLocationPermissionOnce()
|
||||||
|
|
||||||
tapOnButton("Cancel")
|
tapOnButton("Cancel", waitForDisappearance: true)
|
||||||
|
|
||||||
sleep(2) // Wait for dismissal
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func allowLocationPermissionOnce() {
|
private func allowLocationPermissionOnce() {
|
||||||
@ -125,9 +120,7 @@ class UserFlowTests: XCTestCase {
|
|||||||
|
|
||||||
tapOnBackButton("Start chat")
|
tapOnBackButton("Start chat")
|
||||||
|
|
||||||
tapOnButton("Cancel")
|
tapOnButton("Cancel", waitForDisappearance: true)
|
||||||
|
|
||||||
sleep(2) // Wait for dismissal
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func checkTimelineItemActionMenu() {
|
private func checkTimelineItemActionMenu() {
|
||||||
@ -138,9 +131,12 @@ class UserFlowTests: XCTestCase {
|
|||||||
|
|
||||||
// Hide the bottom sheet
|
// Hide the bottom sheet
|
||||||
let timelineItemActionMenu = app.scrollViews[A11yIdentifiers.roomScreen.timelineItemActionMenu].firstMatch
|
let timelineItemActionMenu = app.scrollViews[A11yIdentifiers.roomScreen.timelineItemActionMenu].firstMatch
|
||||||
XCTAssertTrue(timelineItemActionMenu.waitForExistence(timeout: 10.0))
|
|
||||||
|
// Some rooms might not have any messages in it (e.g. message history unavailable)
|
||||||
|
if timelineItemActionMenu.waitForExistence(timeout: 10.0) {
|
||||||
timelineItemActionMenu.swipeDown(velocity: .fast)
|
timelineItemActionMenu.swipeDown(velocity: .fast)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func checkRoomDetails() {
|
private func checkRoomDetails() {
|
||||||
// Open the room details
|
// Open the room details
|
||||||
@ -153,7 +149,7 @@ class UserFlowTests: XCTestCase {
|
|||||||
|
|
||||||
// Open the first member's details. Loading members for big rooms can take a while.
|
// Open the first member's details. Loading members for big rooms can take a while.
|
||||||
let firstRoomMember = app.scrollViews.buttons.firstMatch
|
let firstRoomMember = app.scrollViews.buttons.firstMatch
|
||||||
XCTAssertTrue(firstRoomMember.waitForExistence(timeout: 300.0))
|
XCTAssertTrue(firstRoomMember.waitForExistence(timeout: 1000.0))
|
||||||
firstRoomMember.tap()
|
firstRoomMember.tap()
|
||||||
|
|
||||||
// Go back to the room member details
|
// Go back to the room member details
|
||||||
@ -204,10 +200,16 @@ class UserFlowTests: XCTestCase {
|
|||||||
tapOnButton(A11yIdentifiers.settingsScreen.done)
|
tapOnButton(A11yIdentifiers.settingsScreen.done)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func tapOnButton(_ identifier: String) {
|
private func tapOnButton(_ identifier: String, waitForDisappearance: Bool = false) {
|
||||||
let button = app.buttons[identifier]
|
let button = app.buttons[identifier]
|
||||||
XCTAssertTrue(button.waitForExistence(timeout: 10.0))
|
XCTAssertTrue(button.waitForExistence(timeout: 10.0))
|
||||||
button.tap()
|
button.tap()
|
||||||
|
|
||||||
|
if waitForDisappearance {
|
||||||
|
let doesNotExistPredicate = NSPredicate(format: "exists == 0")
|
||||||
|
expectation(for: doesNotExistPredicate, evaluatedWith: button)
|
||||||
|
waitForExpectations(timeout: 10.0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func tapOnMenu(_ identifier: String) {
|
private func tapOnMenu(_ identifier: String) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user