From ebf5e9501eda855f4b1dc1071ed2993954961582 Mon Sep 17 00:00:00 2001 From: Clare So Date: Mon, 25 Nov 2024 14:57:48 -0500 Subject: [PATCH 01/17] Integrate menu refactor work and xcode 16 --- .../Tests/XCUITests/BaseTestCase.swift | 12 +- .../Tests/XCUITests/BookmarksTests.swift | 35 ++-- .../Tests/XCUITests/DesktopModeTests.swift | 4 +- .../Tests/XCUITests/FxScreenGraph.swift | 160 +++++++++--------- .../Tests/XCUITests/LoginsTests.swift | 2 +- .../Tests/XCUITests/NavigationTest.swift | 23 ++- .../XCUITests/PhotonActionSheetTests.swift | 4 +- .../XCUITests/TrackingProtectionTests.swift | 3 +- .../nimbus-features/menuRefactorFeature.yaml | 2 +- 9 files changed, 119 insertions(+), 126 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift index da815b5789fe..0b830e563085 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift @@ -239,17 +239,13 @@ class BaseTestCase: XCTestCase { timeout: TIMEOUT ) navigator.goto(BrowserTabMenu) - mozWaitForElementToExist( - app.tables.otherElements[StandardImageIdentifiers.Large.bookmark], - timeout: TIMEOUT_LONG - ) - app.tables.otherElements[StandardImageIdentifiers.Large.bookmark].tap() - navigator.nowAt(BrowserTab) + navigator.goto(SaveBrowserTabMenu) + navigator.performAction(Action.Bookmark) } func unbookmark() { - navigator.goto(BrowserTabMenu) - app.otherElements[StandardImageIdentifiers.Large.bookmarkSlash].waitAndTap() + bookmark() + app.buttons["Delete Bookmark"].waitAndTap() navigator.nowAt(BrowserTab) } diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift index 3de5dcb852c4..f1b0a1358d0c 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift @@ -12,32 +12,23 @@ let url_3 = "localhost:\(serverPort)/test-fixture/test-example.html" class BookmarksTests: BaseTestCase { private func checkBookmarked() { - navigator.goto(BrowserTabMenu) - mozWaitForElementToExist(app.tables.otherElements[StandardImageIdentifiers.Large.bookmarkSlash]) - if iPad() { - app.otherElements["PopoverDismissRegion"].tap() - navigator.nowAt(BrowserTab) - } else { - navigator.goto(BrowserTab) - } + navigator.goto(LibraryPanel_Bookmarks) + app.buttons["Done"].waitAndTap() + navigator.nowAt(BrowserTab) } private func undoBookmarkRemoval() { - navigator.goto(BrowserTabMenu) - app.otherElements[StandardImageIdentifiers.Large.bookmarkSlash].waitAndTap() - navigator.nowAt(BrowserTab) + navigator.goto(SaveBrowserTabMenu) + app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarkThisPage].waitAndTap() + app.staticTexts["Delete Bookmark"].waitAndTap() app.buttons["Undo"].waitAndTap() + navigator.nowAt(BrowserTab) } private func checkUnbookmarked() { - navigator.goto(BrowserTabMenu) - mozWaitForElementToExist(app.tables.otherElements[StandardImageIdentifiers.Large.bookmark]) - if iPad() { - app.otherElements["PopoverDismissRegion"].tap() - navigator.nowAt(BrowserTab) - } else { - navigator.goto(BrowserTab) - } + navigator.goto(LibraryPanel_Bookmarks) + app.buttons["Done"].waitAndTap() + navigator.nowAt(BrowserTab) } // https://mozilla.testrail.io/index.php?/cases/view/2306905 @@ -354,9 +345,11 @@ class BookmarksTests: BaseTestCase { bookmarkPageAndTapEdit() app.buttons["crossLarge"].tap() waitForTabsButton() + navigator.nowAt(BrowserTab) unbookmark() bookmarkPageAndTapEdit() app.buttons["Save"].tap() + navigator.nowAt(BrowserTab) navigator.goto(LibraryPanel_Bookmarks) checkItemInBookmarkList(oneItemBookmarked: true) } @@ -394,8 +387,8 @@ class BookmarksTests: BaseTestCase { } private func bookmarkPageAndTapEdit() { - bookmark() - app.buttons["Edit"].waitAndTap() + bookmark() // Bookmark the page + bookmark() // Open the "Edit Bookmark" page mozWaitForElementToExist(app.navigationBars["Edit Bookmark"]) } } diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift index 5ffff9853e23..ec9210dc4376 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift @@ -109,14 +109,14 @@ class DesktopModeTestsIphone: IphoneOnlyTestCase { XCTAssert(app.webViews.staticTexts.matching(identifier: "MOBILE_UA").count > 0) mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton]) navigator.goto(BrowserTabMenu) - mozWaitForElementToExist(app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.deviceDesktop]) + mozWaitForElementToExist(app.tables.cells[AccessibilityIdentifiers.MainMenu.switchToDesktopSite]) navigator.goto(RequestDesktopSite) waitUntilPageLoad() XCTAssert(app.webViews.staticTexts.matching(identifier: "DESKTOP_UA").count > 0) navigator.nowAt(BrowserTab) navigator.goto(BrowserTabMenu) - mozWaitForElementToExist(app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.deviceMobile]) + mozWaitForElementToExist(app.tables.cells.staticTexts["Switch to Mobile Site"]) // Select Mobile site here, the identifier is the same but the Text is not navigator.goto(RequestMobileSite) waitUntilPageLoad() diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift index 08b16fdb64d4..07b2fd6be106 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift @@ -59,6 +59,8 @@ let CreditCardsSettings = "AutofillCreditCard" let PageZoom = "PageZoom" let NotificationsSettings = "NotificationsSetting" let AddressesSettings = "AutofillAddress" +let ToolsBrowserTabMenu = "ToolsBrowserTabMenu" +let SaveBrowserTabMenu = "SaveBrowserTabMenu" // These are in the exact order they appear in the settings // screen. XCUIApplication loses them on small screens. @@ -571,6 +573,7 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr screenState.gesture(forAction: Action.CloseDownloadsPanel, transitionTo: HomePanelsScreen) { userState in app.buttons["Done"].tap() } + screenState.tap(app.buttons["readingListLarge"], to: LibraryPanel_ReadingList) } map.addScreenState(HistoryRecentlyClosed) { screenState in @@ -1086,108 +1089,111 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr screenState.backAction = navigationControllerBackAction } - map.addScreenState(BrowserTabMenu) { screenState in - sleep(1) - screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.settings], - to: SettingsScreen - ) + map.addScreenState(ToolsBrowserTabMenu) { screenState in + // Zoom screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.sync], - to: Intro_FxASignin, - if: "fxaUsername == nil" - ) - screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.login], - to: LoginsSettings - ) + app.tables.cells[AccessibilityIdentifiers.MainMenu.zoom], + to: PageZoom) + // Turn on night mode screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.bookmarkTrayFill], - to: LibraryPanel_Bookmarks - ) - screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.history], - to: LibraryPanel_History - ) - screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.download], - to: LibraryPanel_Downloads - ) - screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.readingList], - to: LibraryPanel_ReadingList - ) - screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.avatarCircle], - to: FxAccountManagementPage - ) - - screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.nightMode], + app.tables.cells[StandardImageIdentifiers.Large.nightMode], forAction: Action.ToggleNightMode, - transitionTo: BrowserTabMenu + transitionTo: BrowserTab ) { userState in userState.nightMode = !userState.nightMode } - + // Report broken site (TODO) + // Share screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.whatsNew], - forAction: Action.OpenWhatsNewPage - ) { userState in - } - screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.deviceDesktopSend], - forAction: Action.SentToDevice - ) { userState in - } - - screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.share], + app.tables.cells[AccessibilityIdentifiers.MainMenu.share], forAction: Action.ShareBrowserTabMenuOption ) { userState in } + screenState.dismissOnUse = true + screenState.backAction = cancelBackAction + } + + map.addScreenState(SaveBrowserTabMenu) { screenState in + // Bookmark this page screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.deviceDesktop], - to: RequestDesktopSite + app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarkThisPage], + forAction: Action.BookmarkThreeDots ) screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.deviceMobile], - to: RequestMobileSite + app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarkThisPage], + forAction: Action.Bookmark ) + // Add to shortcuts + // No Copy link available (Action.CopyAddressPAM) screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.search], - to: FindInPage + app.tables.cells[AccessibilityIdentifiers.MainMenu.addToShortcuts], + forAction: Action.PinToTopSitesPAM ) + // Save to reading list (TODO) screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.pageZoom], - to: PageZoom + app.tables.cells[AccessibilityIdentifiers.MainMenu.saveToReadingList], + forAction: Action.AddToReadingListBrowserTabMenu ) - // TODO: Add new state -// screenState.tap( -// app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.lightbulb], -// to: ReportSiteIssue -// ) + screenState.dismissOnUse = true + screenState.backAction = navigationControllerBackAction + } + + map.addScreenState(BrowserTabMenu) { screenState in + sleep(1) + + // Sign In (if unauthenticated) screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.pin], - forAction: Action.PinToTopSitesPAM - ) + app.buttons[AccessibilityIdentifiers.MainMenu.HeaderView.mainButton], + to: Intro_FxASignin, + if: "fxaUsername == nil") + // Signed in (TODO) + // New tab + screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.newTab], to: NewTabScreen) + // New private tab (TODO: Not working) + /* screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.link], - forAction: Action.CopyAddressPAM - ) - + app.tables.cells[AccessibilityIdentifiers.MainMenu.newPrivateTab], + forAction: Action.OpenPrivateTabLongPressTabsButton, + transitionTo: NewTabScreen + ) { userState in + userState.isPrivate = !userState.isPrivate + } + */ + // Switch to Desktop/Mobile Site + // The cell's identifier is the same for desktop and mobile, so I use static + // texts for the RequestMobileSite case + screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.switchToDesktopSite], to: RequestDesktopSite) + screenState.tap(app.tables.cells.staticTexts["Switch to Mobile Site"], to: RequestMobileSite) + // Find in Page... screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.bookmark], - forAction: Action.BookmarkThreeDots, - Action.Bookmark - ) + app.tables.cells[AccessibilityIdentifiers.MainMenu.findInPage], + to: FindInPage) + // Tools (Zoom, NightMode, Report, Share) + screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.tools], to: ToolsBrowserTabMenu) + // Save (Add Bookmark, Shortcut) + screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.save], to: SaveBrowserTabMenu) + // Bookmarks + screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarks], to: LibraryPanel_Bookmarks) + // Actions.BookmarkThreeDots? + // History screenState.tap( - app.tables.otherElements[StandardImageIdentifiers.Large.readingListAdd], - forAction: Action.AddToReadingListBrowserTabMenu + app.tables.cells[AccessibilityIdentifiers.MainMenu.history], + to: LibraryPanel_History) + // Downloads + screenState.tap( + app.tables.cells[AccessibilityIdentifiers.MainMenu.downloads], + to: LibraryPanel_Downloads ) - + // Passwords (TODO) + // Customize Homepage (TODO) + // New in Firefox (TODO: Find out what is Action.OpenWhatsNewPage) + // Get Help (TODO: Actions to open support.mozilla.org) + // SettingsScreen + screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.settings], to: SettingsScreen) + + // "x" for close the menu and go back screenState.dismissOnUse = true screenState.backAction = cancelBackAction } diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift index 7eb2ff4418a1..b3520eabe07c 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift @@ -46,7 +46,7 @@ class LoginTest: BaseTestCase { private func openLoginsSettingsFromBrowserTab() { waitForExistence(app.buttons["TabToolbar.menuButton"]) navigator.goto(BrowserTabMenu) - waitForExistence(app.tables.otherElements[StandardImageIdentifiers.Large.login]) + waitForExistence(app.buttons[AccessibilityIdentifiers.MainMenu.HeaderView.mainButton]) navigator.goto(LoginsSettings) unlockLoginsView() diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/NavigationTest.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/NavigationTest.swift index dabe11e87833..c63fcef83a64 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/NavigationTest.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/NavigationTest.swift @@ -419,18 +419,17 @@ class NavigationTest: BaseTestCase { navigator.goto(BrowserTabMenu) waitForElementsToExist( [ - app.tables["Context Menu"], - app.tables.otherElements[StandardImageIdentifiers.Large.bookmarkTrayFill], - app.tables.otherElements[StandardImageIdentifiers.Large.history], - app.tables.otherElements[StandardImageIdentifiers.Large.download], - app.tables.otherElements[StandardImageIdentifiers.Large.readingList], - app.tables.otherElements[StandardImageIdentifiers.Large.login], - app.tables.otherElements[StandardImageIdentifiers.Large.sync], - app.tables.otherElements[StandardImageIdentifiers.Large.nightMode], - app.tables.otherElements[StandardImageIdentifiers.Large.whatsNew], - app.tables.otherElements[StandardImageIdentifiers.Large.helpCircle], - app.tables.otherElements[StandardImageIdentifiers.Large.edit], - app.tables.otherElements[StandardImageIdentifiers.Large.settings] + app.buttons[AccessibilityIdentifiers.MainMenu.HeaderView.mainButton], + app.tables.cells[AccessibilityIdentifiers.MainMenu.newTab], + app.tables.cells[AccessibilityIdentifiers.MainMenu.newPrivateTab], + app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarks], + app.tables.cells[AccessibilityIdentifiers.MainMenu.history], + app.tables.cells[AccessibilityIdentifiers.MainMenu.downloads], + app.tables.cells[AccessibilityIdentifiers.MainMenu.passwords], + app.tables.cells[AccessibilityIdentifiers.MainMenu.customizeHomepage], + app.tables.cells[AccessibilityIdentifiers.MainMenu.whatsNew], + app.tables.cells[AccessibilityIdentifiers.MainMenu.getHelp], + app.tables.cells[AccessibilityIdentifiers.MainMenu.settings] ] ) } diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift index 0dfc3766debc..122b15fbe208 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift @@ -76,8 +76,8 @@ class PhotonActionSheetTests: BaseTestCase { // awesome bar. // mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.shareButton], timeout: 10) // app.buttons[AccessibilityIdentifiers.Toolbar.shareButton].tap() - navigator.goto(BrowserTabMenu) - app.otherElements[StandardImageIdentifiers.Large.share].tap() + navigator.goto(ToolsBrowserTabMenu) + app.cells[AccessibilityIdentifiers.MainMenu.share].tap() if #unavailable(iOS 16) { waitForElementsToExist( diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift index e27cbf362aed..68db6e7757ab 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift @@ -118,8 +118,7 @@ class TrackingProtectionTests: BaseTestCase { ] ) navigator.goto(BrowserTabMenu) - app.tables.otherElements[StandardImageIdentifiers.Large.settings].waitAndTap() - navigator.nowAt(SettingsScreen) + navigator.goto(SettingsScreen) mozWaitForElementToExist(app.tables.cells["NewTab"]) app.tables.cells["NewTab"].swipeUp() // Enable TP again diff --git a/firefox-ios/nimbus-features/menuRefactorFeature.yaml b/firefox-ios/nimbus-features/menuRefactorFeature.yaml index 41bc5e917f18..ae6b190113f7 100644 --- a/firefox-ios/nimbus-features/menuRefactorFeature.yaml +++ b/firefox-ios/nimbus-features/menuRefactorFeature.yaml @@ -21,5 +21,5 @@ features: menu-hint: false - channel: developer value: - enabled: false + enabled: true menu-hint: true From abd8bbe5e8b481ebb7590c4e526930b9fbc7ac70 Mon Sep 17 00:00:00 2001 From: Clare So Date: Mon, 25 Nov 2024 15:24:24 -0500 Subject: [PATCH 02/17] Disable testTelemetryForSiteMenu for now --- firefox-ios/firefox-ios-tests/Tests/UnitTest.xctestplan | 1 + 1 file changed, 1 insertion(+) diff --git a/firefox-ios/firefox-ios-tests/Tests/UnitTest.xctestplan b/firefox-ios/firefox-ios-tests/Tests/UnitTest.xctestplan index eb4a93443274..0e7ff317601c 100644 --- a/firefox-ios/firefox-ios-tests/Tests/UnitTest.xctestplan +++ b/firefox-ios/firefox-ios-tests/Tests/UnitTest.xctestplan @@ -119,6 +119,7 @@ "ShortcutRouteTests\/testOpenLastBookmarkShortcutWithInvalidUrl()", "TabManagerTests\/testDeleteSelectedTab()", "TabManagerTests\/testPrivatePreference_togglePBMDeletesPrivate()", + "TabToolbarHelperTests\/testTelemetryForSiteMenu()", "TestFavicons\/testFaviconFetcherParse()", "VersionSettingTests", "VersionSettingTests\/testCopyAppVersion()" From 534e18c7880aec912be34fb1609e489e42ee2270 Mon Sep 17 00:00:00 2001 From: Clare So Date: Mon, 25 Nov 2024 15:57:57 -0500 Subject: [PATCH 03/17] No more "Copy Link" from the browser tab menu (known as Action.CopyAddressPAM in the screen graph) --- .../firefox-ios-tests/Tests/XCUITests/ClipBoardTests.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ClipBoardTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ClipBoardTests.swift index 867392a4f63e..b4e615b45b87 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ClipBoardTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ClipBoardTests.swift @@ -73,6 +73,8 @@ class ClipBoardTests: BaseTestCase { // Tap on "Copy Link navigator.openURL(url_3) waitForTabsButton() + // Menu Refactor: No "Copy Link" from browser tab menu + /* navigator.performAction(Action.CopyAddressPAM) // The Link is copied to clipboard mozWaitForElementToExist(app.staticTexts["URL Copied To Clipboard"]) @@ -86,6 +88,7 @@ class ClipBoardTests: BaseTestCase { mozWaitForElementToExist(urlBar) waitForValueContains(urlBar, value: "localhost") mozWaitForElementToExist(app.staticTexts["Example Domain"]) + */ } // https://mozilla.testrail.io/index.php?/cases/view/2325691 From 1bbc11623e4e26155aabcf64030cf4da150ec846 Mon Sep 17 00:00:00 2001 From: Clare So Date: Mon, 25 Nov 2024 16:03:36 -0500 Subject: [PATCH 04/17] Document what's working on new BrowserTabMenu and what's not --- .../Tests/XCUITests/FxScreenGraph.swift | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift index 07b2fd6be106..647b0650a99b 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift @@ -1130,7 +1130,6 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr app.tables.cells[AccessibilityIdentifiers.MainMenu.addToShortcuts], forAction: Action.PinToTopSitesPAM ) - // Save to reading list (TODO) screenState.tap( app.tables.cells[AccessibilityIdentifiers.MainMenu.saveToReadingList], forAction: Action.AddToReadingListBrowserTabMenu @@ -1151,16 +1150,7 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr // Signed in (TODO) // New tab screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.newTab], to: NewTabScreen) - // New private tab (TODO: Not working) - /* - screenState.tap( - app.tables.cells[AccessibilityIdentifiers.MainMenu.newPrivateTab], - forAction: Action.OpenPrivateTabLongPressTabsButton, - transitionTo: NewTabScreen - ) { userState in - userState.isPrivate = !userState.isPrivate - } - */ + // New private tab (TODO: Action.OpenPrivateTabLongPressTabsButton // Switch to Desktop/Mobile Site // The cell's identifier is the same for desktop and mobile, so I use static // texts for the RequestMobileSite case @@ -1176,7 +1166,6 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.save], to: SaveBrowserTabMenu) // Bookmarks screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarks], to: LibraryPanel_Bookmarks) - // Actions.BookmarkThreeDots? // History screenState.tap( app.tables.cells[AccessibilityIdentifiers.MainMenu.history], From 21f7068695edbc396727cc91206073f7106b722d Mon Sep 17 00:00:00 2001 From: mbarone Date: Tue, 26 Nov 2024 15:52:24 +0100 Subject: [PATCH 05/17] Fix some XCUITEsts with menu redisign experiment On --- .../Tests/XCUITests/FxScreenGraph.swift | 2 ++ .../Tests/XCUITests/ReportSiteTests.swift | 2 +- .../Tests/XCUITests/ToolbarMenuTests.swift | 33 ++++++++++--------- .../XCUITests/TrackingProtectionTests.swift | 8 ++--- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift index 647b0650a99b..32bed7ee50ef 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift @@ -2,6 +2,8 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/ +// swiftlint:disable all + import Common import Foundation import MappaMundi diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ReportSiteTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ReportSiteTests.swift index 916dd7a20082..951d84d4148c 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ReportSiteTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ReportSiteTests.swift @@ -32,6 +32,6 @@ class ReportSiteTests: BaseTestCase { navigator.openURL(path(forTestPage: "test-mozilla-book.html")) navigator.goto(BrowserTabMenu) - mozWaitForElementToExist(app.tables["Context Menu"]) + mozWaitForElementToExist(app.images[StandardImageIdentifiers.Large.avatarCircle]) } } diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarMenuTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarMenuTests.swift index ec3b4d852190..91b4ab7cbbac 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarMenuTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarMenuTests.swift @@ -41,11 +41,14 @@ class ToolbarMenuTests: BaseTestCase { ) } navigator.goto(BrowserTabMenu) - mozWaitForElementToExist(app.tables["Context Menu"]) + // mozWaitForElementToExist(app.tables["Context Menu"]) + mozWaitForElementToExist(app.images[StandardImageIdentifiers.Large.avatarCircle]) validateMenuOptions() + app.buttons["MainMenu.CloseMenuButton"].tap() XCUIDevice.shared.orientation = .landscapeLeft mozWaitForElementToExist(hamburgerMenu) - mozWaitForElementToNotExist(app.tables["Context Menu"]) + // mozWaitForElementToNotExist(app.tables["Context Menu"]) + // mozWaitForElementToExist(app.images[StandardImageIdentifiers.Large.avatarCircle]) mozWaitForElementToExist(app.textFields[AccessibilityIdentifiers.Browser.AddressToolbar.searchTextField]) mozWaitForElementToExist(tabsButton) XCTAssertTrue( @@ -58,25 +61,25 @@ class ToolbarMenuTests: BaseTestCase { "Menu button is not below the pocket cells area" ) hamburgerMenu.tap() - mozWaitForElementToExist(app.tables["Context Menu"]) + mozWaitForElementToExist(app.images[StandardImageIdentifiers.Large.avatarCircle]) + // mozWaitForElementToExist(app.tables["Context Menu"]) validateMenuOptions() - app.otherElements["PopoverDismissRegion"].tap() - mozWaitForElementToNotExist(app.tables["Context Menu"]) + app.buttons["MainMenu.CloseMenuButton"].tap() + // app.otherElements["PopoverDismissRegion"].tap() + // mozWaitForElementToNotExist(app.tables["Context Menu"]) + mozWaitForElementToNotExist(app.images[StandardImageIdentifiers.Large.avatarCircle]) } private func validateMenuOptions() { waitForElementsToExist( [ - app.tables.otherElements[StandardImageIdentifiers.Large.bookmarkTrayFill], - app.tables.otherElements[StandardImageIdentifiers.Large.download], - app.tables.otherElements[StandardImageIdentifiers.Large.readingList], - app.tables.otherElements[StandardImageIdentifiers.Large.login], - app.tables.otherElements[StandardImageIdentifiers.Large.sync], - app.tables.otherElements[StandardImageIdentifiers.Large.nightMode], - app.tables.otherElements[StandardImageIdentifiers.Large.whatsNew], - app.tables.otherElements[StandardImageIdentifiers.Large.helpCircle], - app.tables.otherElements[StandardImageIdentifiers.Large.edit], - app.tables.otherElements[StandardImageIdentifiers.Large.settings] + app.images[StandardImageIdentifiers.Large.avatarCircle], + app.images[StandardImageIdentifiers.Large.plus], + app.images[StandardImageIdentifiers.Large.privateModeCircleFill], + app.images[StandardImageIdentifiers.Large.bookmarkTrayFill], + app.images[StandardImageIdentifiers.Large.history], + app.images[StandardImageIdentifiers.Large.download], + app.images[StandardImageIdentifiers.Large.login] ] ) } diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift index 68db6e7757ab..85de8de4a25e 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift @@ -208,10 +208,10 @@ class TrackingProtectionTests: BaseTestCase { navigator.goto(TrackingProtectionContextMenuDetails) // A page displaying the connection is secure waitForElementsToExist( - [ - app.staticTexts["mozilla.org"], - app.staticTexts["Secure connection"] - ] + [ + app.staticTexts["mozilla.org"], + app.staticTexts["Secure connection"] + ] ) XCTAssertEqual( app.buttons[AccessibilityIdentifiers.Browser.AddressToolbar.lockIcon].label, From c9d32bd80c926d640b694e7e0dc060726196be50 Mon Sep 17 00:00:00 2001 From: mbarone Date: Tue, 26 Nov 2024 15:59:31 +0100 Subject: [PATCH 06/17] Fix linter issue --- .../firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift index 32bed7ee50ef..7388cb9b4eb4 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift @@ -1308,3 +1308,5 @@ extension XCUIElement { } } } + +// swiftlint:enable all From 134c08c4e7be99f9e6873f7cac3ba9b52328ead6 Mon Sep 17 00:00:00 2001 From: mbarone Date: Tue, 26 Nov 2024 16:30:25 +0100 Subject: [PATCH 07/17] Fix SyncFAUITests XCUITest --- .../firefox-ios-tests/Tests/XCUITests/SyncFAUITests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/SyncFAUITests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/SyncFAUITests.swift index 2bdd9b04a331..c65a4f377630 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/SyncFAUITests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/SyncFAUITests.swift @@ -22,7 +22,7 @@ class SyncUITests: BaseTestCase { waitForTabsButton() navigator.nowAt(NewTabScreen) navigator.goto(BrowserTabMenu) - mozWaitForElementToExist(app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.sync]) + mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton]) navigator.goto(Intro_FxASignin) navigator.performAction(Action.OpenEmailToSignIn) verifyFxASigninScreen() From 181585706bb9ac9f8536da7a8daf24830c136396 Mon Sep 17 00:00:00 2001 From: mbarone Date: Tue, 26 Nov 2024 16:52:49 +0100 Subject: [PATCH 08/17] Fix SearchTest and SettingsTests --- .../firefox-ios-tests/Tests/XCUITests/SearchTest.swift | 1 + .../firefox-ios-tests/Tests/XCUITests/SettingsTests.swift | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/SearchTest.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/SearchTest.swift index fbbda3635463..de4b5a885896 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/SearchTest.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/SearchTest.swift @@ -404,6 +404,7 @@ class SearchTests: BaseTestCase { // swiftlint:enable empty_count // Delete the text and type "g" + app.textFields.firstMatch.waitAndTap() app.buttons["Clear text"].waitAndTap() typeTextAndValidateSearchSuggestions(text: "g", isSwitchOn: true) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/SettingsTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/SettingsTests.swift index 8e9ab42208c9..dbe5acd742dd 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/SettingsTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/SettingsTests.swift @@ -69,8 +69,9 @@ class SettingsTests: BaseTestCase { app.navigationBars["Settings"].buttons["Done"].tap() app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton].tap() - let settingsmenuitemCell = app.tables.otherElements["Settings"] - settingsmenuitemCell.tap() + //let settingsmenuitemCell = app.tables.otherElements["Settings"] + //settingsmenuitemCell.tap() + app.staticTexts["Settings"].waitAndTap() // Check Offer to open copied links, when opening firefox is on let value3 = app.tables.cells.switches["Offer to Open Copied Links, When opening Firefox"].value From 5b11330cedba795f93e4740e60df0af76b917a20 Mon Sep 17 00:00:00 2001 From: mbarone Date: Tue, 26 Nov 2024 16:54:27 +0100 Subject: [PATCH 09/17] Fix linter issues on SettingsTests --- .../firefox-ios-tests/Tests/XCUITests/SettingsTests.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/SettingsTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/SettingsTests.swift index dbe5acd742dd..ac1403bc659b 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/SettingsTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/SettingsTests.swift @@ -69,8 +69,6 @@ class SettingsTests: BaseTestCase { app.navigationBars["Settings"].buttons["Done"].tap() app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton].tap() - //let settingsmenuitemCell = app.tables.otherElements["Settings"] - //settingsmenuitemCell.tap() app.staticTexts["Settings"].waitAndTap() // Check Offer to open copied links, when opening firefox is on From d97b472480924256dc58686f6a7ea93d0b1acb6f Mon Sep 17 00:00:00 2001 From: mbarone Date: Wed, 27 Nov 2024 09:44:24 +0100 Subject: [PATCH 10/17] Fix Whats new XCUI Test --- .../firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift index 7388cb9b4eb4..8880cfbc8c77 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift @@ -1179,7 +1179,11 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr ) // Passwords (TODO) // Customize Homepage (TODO) - // New in Firefox (TODO: Find out what is Action.OpenWhatsNewPage) + // New in Firefox + screenState.tap( + app.otherElements.cells["MainMenu.WhatsNew"], + forAction: Action.OpenWhatsNewPage + ) // Get Help (TODO: Actions to open support.mozilla.org) // SettingsScreen screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.settings], to: SettingsScreen) From 97d2167c6af88fa1b6b50b8eb028b84932421fc3 Mon Sep 17 00:00:00 2001 From: mbarone Date: Wed, 27 Nov 2024 13:07:14 +0100 Subject: [PATCH 11/17] Fixed Report Site XCUITests --- .../Tests/XCUITests/ReportSiteTests.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ReportSiteTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ReportSiteTests.swift index 951d84d4148c..ef72fbc287bb 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ReportSiteTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ReportSiteTests.swift @@ -10,20 +10,22 @@ class ReportSiteTests: BaseTestCase { setUpLaunchArguments() } + // https://mozilla.testrail.io/index.php?/cases/view/2831278 func testReportSiteIssueOn() { launchAndGoToMenu() - - mozWaitForElementToExist(app.tables.otherElements[StandardImageIdentifiers.Large.lightbulb]) + app.images[StandardImageIdentifiers.Large.tool].tap() + mozWaitForElementToExist(app.otherElements.images[StandardImageIdentifiers.Large.lightbulb]) } + // https://mozilla.testrail.io/index.php?/cases/view/2831279 func testReportSiteIssueOff() { var launchArgs = app.launchArguments + ["\(LaunchArguments.LoadExperiment)reportSiteIssueOff"] launchArgs = launchArgs + ["\(LaunchArguments.ExperimentFeatureName)general-app-features"] app.launchArguments = launchArgs launchAndGoToMenu() - - mozWaitForElementToNotExist(app.tables.otherElements[StandardImageIdentifiers.Large.lightbulb]) + app.images[StandardImageIdentifiers.Large.tool].tap() + mozWaitForElementToNotExist(app.otherElements.images[StandardImageIdentifiers.Large.lightbulb]) } // MARK: Helper From b28f3f76ca32c7d14ad9b9ad68a418d0075fce7b Mon Sep 17 00:00:00 2001 From: mbarone Date: Thu, 28 Nov 2024 10:34:23 +0100 Subject: [PATCH 12/17] Fix Find in page and shortcut tests --- .../firefox-ios-tests/Tests/XCUITests/FindInPageTests.swift | 4 ++-- .../Tests/XCUITests/HomePageSettingsUITest.swift | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FindInPageTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FindInPageTests.swift index 45b7e260da94..964a7c8b8d14 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FindInPageTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FindInPageTests.swift @@ -36,7 +36,7 @@ class FindInPageTests: BaseTestCase { mozWaitForElementToNotExist(app.staticTexts["Fennec pasted from XCUITests-Runner"]) app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton].waitAndTap() - app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.search].waitAndTap() + app.otherElements.images[StandardImageIdentifiers.Large.search].waitAndTap() // Enter some text to start finding if #available(iOS 16, *) { @@ -125,7 +125,7 @@ class FindInPageTests: BaseTestCase { navigator.nowAt(BrowserTab) app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton].waitAndTap() // Enter some text to start finding - app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.search].tap() + app.otherElements.images[StandardImageIdentifiers.Large.search].tap() if #available(iOS 16, *) { app.searchFields["find.searchField"].typeText("The Book of") mozWaitForElementToExist(app.searchFields["The Book of"]) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift index afc48f4e53d8..ca0e7ea8f48d 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift @@ -454,7 +454,10 @@ class HomePageSettingsUITests: BaseTestCase { navigator.openURL(website) waitUntilPageLoad() navigator.goto(BrowserTabMenu) - app.tables.otherElements[StandardImageIdentifiers.Large.pin].waitAndTap() + // Tap on Save item + app.otherElements.images[StandardImageIdentifiers.Large.save].waitAndTap() + // Tap on Add to Shortcuts + app.otherElements.images[StandardImageIdentifiers.Large.pin].waitAndTap() navigator.nowAt(BrowserTab) navigator.performAction(Action.OpenNewTabFromTabTray) navigator.performAction(Action.CloseURLBarOpen) From 0efb86e1738f8b1565f523d2a6280b114454b61a Mon Sep 17 00:00:00 2001 From: mbarone Date: Thu, 28 Nov 2024 13:24:11 +0100 Subject: [PATCH 13/17] Renamed private tab selector --- .../firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift index e7e98d572205..c22bd4a8b2d0 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift @@ -270,7 +270,7 @@ class PrivateBrowsingTest: BaseTestCase { waitUntilPageLoad() navigator.goto(BrowserTabMenu) // Validate menu option New Private Tab - let newPrivateTab = app.tables.otherElements["New Private Tab"] + let newPrivateTab = app.staticTexts["New Private Tab"] mozWaitForElementToExist(newPrivateTab) scrollToElement(newPrivateTab) // Tap on "New private tab" option From d607d971f930ee72e434b9600f9644b549dab547 Mon Sep 17 00:00:00 2001 From: mbarone Date: Fri, 29 Nov 2024 09:53:19 +0100 Subject: [PATCH 14/17] Fix night mode tests --- .../Tests/XCUITests/FxScreenGraph.swift | 2 +- .../Tests/XCUITests/NightModeTests.swift | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift index 8880cfbc8c77..bbd09b17bb78 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift @@ -1098,7 +1098,7 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr to: PageZoom) // Turn on night mode screenState.tap( - app.tables.cells[StandardImageIdentifiers.Large.nightMode], + app.otherElements.images[StandardImageIdentifiers.Large.nightMode], forAction: Action.ToggleNightMode, transitionTo: BrowserTab ) { userState in diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/NightModeTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/NightModeTests.swift index 1abae1456093..f18662b785d8 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/NightModeTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/NightModeTests.swift @@ -7,11 +7,17 @@ import Common class NightModeTests: BaseTestCase { private func checkNightModeOn() { - mozWaitForElementToExist(app.tables.otherElements[StandardImageIdentifiers.Large.nightMode]) + app.otherElements.images[StandardImageIdentifiers.Large.tool].tap() + mozWaitForElementToExist(app.otherElements.cells["MainMenu.NightModeOn"]) + XCTAssertTrue(app.otherElements.cells["MainMenu.NightModeOn"].label == "Turn off Night Mode") + // Turn off night mode + app.otherElements.cells["MainMenu.NightModeOn"].tap() } private func checkNightModeOff() { - mozWaitForElementToExist(app.tables.otherElements[StandardImageIdentifiers.Large.nightMode]) + app.otherElements.images[StandardImageIdentifiers.Large.tool].tap() + mozWaitForElementToExist(app.otherElements.cells["MainMenu.NightModeOn"]) + XCTAssertTrue(app.otherElements.cells["MainMenu.NightModeOn"].label == "Turn on Night Mode") } // https://mozilla.testrail.io/index.php?/cases/view/2307056 @@ -19,7 +25,7 @@ class NightModeTests: BaseTestCase { let url1 = "test-example.html" // Go to a webpage, and select night mode on and off, check it's applied or not navigator.openURL(path(forTestPage: url1)) - + waitUntilPageLoad() // turn on the night mode navigator.performAction(Action.ToggleNightMode) navigator.nowAt(BrowserTab) @@ -27,9 +33,6 @@ class NightModeTests: BaseTestCase { // checking night mode on or off checkNightModeOn() - // turn off the night mode - navigator.performAction(Action.ToggleNightMode) - // checking night mode on or off navigator.nowAt(BrowserTab) navigator.goto(BrowserTabMenu) From 69980a454be103578a45c2a5f85a4418f2d9a6bd Mon Sep 17 00:00:00 2001 From: mbarone Date: Fri, 29 Nov 2024 09:55:27 +0100 Subject: [PATCH 15/17] Removed commented lines --- .../firefox-ios-tests/Tests/XCUITests/LoginsTests.swift | 3 +-- .../Tests/XCUITests/ToolbarMenuTests.swift | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift index b3520eabe07c..2a62bed790d9 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift @@ -201,8 +201,7 @@ class LoginTest: BaseTestCase { app.menuItems["Select All"].tap() app.menuItems["Cut"].waitAndTap() enterTextInField(typedText: "foo") - waitForExistence(app.buttons["Done"]) - app.buttons["Done"].tap() + app.buttons["Done"].waitAndTap() // The username is correctly changed mozWaitForElementToExist(app.tables["Login Detail List"]) mozWaitForElementToExist(app.tables.cells[loginsListURLLabel]) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarMenuTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarMenuTests.swift index 91b4ab7cbbac..f478929d0de7 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarMenuTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarMenuTests.swift @@ -41,14 +41,11 @@ class ToolbarMenuTests: BaseTestCase { ) } navigator.goto(BrowserTabMenu) - // mozWaitForElementToExist(app.tables["Context Menu"]) mozWaitForElementToExist(app.images[StandardImageIdentifiers.Large.avatarCircle]) validateMenuOptions() app.buttons["MainMenu.CloseMenuButton"].tap() XCUIDevice.shared.orientation = .landscapeLeft mozWaitForElementToExist(hamburgerMenu) - // mozWaitForElementToNotExist(app.tables["Context Menu"]) - // mozWaitForElementToExist(app.images[StandardImageIdentifiers.Large.avatarCircle]) mozWaitForElementToExist(app.textFields[AccessibilityIdentifiers.Browser.AddressToolbar.searchTextField]) mozWaitForElementToExist(tabsButton) XCTAssertTrue( @@ -62,11 +59,8 @@ class ToolbarMenuTests: BaseTestCase { ) hamburgerMenu.tap() mozWaitForElementToExist(app.images[StandardImageIdentifiers.Large.avatarCircle]) - // mozWaitForElementToExist(app.tables["Context Menu"]) validateMenuOptions() app.buttons["MainMenu.CloseMenuButton"].tap() - // app.otherElements["PopoverDismissRegion"].tap() - // mozWaitForElementToNotExist(app.tables["Context Menu"]) mozWaitForElementToNotExist(app.images[StandardImageIdentifiers.Large.avatarCircle]) } From fad7cd77c2b75b3770dc420e4d4764bbc33459bf Mon Sep 17 00:00:00 2001 From: mbarone Date: Mon, 2 Dec 2024 12:27:31 +0100 Subject: [PATCH 16/17] Fix Login test --- .../firefox-ios-tests/Tests/XCUITests/LoginsTests.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift index 2a62bed790d9..aab36595f6fb 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift @@ -67,8 +67,11 @@ class LoginTest: BaseTestCase { ] ) XCTAssertEqual(app.tables["Login List"].cells.count, defaultNumRowsLoginsList) - app.buttons["Settings"].tap() - navigator.performAction(Action.OpenNewTabFromTabTray) + app.buttons["Settings"].waitAndTap() + app.buttons["Done"].waitAndTap() + app.buttons[AccessibilityIdentifiers.Toolbar.tabsButton].waitAndTap() + app.buttons[AccessibilityIdentifiers.TabTray.newTabButton].waitAndTap() + navigator.nowAt(NewTabScreen) saveLogin(givenUrl: testLoginPage) // Make sure you can access populated Login List from Browser Tab Menu navigator.goto(LoginsSettings) From 18b1dd7278dad5c683bc67b9db517f88764c37d9 Mon Sep 17 00:00:00 2001 From: Clare So Date: Mon, 2 Dec 2024 11:05:21 -0500 Subject: [PATCH 17/17] Revert indentation change --- .../Tests/XCUITests/TrackingProtectionTests.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift index 85de8de4a25e..68db6e7757ab 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/TrackingProtectionTests.swift @@ -208,10 +208,10 @@ class TrackingProtectionTests: BaseTestCase { navigator.goto(TrackingProtectionContextMenuDetails) // A page displaying the connection is secure waitForElementsToExist( - [ - app.staticTexts["mozilla.org"], - app.staticTexts["Secure connection"] - ] + [ + app.staticTexts["mozilla.org"], + app.staticTexts["Secure connection"] + ] ) XCTAssertEqual( app.buttons[AccessibilityIdentifiers.Browser.AddressToolbar.lockIcon].label,