Skip to content

Commit c8680a6

Browse files
clarmsomdotb-moz
andauthored
Refactor MTE-3854 Integrate menu refactor work and xcode 16 (#23381)
* Integrate menu refactor work and xcode 16 * Disable testTelemetryForSiteMenu for now * No more "Copy Link" from the browser tab menu (known as Action.CopyAddressPAM in the screen graph) * Document what's working on new BrowserTabMenu and what's not * Fix some XCUITEsts with menu redisign experiment On * Fix linter issue * Fix SyncFAUITests XCUITest * Fix SearchTest and SettingsTests * Fix linter issues on SettingsTests * Fix Whats new XCUI Test * Fixed Report Site XCUITests * Fix Find in page and shortcut tests * Renamed private tab selector * Fix night mode tests * Removed commented lines * Fix Login test * Revert indentation change --------- Co-authored-by: mbarone <[email protected]>
1 parent f5130b0 commit c8680a6

20 files changed

+162
-161
lines changed

firefox-ios/firefox-ios-tests/Tests/UnitTest.xctestplan

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
"ShortcutRouteTests\/testOpenLastBookmarkShortcutWithInvalidUrl()",
120120
"TabManagerTests\/testDeleteSelectedTab()",
121121
"TabManagerTests\/testPrivatePreference_togglePBMDeletesPrivate()",
122+
"TabToolbarHelperTests\/testTelemetryForSiteMenu()",
122123
"TestFavicons\/testFaviconFetcherParse()",
123124
"VersionSettingTests",
124125
"VersionSettingTests\/testCopyAppVersion()"

firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,13 @@ class BaseTestCase: XCTestCase {
239239
timeout: TIMEOUT
240240
)
241241
navigator.goto(BrowserTabMenu)
242-
mozWaitForElementToExist(
243-
app.tables.otherElements[StandardImageIdentifiers.Large.bookmark],
244-
timeout: TIMEOUT_LONG
245-
)
246-
app.tables.otherElements[StandardImageIdentifiers.Large.bookmark].tap()
247-
navigator.nowAt(BrowserTab)
242+
navigator.goto(SaveBrowserTabMenu)
243+
navigator.performAction(Action.Bookmark)
248244
}
249245

250246
func unbookmark() {
251-
navigator.goto(BrowserTabMenu)
252-
app.otherElements[StandardImageIdentifiers.Large.bookmarkSlash].waitAndTap()
247+
bookmark()
248+
app.buttons["Delete Bookmark"].waitAndTap()
253249
navigator.nowAt(BrowserTab)
254250
}
255251

firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,23 @@ let url_3 = "localhost:\(serverPort)/test-fixture/test-example.html"
1212

1313
class BookmarksTests: BaseTestCase {
1414
private func checkBookmarked() {
15-
navigator.goto(BrowserTabMenu)
16-
mozWaitForElementToExist(app.tables.otherElements[StandardImageIdentifiers.Large.bookmarkSlash])
17-
if iPad() {
18-
app.otherElements["PopoverDismissRegion"].tap()
19-
navigator.nowAt(BrowserTab)
20-
} else {
21-
navigator.goto(BrowserTab)
22-
}
15+
navigator.goto(LibraryPanel_Bookmarks)
16+
app.buttons["Done"].waitAndTap()
17+
navigator.nowAt(BrowserTab)
2318
}
2419

2520
private func undoBookmarkRemoval() {
26-
navigator.goto(BrowserTabMenu)
27-
app.otherElements[StandardImageIdentifiers.Large.bookmarkSlash].waitAndTap()
28-
navigator.nowAt(BrowserTab)
21+
navigator.goto(SaveBrowserTabMenu)
22+
app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarkThisPage].waitAndTap()
23+
app.staticTexts["Delete Bookmark"].waitAndTap()
2924
app.buttons["Undo"].waitAndTap()
25+
navigator.nowAt(BrowserTab)
3026
}
3127

3228
private func checkUnbookmarked() {
33-
navigator.goto(BrowserTabMenu)
34-
mozWaitForElementToExist(app.tables.otherElements[StandardImageIdentifiers.Large.bookmark])
35-
if iPad() {
36-
app.otherElements["PopoverDismissRegion"].tap()
37-
navigator.nowAt(BrowserTab)
38-
} else {
39-
navigator.goto(BrowserTab)
40-
}
29+
navigator.goto(LibraryPanel_Bookmarks)
30+
app.buttons["Done"].waitAndTap()
31+
navigator.nowAt(BrowserTab)
4132
}
4233

