Tracing and integration test tweaks (#3336)

* Disable image and document picker integration tests as they randomly fail to load and are flakey.

* Delete any pre-existing log files

* Various tracing tweaks and fixes:
- delete the custom tracing log levels as we can't control their ouput
- implement comparable on them
- change default levels only if the new chosen level increases their verbosity

* Make logging targets mandatory and fix their logging levels

* Switch back to using the `run_tests` reset simulator flag as `fastlane snapshot reset_simulators` was too generic and slow

* Switch all integration test taps to `tapCenter` (nee forceTap) after noticing missed taps on CI.

* Make the logging file prefix explicit, let the main app not use one.

* Rename tracing configuration `target` to `currentTarget`
This commit is contained in:
Stefan Ceriu
2024-09-27 15:08:47 +03:00
committed by GitHub
parent c4c0d1e714
commit e918dc66ae
16 changed files with 126 additions and 138 deletions

View File

@@ -12,12 +12,11 @@ extension XCUIApplication {
let getStartedButton = buttons[A11yIdentifiers.authenticationStartScreen.signIn]
XCTAssertTrue(getStartedButton.waitForExistence(timeout: 10.0))
getStartedButton.tap()
getStartedButton.tapCenter()
// Get started is network bound, wait for the change homeserver button for longer
let changeHomeserverButton = buttons[A11yIdentifiers.serverConfirmationScreen.changeServer]
XCTAssertTrue(changeHomeserverButton.waitForExistence(timeout: 30.0))
changeHomeserverButton.tap()
XCTAssertTrue(changeHomeserverButton.waitForExistence(timeout: 10.0))
changeHomeserverButton.tapCenter()
let homeserverTextField = textFields[A11yIdentifiers.changeServerScreen.server]
XCTAssertTrue(homeserverTextField.waitForExistence(timeout: 10.0))
@@ -26,7 +25,7 @@ extension XCUIApplication {
let confirmButton = buttons[A11yIdentifiers.changeServerScreen.continue]
XCTAssertTrue(confirmButton.waitForExistence(timeout: 10.0))
confirmButton.tap()
confirmButton.tapCenter()
// Wait for server confirmation to finish
let doesNotExistPredicate = NSPredicate(format: "exists == 0")
@@ -35,7 +34,7 @@ extension XCUIApplication {
let continueButton = buttons[A11yIdentifiers.serverConfirmationScreen.continue]
XCTAssertTrue(continueButton.waitForExistence(timeout: 30.0))
continueButton.tap()
continueButton.tapCenter()
let usernameTextField = textFields[A11yIdentifiers.loginScreen.emailUsername]
XCTAssertTrue(usernameTextField.waitForExistence(timeout: 10.0))
@@ -51,7 +50,7 @@ extension XCUIApplication {
XCTAssertTrue(nextButton.waitForExistence(timeout: 10.0))
XCTAssertTrue(nextButton.isEnabled)
nextButton.tap()
nextButton.tapCenter()
// Wait for login to finish
currentTestCase.expectation(for: doesNotExistPredicate, evaluatedWith: usernameTextField)
@@ -63,7 +62,7 @@ extension XCUIApplication {
// Tapping the sheet button while animating upwards fails. Wait for it to settle
sleep(1)
savePasswordButton.tap()
savePasswordButton.tapCenter()
}
// Wait for the home screen to become visible.
@@ -80,17 +79,17 @@ extension XCUIApplication {
let profileButton = buttons[A11yIdentifiers.homeScreen.userAvatar]
// `Failed to scroll to visible (by AX action) Button` https://stackoverflow.com/a/33534187/730924
profileButton.forceTap()
profileButton.tapCenter()
// Logout
let logoutButton = buttons[A11yIdentifiers.settingsScreen.logout]
XCTAssertTrue(logoutButton.waitForExistence(timeout: 10.0))
logoutButton.tap()
logoutButton.tapCenter()
// Confirm logout
let alertLogoutButton = alerts.firstMatch.buttons["Sign out"]
XCTAssertTrue(alertLogoutButton.waitForExistence(timeout: 10.0))
alertLogoutButton.tap()
alertLogoutButton.tapCenter()
// Check that we're back on the login screen
let getStartedButton = buttons[A11yIdentifiers.authenticationStartScreen.signIn]

View File

@@ -37,13 +37,13 @@ class UserFlowTests: XCTestCase {
// And open it
let firstRoom = app.buttons.matching(NSPredicate(format: "identifier CONTAINS %@", Self.integrationTestsRoomName)).firstMatch
XCTAssertTrue(firstRoom.waitForExistence(timeout: 10.0))
firstRoom.tap()
firstRoom.tapCenter()
sendMessages()
checkPhotoSharing()
checkDocumentSharing()
// Intentionally disabled as they're super flakey on iOS 18 simulators
// checkPhotoSharing()
// checkDocumentSharing()
checkLocationSharing()
@@ -57,7 +57,7 @@ class UserFlowTests: XCTestCase {
// Cancel initial the room search
let searchCancelButton = app.buttons["Cancel"].firstMatch
XCTAssertTrue(searchCancelButton.waitForExistence(timeout: 10.0))
searchCancelButton.forceTap()
searchCancelButton.tapCenter()
}
private func sendMessages() {
@@ -67,7 +67,7 @@ class UserFlowTests: XCTestCase {
var sendButton = app.buttons[A11yIdentifiers.roomScreen.sendButton].firstMatch
XCTAssertTrue(sendButton.waitForExistence(timeout: 10.0))
sendButton.tap()
sendButton.tapCenter()
sleep(10) // Wait for the message to be sent
@@ -81,12 +81,12 @@ class UserFlowTests: XCTestCase {
sendButton = app.buttons[A11yIdentifiers.roomScreen.sendButton].firstMatch
XCTAssertTrue(sendButton.waitForExistence(timeout: 10.0))
sendButton.tap()
sendButton.tapCenter()
sleep(5) // Wait for the message to be sent
// Close the formatting options
app.buttons[A11yIdentifiers.roomScreen.composerToolbar.closeFormattingOptions].tap()
app.buttons[A11yIdentifiers.roomScreen.composerToolbar.closeFormattingOptions].tapCenter()
}
private func checkPhotoSharing() {
@@ -98,7 +98,7 @@ class UserFlowTests: XCTestCase {
// Tap on the second image. First one is always broken on simulators.
let secondImage = app.scrollViews.images.element(boundBy: 1)
XCTAssertTrue(secondImage.waitForExistence(timeout: 20.0)) // Photo library takes a bit to load
secondImage.tap()
secondImage.tapCenter()
// Wait for the image to be processed and the new screen to appear
sleep(10)
@@ -129,7 +129,7 @@ class UserFlowTests: XCTestCase {
// Handle map loading errors (missing credentials)
let alertOkButton = app.alerts.firstMatch.buttons["OK"].firstMatch
if alertOkButton.waitForExistence(timeout: 10.0) {
alertOkButton.tap()
alertOkButton.tapCenter()
}
allowLocationPermissionOnce()
@@ -141,7 +141,7 @@ class UserFlowTests: XCTestCase {
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let notificationAlertAllowButton = springboard.buttons["Allow Once"].firstMatch
if notificationAlertAllowButton.waitForExistence(timeout: 10.0) {
notificationAlertAllowButton.tap()
notificationAlertAllowButton.tapCenter()
}
}
@@ -178,7 +178,7 @@ class UserFlowTests: XCTestCase {
// Open the room details
let roomHeader = app.staticTexts[A11yIdentifiers.roomScreen.name]
XCTAssertTrue(roomHeader.waitForExistence(timeout: 10.0))
roomHeader.tap()
roomHeader.tapCenter()
// Open the room member details
tapOnButton(A11yIdentifiers.roomDetailsScreen.people)
@@ -186,7 +186,7 @@ class UserFlowTests: XCTestCase {
// 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: 1000.0))
firstRoomMember.tap()
firstRoomMember.tapCenter()
// Go back to the room member details
tapOnBackButton("People")
@@ -206,7 +206,7 @@ class UserFlowTests: XCTestCase {
let profileButton = app.buttons[A11yIdentifiers.homeScreen.userAvatar]
// `Failed to scroll to visible (by AX action) Button` https://stackoverflow.com/a/33534187/730924
profileButton.forceTap()
profileButton.tapCenter()
// Open analytics
tapOnButton(A11yIdentifiers.settingsScreen.analytics)
@@ -233,7 +233,7 @@ class UserFlowTests: XCTestCase {
private func tapOnButton(_ identifier: String, waitForDisappearance: Bool = false) {
let button = app.buttons[identifier]
XCTAssertTrue(button.waitForExistence(timeout: 10.0))
button.tap()
button.tapCenter()
if waitForDisappearance {
let doesNotExistPredicate = NSPredicate(format: "exists == 0")
@@ -245,7 +245,7 @@ class UserFlowTests: XCTestCase {
private func tapOnMenu(_ identifier: String) {
let button = app.buttons[identifier]
XCTAssertTrue(button.waitForExistence(timeout: 10.0))
button.forceTap()
button.tapCenter()
}
/// Taps on a back button that the system configured with a label but no identifier.
@@ -255,6 +255,6 @@ class UserFlowTests: XCTestCase {
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()
button.tapCenter()
}
}