From 4644e1d93ed4fa9297b92b7b58465c0b74393f8c Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:29:23 -0500 Subject: [PATCH] Fixes MTE-3890 - for flaky smoke tests (backport #23389) (#23395) Fixes MTE-3890 - for flaky smoke tests (#23389) (cherry picked from commit ad0a142abb3b56d748a54a6fbf82d2fe48441296) Co-authored-by: dragosb01 <134391433+dragosb01@users.noreply.github.com> --- .../Tests/XCUITests/AddressesTests.swift | 13 ++++++++----- .../Tests/XCUITests/BookmarksTests.swift | 1 + .../Tests/XCUITests/DragAndDropTests.swift | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/AddressesTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/AddressesTests.swift index f717cff7b799..74a240068ce3 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/AddressesTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/AddressesTests.swift @@ -191,10 +191,9 @@ class AddressesTests: BaseTestCase { updateAddress(updateCountry: updateCountry, isPostalCode: isPostalCode) tapSave() // The "Address saved" toast message is displayed - // mozWaitForElementToExist(app.staticTexts[addressSavedTxt]) + mozWaitForElementToExist(app.staticTexts[addressSavedTxt]) // The address is saved - // Update with correct toast message after https://mozilla-hub.atlassian.net/browse/FXIOS-10422 is fixed - // mozWaitForElementToExist(app.staticTexts[savedAddressesTxt]) + mozWaitForElementToExist(app.staticTexts[savedAddressesTxt]) if updateCountry { let addressInfo = ["Test2", "test address2", "city test2, 100000"] for index in addressInfo { @@ -318,8 +317,12 @@ class AddressesTests: BaseTestCase { app.typeText(email) } - private func tapSave() { - app.buttons["Save"].tapWithRetry() + private func tapSave(withRetry: Bool = false) { + if withRetry { + app.buttons["Save"].tapWithRetry() + } else { + app.buttons["Save"].tap() + } } private func tapEdit() { diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift index f3f9c3a43704..3de5dcb852c4 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift @@ -148,6 +148,7 @@ class BookmarksTests: BaseTestCase { navigator.nowAt(BrowserTab) // Clear text and enter new url + waitUntilPageLoad() waitForTabsButton() navigator.performAction(Action.OpenNewTabFromTabTray) navigator.goto(URLBarOpen) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/DragAndDropTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/DragAndDropTests.swift index 12e6588a63d4..178fe02a8c4e 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/DragAndDropTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/DragAndDropTests.swift @@ -192,6 +192,7 @@ private extension BaseTestCase { navigator.nowAt(NewTabScreen) } navigator.openURL(firstWebsite.url) + waitUntilPageLoad() waitForTabsButton() navigator.performAction(Action.OpenNewTabFromTabTray) navigator.nowAt(NewTabScreen)