4334
// https://mozilla.testrail.io/index.php?/cases/view/2306905
@@ -354,9 +345,11 @@ class BookmarksTests: BaseTestCase {
354345
bookmarkPageAndTapEdit()
355346
app.buttons["crossLarge"].tap()
356347
waitForTabsButton()
348+
navigator.nowAt(BrowserTab)
357349
unbookmark()
358350
bookmarkPageAndTapEdit()
359351
app.buttons["Save"].tap()
352+
navigator.nowAt(BrowserTab)
360353
navigator.goto(LibraryPanel_Bookmarks)
361354
checkItemInBookmarkList(oneItemBookmarked: true)
362355
}
@@ -394,8 +387,8 @@ class BookmarksTests: BaseTestCase {
394387
}
395388

396389
private func bookmarkPageAndTapEdit() {
397-
bookmark()
398-
app.buttons["Edit"].waitAndTap()
390+
bookmark() // Bookmark the page
391+
bookmark() // Open the "Edit Bookmark" page
399392
mozWaitForElementToExist(app.navigationBars["Edit Bookmark"])
400393
}
401394
}

firefox-ios/firefox-ios-tests/Tests/XCUITests/ClipBoardTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ class ClipBoardTests: BaseTestCase {
7373
// Tap on "Copy Link
7474
navigator.openURL(url_3)
7575
waitForTabsButton()
76+
// Menu Refactor: No "Copy Link" from browser tab menu
77+
/*
7678
navigator.performAction(Action.CopyAddressPAM)
7779
// The Link is copied to clipboard
7880
mozWaitForElementToExist(app.staticTexts["URL Copied To Clipboard"])
@@ -86,6 +88,7 @@ class ClipBoardTests: BaseTestCase {
8688
mozWaitForElementToExist(urlBar)
8789
waitForValueContains(urlBar, value: "localhost")
8890
mozWaitForElementToExist(app.staticTexts["Example Domain"])
91+
*/
8992
}
9093

9194
// https://mozilla.testrail.io/index.php?/cases/view/2325691

firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ class DesktopModeTestsIphone: IphoneOnlyTestCase {
109109
XCTAssert(app.webViews.staticTexts.matching(identifier: "MOBILE_UA").count > 0)
110110
mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton])
111111
navigator.goto(BrowserTabMenu)
112-
mozWaitForElementToExist(app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.deviceDesktop])
112+
mozWaitForElementToExist(app.tables.cells[AccessibilityIdentifiers.MainMenu.switchToDesktopSite])
113113
navigator.goto(RequestDesktopSite)
114114
waitUntilPageLoad()
115115
XCTAssert(app.webViews.staticTexts.matching(identifier: "DESKTOP_UA").count > 0)
116116

117117
navigator.nowAt(BrowserTab)
118118
navigator.goto(BrowserTabMenu)
119-
mozWaitForElementToExist(app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.deviceMobile])
119+
mozWaitForElementToExist(app.tables.cells.staticTexts["Switch to Mobile Site"])
120120
// Select Mobile site here, the identifier is the same but the Text is not
121121
navigator.goto(RequestMobileSite)
122122
waitUntilPageLoad()

firefox-ios/firefox-ios-tests/Tests/XCUITests/FindInPageTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class FindInPageTests: BaseTestCase {
3636

3737
mozWaitForElementToNotExist(app.staticTexts["Fennec pasted from XCUITests-Runner"])
3838
app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton].waitAndTap()
39-
app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.search].waitAndTap()
39+
app.otherElements.images[StandardImageIdentifiers.Large.search].waitAndTap()
4040

4141
// Enter some text to start finding
4242
if #available(iOS 16, *) {
@@ -125,7 +125,7 @@ class FindInPageTests: BaseTestCase {
125125
navigator.nowAt(BrowserTab)
126126
app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton].waitAndTap()
127127
// Enter some text to start finding
128-
app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.search].tap()
128+
app.otherElements.images[StandardImageIdentifiers.Large.search].tap()
129129
if #available(iOS 16, *) {
130130
app.searchFields["find.searchField"].typeText("The Book of")
131131
mozWaitForElementToExist(app.searchFields["The Book of"])

firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift

Lines changed: 78 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// License, v. 2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at http://mozilla.org/MPL/2.0/
44

5+
// swiftlint:disable all
6+
57
import Common
68
import Foundation
79
import MappaMundi
@@ -59,6 +61,8 @@ let CreditCardsSettings = "AutofillCreditCard"
5961
let PageZoom = "PageZoom"
6062
let NotificationsSettings = "NotificationsSetting"
6163
let AddressesSettings = "AutofillAddress"
64+
let ToolsBrowserTabMenu = "ToolsBrowserTabMenu"
65+
let SaveBrowserTabMenu = "SaveBrowserTabMenu"
6266

6367
// These are in the exact order they appear in the settings
6468
// screen. XCUIApplication loses them on small screens.
@@ -571,6 +575,7 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr
571575
screenState.gesture(forAction: Action.CloseDownloadsPanel, transitionTo: HomePanelsScreen) { userState in
572576
app.buttons["Done"].tap()
573577
}
578+
screenState.tap(app.buttons["readingListLarge"], to: LibraryPanel_ReadingList)
574579
}
575580

