Skip to content

Commit 6d8857a

Browse files
clarmsomergify[bot]
authored andcommitted
Bugfix FXIOS-11782 Missing experiment related image identifiers (#25733)
Revert close button back to StandardImageIdentifiers.Large.cross (cherry picked from commit a73eda1) # Conflicts: # firefox-ios/firefox-ios-tests/Tests/XCUITests/TopTabsTest.swift
1 parent e19101c commit 6d8857a

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class TabCounterTests: BaseTestCase {
6868
XCTAssertTrue(tabsOpenTabTray.hasSuffix("2"))
6969

7070
app.otherElements["Tabs Tray"].cells
71-
.element(boundBy: 0).buttons[AccessibilityIdentifiers.TabTray.closeButton].waitAndTap()
71+
.element(boundBy: 0).buttons[StandardImageIdentifiers.Large.cross].waitAndTap()
7272
}
7373

7474
app.otherElements["Tabs Tray"].cells.element(boundBy: 0).waitAndTap()

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

+83
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ class TopTabsTest: BaseTestCase {
384384
// Tab tray UI experiment doesn't have toasts notifications anymore
385385
// https://github.com/mozilla-mobile/firefox-ios/issues/25343
386386
// Choose to undo the action
387+
<<<<<<< HEAD:firefox-ios/firefox-ios-tests/Tests/XCUITests/TopTabsTest.swift
387388
// app.buttons["Undo"].waitAndTap()
388389
// waitUntilPageLoad()
389390
// // Only the latest tab closed is restored
@@ -410,6 +411,88 @@ class TopTabsTest: BaseTestCase {
410411
// XCTAssertEqual(1, tabsTrayCell.count)
411412
// }
412413
// mozWaitForElementToExist(app.otherElements.cells.staticTexts[urlLabelExample])
414+
=======
415+
app.buttons["Undo"].waitAndTap()
416+
waitUntilPageLoad()
417+
// Only the latest tab closed is restored
418+
navigator.nowAt(BrowserTab)
419+
waitForTabsButton()
420+
navigator.goto(TabTray)
421+
let tabsTrayCell = app.otherElements["Tabs Tray"].cells
422+
if !iPad() {
423+
let button = AccessibilityIdentifiers.Toolbar.tabsButton
424+
let numTab = app.buttons[button].value as? String
425+
XCTAssertEqual(numTab, "\(tabsTrayCell.count)")
426+
} else {
427+
XCTAssertEqual(tabsTrayCell.count, 2)
428+
XCTAssertTrue(app.buttons.elementContainingText("2").exists)
429+
}
430+
mozWaitForElementToExist(app.otherElements.cells.staticTexts[urlLabelExample])
431+
// Repeat for private browsing mode
432+
navigator.performAction(Action.TogglePrivateMode)
433+
validateToastWhenClosingMultipleTabs()
434+
// Choose to undo the action
435+
app.buttons["Undo"].waitAndTap()
436+
// Only the latest tab closed is restored
437+
if !iPad() {
438+
let tabsTrayCell = app.otherElements["Tabs Tray"].cells
439+
XCTAssertEqual(1, tabsTrayCell.count)
440+
}
441+
mozWaitForElementToExist(app.otherElements.cells.staticTexts[urlLabelExample])
442+
}
443+
444+
// https://mozilla.testrail.io/index.php?/cases/view/2306867
445+
func testCloseOneTabUndo() {
446+
// Open a few tabs
447+
waitForTabsButton()
448+
navigator.openURL("http://localhost:\(serverPort)/test-fixture/find-in-page-test.html")
449+
waitUntilPageLoad()
450+
navigator.createNewTab()
451+
navigator.openURL("http://localhost:\(serverPort)/test-fixture/test-example.html")
452+
waitUntilPageLoad()
453+
navigator.createNewTab()
454+
navigator.openURL("localhost:\(serverPort)/test-fixture/test-mozilla-org.html")
455+
waitUntilPageLoad()
456+
navigator.goto(TabTray)
457+
458+
// Experiment from #25337: "Undo" button no longer available on iPhone.
459+
if iPad() {
460+
// Tap "x"
461+
app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"].buttons[StandardImageIdentifiers.Large.cross].tap()
462+
mozWaitForElementToNotExist(app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"])
463+
app.buttons["Undo"].waitAndTap()
464+
mozWaitForElementToExist(app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"])
465+
466+
// Long press tab. Tap "Close Tab" from the context menu
467+
app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"].press(forDuration: 2)
468+
mozWaitForElementToExist(app.collectionViews.buttons["Close Tab"])
469+
app.collectionViews.buttons["Close Tab"].waitAndTap()
470+
mozWaitForElementToNotExist(app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"])
471+
app.buttons["Undo"].waitAndTap()
472+
mozWaitForElementToExist(app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"])
473+
474+
// Swipe tab
475+
app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"].swipeLeft()
476+
mozWaitForElementToNotExist(app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"])
477+
app.buttons["Undo"].waitAndTap()
478+
mozWaitForElementToExist(app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"])
479+
} else {
480+
// Tap "x"
481+
app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"]
482+
.buttons[StandardImageIdentifiers.Large.cross].waitAndTap()
483+
mozWaitForElementToNotExist(app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"])
484+
485+
// Long press tab. Tap "Close Tab" from the context menu
486+
app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_1"].press(forDuration: 2)
487+
mozWaitForElementToExist(app.collectionViews.buttons["Close Tab"])
488+
app.collectionViews.buttons["Close Tab"].waitAndTap()
489+
mozWaitForElementToNotExist(app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_2"])
490+
491+
// Swipe tab
492+
app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_0"].swipeLeft()
493+
mozWaitForElementToNotExist(app.cells[AccessibilityIdentifiers.TabTray.tabCell+"_1_0"])
494+
}
495+
>>>>>>> a73eda1ac (Bugfix FXIOS-11782 Missing experiment related image identifiers (#25733)):firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift
413496
}
414497

415498
private func validateToastWhenClosingMultipleTabs() {

0 commit comments

Comments
 (0)