@@ -384,6 +384,7 @@ class TopTabsTest: BaseTestCase {
384
384
// Tab tray UI experiment doesn't have toasts notifications anymore
385
385
// https://github.com/mozilla-mobile/firefox-ios/issues/25343
386
386
// Choose to undo the action
387
+ <<<<<<< HEAD: firefox- ios/ firefox- ios- tests/ Tests/ XCUITests/ TopTabsTest . swift
387
388
// app.buttons["Undo"].waitAndTap()
388
389
// waitUntilPageLoad()
389
390
// // Only the latest tab closed is restored
@@ -410,6 +411,88 @@ class TopTabsTest: BaseTestCase {
410
411
// XCTAssertEqual(1, tabsTrayCell.count)
411
412
// }
412
413
// 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
413
496
}
414
497
415
498
private func validateToastWhenClosingMultipleTabs( ) {
0 commit comments