576581
map.addScreenState(HistoryRecentlyClosed) { screenState in
@@ -1086,108 +1091,104 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr
10861091
screenState.backAction = navigationControllerBackAction
10871092
}
10881093

1089-
map.addScreenState(BrowserTabMenu) { screenState in
1090-
sleep(1)
1091-
screenState.tap(
1092-
app.tables.otherElements[StandardImageIdentifiers.Large.settings],
1093-
to: SettingsScreen
1094-
)
1095-
screenState.tap(
1096-
app.tables.otherElements[StandardImageIdentifiers.Large.sync],
1097-
to: Intro_FxASignin,
1098-
if: "fxaUsername == nil"
1099-
)
1100-
screenState.tap(
1101-
app.tables.otherElements[StandardImageIdentifiers.Large.login],
1102-
to: LoginsSettings
1103-
)
1104-
screenState.tap(
1105-
app.tables.otherElements[StandardImageIdentifiers.Large.bookmarkTrayFill],
1106-
to: LibraryPanel_Bookmarks
1107-
)
1108-
screenState.tap(
1109-
app.tables.otherElements[StandardImageIdentifiers.Large.history],
1110-
to: LibraryPanel_History
1111-
)
1112-
screenState.tap(
1113-
app.tables.otherElements[StandardImageIdentifiers.Large.download],
1114-
to: LibraryPanel_Downloads
1115-
)
1116-
screenState.tap(
1117-
app.tables.otherElements[StandardImageIdentifiers.Large.readingList],
1118-
to: LibraryPanel_ReadingList
1119-
)
1094+
map.addScreenState(ToolsBrowserTabMenu) { screenState in
1095+
// Zoom
11201096
screenState.tap(
1121-
app.tables.otherElements[StandardImageIdentifiers.Large.avatarCircle],
1122-
to: FxAccountManagementPage
1123-
)
1124-
1097+
app.tables.cells[AccessibilityIdentifiers.MainMenu.zoom],
1098+
to: PageZoom)
1099+
// Turn on night mode
11251100
screenState.tap(
1126-
app.tables.otherElements[StandardImageIdentifiers.Large.nightMode],
1101+
app.otherElements.images[StandardImageIdentifiers.Large.nightMode],
11271102
forAction: Action.ToggleNightMode,
1128-
transitionTo: BrowserTabMenu
1103+
transitionTo: BrowserTab
11291104
) { userState in
11301105
userState.nightMode = !userState.nightMode
11311106
}
1132-
1133-
screenState.tap(
1134-
app.tables.otherElements[StandardImageIdentifiers.Large.whatsNew],
1135-
forAction: Action.OpenWhatsNewPage
1136-
) { userState in
1137-
}
1107+
// Report broken site (TODO)
1108+
// Share
11381109
screenState.tap(
1139-
app.tables.otherElements[StandardImageIdentifiers.Large.deviceDesktopSend],
1140-
forAction: Action.SentToDevice
1141-
) { userState in
1142-
}
1143-
1144-
screenState.tap(
1145-
app.tables.otherElements[StandardImageIdentifiers.Large.share],
1110+
app.tables.cells[AccessibilityIdentifiers.MainMenu.share],
11461111
forAction: Action.ShareBrowserTabMenuOption
11471112
) { userState in
11481113
}
11491114

1115+
screenState.dismissOnUse = true
1116+
screenState.backAction = cancelBackAction
1117+
}
1118+
1119+
map.addScreenState(SaveBrowserTabMenu) { screenState in
1120+
// Bookmark this page
11501121
screenState.tap(
1151-
app.tables.otherElements[StandardImageIdentifiers.Large.deviceDesktop],
1152-
to: RequestDesktopSite
1122+
app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarkThisPage],
1123+
forAction: Action.BookmarkThreeDots
11531124
)
11541125
screenState.tap(
1155-
app.tables.otherElements[StandardImageIdentifiers.Large.deviceMobile],
1156-
to: RequestMobileSite
1126+
app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarkThisPage],
1127+
forAction: Action.Bookmark
11571128
)
1129+
// Add to shortcuts
1130+
// No Copy link available (Action.CopyAddressPAM)
11581131
screenState.tap(
1159-
app.tables.otherElements[StandardImageIdentifiers.Large.search],
1160-
to: FindInPage
1132+
app.tables.cells[AccessibilityIdentifiers.MainMenu.addToShortcuts],
1133+
forAction: Action.PinToTopSitesPAM
11611134
)
11621135
screenState.tap(
1163-
app.tables.otherElements[StandardImageIdentifiers.Large.pageZoom],
1164-
to: PageZoom
1136+
app.tables.cells[AccessibilityIdentifiers.MainMenu.saveToReadingList],
1137+
forAction: Action.AddToReadingListBrowserTabMenu
11651138
)
1166-
// TODO: Add new state
1167-
// screenState.tap(
1168-
// app.tables["Context Menu"].otherElements[StandardImageIdentifiers.Large.lightbulb],
1169-
// to: ReportSiteIssue
1170-
// )
11711139

1140+
screenState.dismissOnUse = true
1141+
screenState.backAction = navigationControllerBackAction
1142+
}
1143+
1144+
map.addScreenState(BrowserTabMenu) { screenState in
1145+
sleep(1)
1146+
1147+
// Sign In (if unauthenticated)
11721148
screenState.tap(
1173-
app.tables.otherElements[StandardImageIdentifiers.Large.pin],
1174-
forAction: Action.PinToTopSitesPAM
1175-
)
1149+
app.buttons[AccessibilityIdentifiers.MainMenu.HeaderView.mainButton],
1150+
to: Intro_FxASignin,
1151+
if: "fxaUsername == nil")
1152+
// Signed in (TODO)
1153+
// New tab
1154+
screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.newTab], to: NewTabScreen)
1155+
// New private tab (TODO: Action.OpenPrivateTabLongPressTabsButton
1156+
// Switch to Desktop/Mobile Site
1157+
// The cell's identifier is the same for desktop and mobile, so I use static
1158+
// texts for the RequestMobileSite case
1159+
screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.switchToDesktopSite], to: RequestDesktopSite)
1160+
screenState.tap(app.tables.cells.staticTexts["Switch to Mobile Site"], to: RequestMobileSite)
1161+
// Find in Page...
11761162
screenState.tap(
1177-
app.tables.otherElements[StandardImageIdentifiers.Large.link],
1178-
forAction: Action.CopyAddressPAM
1179-
)
1180-
1163+
app.tables.cells[AccessibilityIdentifiers.MainMenu.findInPage],
1164+
to: FindInPage)
1165+
// Tools (Zoom, NightMode, Report, Share)
1166+
screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.tools], to: ToolsBrowserTabMenu)
1167+
// Save (Add Bookmark, Shortcut)
1168+
screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.save], to: SaveBrowserTabMenu)
1169+
// Bookmarks
1170+
screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.bookmarks], to: LibraryPanel_Bookmarks)
1171+
// History
11811172
screenState.tap(
1182-
app.tables.otherElements[StandardImageIdentifiers.Large.bookmark],
1183-
forAction: Action.BookmarkThreeDots,
1184-
Action.Bookmark
1173+
app.tables.cells[AccessibilityIdentifiers.MainMenu.history],
1174+
to: LibraryPanel_History)
1175+
// Downloads
1176+
screenState.tap(
1177+
app.tables.cells[AccessibilityIdentifiers.MainMenu.downloads],
1178+
to: LibraryPanel_Downloads
11851179
)
1180+
// Passwords (TODO)
1181+
// Customize Homepage (TODO)
1182+
// New in Firefox
11861183
screenState.tap(
1187-
app.tables.otherElements[StandardImageIdentifiers.Large.readingListAdd],
1188-
forAction: Action.AddToReadingListBrowserTabMenu
1184+
app.otherElements.cells["MainMenu.WhatsNew"],
1185+
forAction: Action.OpenWhatsNewPage
11891186
)
1187+
// Get Help (TODO: Actions to open support.mozilla.org)
1188+
// SettingsScreen
1189+
screenState.tap(app.tables.cells[AccessibilityIdentifiers.MainMenu.settings], to: SettingsScreen)
11901190

1191+
// "x" for close the menu and go back
11911192
screenState.dismissOnUse = true
11921193
screenState.backAction = cancelBackAction
11931194
}
@@ -1311,3 +1312,5 @@ extension XCUIElement {
13111312
}
13121313
}
13131314
}
1315+
1316+
// swiftlint:enable all

firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,10 @@ class HomePageSettingsUITests: BaseTestCase {
454454
navigator.openURL(website)
455455
waitUntilPageLoad()
456456
navigator.goto(BrowserTabMenu)
457-
app.tables.otherElements[StandardImageIdentifiers.Large.pin].waitAndTap()
457+
// Tap on Save item
458+
app.otherElements.images[StandardImageIdentifiers.Large.save].waitAndTap()
459+
// Tap on Add to Shortcuts
460+
app.otherElements.images[StandardImageIdentifiers.Large.pin].waitAndTap()
458461
navigator.nowAt(BrowserTab)
459462
navigator.performAction(Action.OpenNewTabFromTabTray)
460463
navigator.performAction(Action.CloseURLBarOpen)

0 commit comments

Comments
 (0)