Unverified Commit 52c2fdb3 authored by Jeff Boek's avatar Jeff Boek Committed by GitHub
Browse files

Remove tab tray feature flag (#11176)

* For #11171 - Removes feature flag for the new tab tray

* For #11171 - Removes all tab references from homeFragment

* For #11171 - Fixes unit tests

* For #11171 - Gets UI tests to compile and HomeScreenTest to pass

* For #11171 - Fixes `deleteMultipleSelectionTest`

* For #11171 - Fixes `openHistoryItemInNewPrivateTabTest`

* For #11171 - Fixes `openHistoryInPrivateTabTest`

* For #11171 - Fixes `openHistoryInNewTabTest`

* For #11171 - Fixes `openNewPrivateTabTest`

* For #11171 - Fixes tabbedBrowsingTests

* For #11171 - Fixes SettingsPrivacyTest

* For #11171 - Fixes TopSitesTest

* For #11171 - Fixes lint errors

* Ignore
parent 4b3230a1
......@@ -178,8 +178,8 @@ class MenuScreenShotTest : ScreenshotTest() {
}.openThreeDotMenu {
Screengrab.screenshot("browser-tab-menu")
}.closeBrowserMenuToBrowser {
}.openHomeScreen {
Screengrab.screenshot("homescree-with-tabs")
}.openTabDrawer {
Screengrab.screenshot("tab-drawer-with-tabs")
closeTab()
Screengrab.screenshot("remove-tab")
}
......
......@@ -234,8 +234,8 @@ class BookmarksTest {
}.openThreeDotMenu(defaultWebPage.url) {
}.clickOpenInNewTab {
verifyPageContent(defaultWebPage.content)
}.openHomeScreen {
verifyOpenTabsHeader()
}.openTabDrawer {
verifyNormalModeSelected()
}
}
......@@ -253,8 +253,8 @@ class BookmarksTest {
}.openThreeDotMenu(defaultWebPage.url) {
}.clickOpenInPrivateTab {
verifyPageContent(defaultWebPage.content)
}.openHomeScreen {
verifyPrivateSessionHeader()
}.openTabDrawer {
verifyPrivateModeSelected()
}
}
......@@ -327,9 +327,9 @@ class BookmarksTest {
browserScreen {
createBookmark(defaultWebPage.url)
}.openHomeScreen {
}.openTabDrawer {
closeTab()
}.openThreeDotMenu {
}.openHomeScreen { }.openThreeDotMenu {
}.openBookmarks {
bookmarksListIdlingResource =
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.bookmark_list))
......@@ -340,9 +340,9 @@ class BookmarksTest {
}
multipleSelectionToolbar {
}.clickOpenNewTab {
}.clickOpenNewTab { }.openTabDrawer {
verifyNormalModeSelected()
verifyExistingTabList()
verifyOpenTabsHeader()
}
}
......@@ -363,9 +363,9 @@ class BookmarksTest {
}
multipleSelectionToolbar {
}.clickOpenPrivateTab {
}.clickOpenPrivateTab { }.openTabDrawer {
verifyPrivateModeSelected()
verifyExistingTabList()
verifyPrivateSessionHeader()
}
}
......
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
package org.mozilla.fenix.ui
import androidx.test.espresso.NoMatchingViewException
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import okhttp3.mockwebserver.MockWebServer
import org.junit.After
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar
/**
* Tests for verifying basic functionality of tab collection
*
*/
class CollectionTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
private lateinit var mockWebServer: MockWebServer
private val firstCollectionName = "testcollection_1"
private val secondCollectionName = "testcollection_2"
@get:Rule
val activityTestRule = HomeActivityTestRule()
@Before
fun setUp() {
mockWebServer = MockWebServer().apply {
setDispatcher(AndroidAssetDispatcher())
start()
}
}
@After
fun tearDown() {
mockWebServer.shutdown()
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun verifyCreateFirstCollectionFlowItems() {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
}.openHomeScreen {
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) {
}.openHomeScreen {
clickSaveCollectionButton()
verifySelectTabsView()
selectAllTabsForCollection()
verifyTabsSelectedCounterText(2)
deselectAllTabsForCollection()
verifyTabsSelectedCounterText(0)
selectTabForCollection(firstWebPage.title)
verifyTabsSelectedCounterText(1)
selectAllTabsForCollection()
saveTabsSelectedForCollection()
verifyNameCollectionView()
verifyDefaultCollectionName("Collection 1")
typeCollectionName(firstCollectionName)
verifySnackBarText("Tabs saved!")
verifyExistingOpenTabs(firstWebPage.title)
verifyExistingOpenTabs(secondWebPage.title)
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
// open a webpage, and add currently opened tab to existing collection
fun addTabToExistingCollectionTest() {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
createCollection(firstCollectionName)
homeScreen {
verifyExistingTabList()
closeTab()
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) {
verifyPageContent(secondWebPage.content)
}.openThreeDotMenu {
clickBrowserViewSaveCollectionButton()
}.selectExistingCollection(firstCollectionName) {
verifySnackBarText("Tab saved!")
}.openHomeScreen {
verifyExistingTabList()
expandCollection(firstCollectionName)
verifyItemInCollectionExists(firstWebPage.title)
verifyItemInCollectionExists(secondWebPage.title)
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun collectionMenuAddTabButtonTest() {
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
createCollection(firstCollectionName)
homeScreen {
closeTab()
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) {
}.openHomeScreen {
expandCollection(firstCollectionName)
clickCollectionThreeDotButton()
selectAddTabToCollection()
verifyTabsSelectedCounterText(1)
saveTabsSelectedForCollection()
verifySnackBarText("Tab saved!")
verifyItemInCollectionExists(secondWebPage.title)
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun collectionMenuOpenAllTabsTest() {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
createCollection(firstCollectionName)
homeScreen {
closeTab()
expandCollection(firstCollectionName)
clickCollectionThreeDotButton()
selectOpenTabs()
verifyExistingOpenTabs(firstWebPage.title)
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun renameCollectionTest() {
createCollection(firstCollectionName)
homeScreen {
// On homeview, tap the 3-dot button to expand, select rename, rename collection
expandCollection(firstCollectionName)
clickCollectionThreeDotButton()
selectRenameCollection()
typeCollectionName("renamed_collection")
verifyCollectionIsDisplayed("renamed_collection")
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun deleteCollectionTest() {
createCollection(firstCollectionName)
homeScreen {
expandCollection(firstCollectionName)
clickCollectionThreeDotButton()
selectDeleteCollection()
confirmDeleteCollection()
verifyNoCollectionsHeader()
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun createCollectionFromTabTest() {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
createCollection(firstCollectionName)
homeScreen {
// swipe to bottom until the collections are shown
verifyExistingOpenTabs(firstWebPage.title)
try {
verifyCollectionIsDisplayed(firstCollectionName)
} catch (e: NoMatchingViewException) {
scrollToElementByText(firstCollectionName)
}
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun verifyExpandedCollectionItemsTest() {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
createCollection(firstCollectionName)
homeScreen {
verifyCollectionIsDisplayed(firstCollectionName)
verifyCollectionIcon()
expandCollection(firstCollectionName)
verifyItemInCollectionExists(firstWebPage.title)
verifyCollectionItemLogo()
verifyCollectionItemUrl()
verifyShareCollectionButtonIsVisible(true)
verifyCollectionMenuIsVisible(true)
verifyCollectionItemRemoveButtonIsVisible(firstWebPage.title, true)
collapseCollection(firstCollectionName)
verifyItemInCollectionExists(firstWebPage.title, false)
verifyShareCollectionButtonIsVisible(false)
verifyCollectionMenuIsVisible(false)
verifyCollectionItemRemoveButtonIsVisible(firstWebPage.title, false)
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun shareCollectionTest() {
createCollection(firstCollectionName)
homeScreen {
expandCollection(firstCollectionName)
clickShareCollectionButton()
verifyShareTabsOverlay()
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun removeTabFromCollectionTest() {
val webPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
createCollection(firstCollectionName)
homeScreen {
closeTab()
expandCollection(firstCollectionName)
removeTabFromCollection(webPage.title)
verifyItemInCollectionExists(webPage.title, false)
}
createCollection(firstCollectionName)
homeScreen {
closeTab()
expandCollection(firstCollectionName)
swipeCollectionItemLeft(webPage.title)
verifyItemInCollectionExists(webPage.title, false)
}
createCollection(firstCollectionName)
homeScreen {
closeTab()
expandCollection(firstCollectionName)
swipeCollectionItemRight(webPage.title)
verifyItemInCollectionExists(webPage.title, false)
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun selectTabOnLongTapTest() {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
}.openHomeScreen {
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) {
}.openHomeScreen {
longTapSelectTab(firstWebPage.title)
verifySelectTabsView()
verifyTabsSelectedCounterText(1)
selectTabForCollection(secondWebPage.title)
verifyTabsSelectedCounterText(2)
saveTabsSelectedForCollection()
typeCollectionName(firstCollectionName)
verifySnackBarText("Tabs saved!")
closeTabViaXButton(firstWebPage.title)
closeTabViaXButton(secondWebPage.title)
expandCollection(firstCollectionName)
verifyItemInCollectionExists(firstWebPage.title)
verifyItemInCollectionExists(secondWebPage.title)
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun tabsOverflowMenuSaveCollectionTest() {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
}.openHomeScreen {
}.openNavigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) {
}.openHomeScreen {
}.openTabsListThreeDotMenu {
verifySaveCollection()
}.clickOpenTabsMenuSaveCollection {
verifySelectTabsView()
verifyTabsSelectedCounterText(0)
selectAllTabsForCollection()
verifyTabsSelectedCounterText(2)
saveTabsSelectedForCollection()
typeCollectionName(firstCollectionName)
closeTabViaXButton(firstWebPage.title)
closeTabViaXButton(secondWebPage.title)
expandCollection(firstCollectionName)
verifyItemInCollectionExists(firstWebPage.title)
verifyItemInCollectionExists(secondWebPage.title)
}
}
@Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
@Test
fun navigateBackInCollectionFlowTest() {
val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
createCollection(firstCollectionName)
navigationToolbar {
}.enterURLAndEnterToBrowser(secondWebPage.url) {
}.openHomeScreen {
longTapSelectTab(secondWebPage.title)
verifySelectTabsView()
saveTabsSelectedForCollection()
verifySelectCollectionView()
clickAddNewCollection()
verifyNameCollectionView()
goBackCollectionFlow()
verifySelectCollectionView()
goBackCollectionFlow()
verifySelectTabsView()
goBackCollectionFlow()
verifyHomeComponent()
}
}
private fun createCollection(collectionName: String, firstCollection: Boolean = true) {
val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
navigationToolbar {
}.enterURLAndEnterToBrowser(firstWebPage.url) {
verifyPageContent(firstWebPage.content)
}.openThreeDotMenu {
clickBrowserViewSaveCollectionButton()
if (!firstCollection)
clickAddNewCollection()
}.typeCollectionName(collectionName) {
verifySnackBarText("Tab saved!")
}.openHomeScreen {
mDevice.wait(
Until.findObject(By.text(collectionName)),
TestAssetHelper.waitingTime
)
}
}
}
///* This Source Code Form is subject to the terms of the Mozilla Public
// * 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/. */
//
//package org.mozilla.fenix.ui
//
//import androidx.test.espresso.NoMatchingViewException
//import androidx.test.platform.app.InstrumentationRegistry
//import androidx.test.uiautomator.By
//import androidx.test.uiautomator.UiDevice
//import androidx.test.uiautomator.Until
//import okhttp3.mockwebserver.MockWebServer
//import org.junit.After
//import org.junit.Before
//import org.junit.Ignore
//import org.junit.Rule
//import org.junit.Test
//import org.mozilla.fenix.helpers.AndroidAssetDispatcher
//import org.mozilla.fenix.helpers.HomeActivityTestRule
//import org.mozilla.fenix.helpers.TestAssetHelper
//import org.mozilla.fenix.ui.robots.homeScreen
//import org.mozilla.fenix.ui.robots.navigationToolbar
//
///**
// * Tests for verifying basic functionality of tab collection
// *
// */
//
//class CollectionTest {
// /* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
//
// private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
// private lateinit var mockWebServer: MockWebServer
// private val firstCollectionName = "testcollection_1"
// private val secondCollectionName = "testcollection_2"
//
// @get:Rule
// val activityTestRule = HomeActivityTestRule()
//
// @Before
// fun setUp() {
// mockWebServer = MockWebServer().apply {
// setDispatcher(AndroidAssetDispatcher())
// start()
// }
// }
//
// @After
// fun tearDown() {
// mockWebServer.shutdown()
// }
//
// @Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
// @Test
// fun verifyCreateFirstCollectionFlowItems() {
// val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
// val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
//
// navigationToolbar {
// }.enterURLAndEnterToBrowser(firstWebPage.url) {
// }.openHomeScreen {
// }.openNavigationToolbar {
// }.enterURLAndEnterToBrowser(secondWebPage.url) {
// }.openTabDrawer {
// }.openTabsListThreeDotMenu {
// verifySaveCollection()
// }.clickOpenTabsMenuSaveCollection {
// clickSaveCollectionButton()
// verifySelectTabsView()
// selectAllTabsForCollection()
// verifyTabsSelectedCounterText(2)
// deselectAllTabsForCollection()
// verifyTabsSelectedCounterText(0)
// selectTabForCollection(firstWebPage.title)
// verifyTabsSelectedCounterText(1)
// selectAllTabsForCollection()
// saveTabsSelectedForCollection()
// verifyNameCollectionView()
// verifyDefaultCollectionName("Collection 1")
// typeCollectionName(firstCollectionName)
// verifySnackBarText("Tabs saved!")
//// verifyExistingOpenTabs(firstWebPage.title)
//// verifyExistingOpenTabs(secondWebPage.title)
// }
// }
//
// @Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
// @Test
// // open a webpage, and add currently opened tab to existing collection
// fun addTabToExistingCollectionTest() {
// val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
// val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
//
// createCollection(firstCollectionName)
//
// homeScreen {
//// verifyExistingTabList()
// closeTab()
// }.openNavigationToolbar {
// }.enterURLAndEnterToBrowser(secondWebPage.url) {
// verifyPageContent(secondWebPage.content)
// }.openThreeDotMenu {
// clickBrowserViewSaveCollectionButton()
// }.selectExistingCollection(firstCollectionName) {
// verifySnackBarText("Tab saved!")
// }.openHomeScreen {
//// verifyExistingTabList()
// expandCollection(firstCollectionName)
// verifyItemInCollectionExists(firstWebPage.title)
// verifyItemInCollectionExists(secondWebPage.title)
// }
// }
//
// @Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
// @Test
// fun collectionMenuAddTabButtonTest() {
// val secondWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 2)
//
// createCollection(firstCollectionName)
//
// homeScreen {
// closeTab()
// }.openNavigationToolbar {
// }.enterURLAndEnterToBrowser(secondWebPage.url) {
// }.openHomeScreen {
// expandCollection(firstCollectionName)
// clickCollectionThreeDotButton()
// selectAddTabToCollection()
// verifyTabsSelectedCounterText(1)
// saveTabsSelectedForCollection()
// verifySnackBarText("Tab saved!")
// verifyItemInCollectionExists(secondWebPage.title)
// }
// }
//
// @Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
// @Test
// fun collectionMenuOpenAllTabsTest() {
// val firstWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)
//
// createCollection(firstCollectionName)
//
// homeScreen {
// closeTab()
// expandCollection(firstCollectionName)
// clickCollectionThreeDotButton()
// selectOpenTabs()
// }.openTabDrawer {
// verifyExistingOpenTabs(firstWebPage.title)
// }
// }
//
// @Ignore("Intermittent failures, see: https://github.com/mozilla-mobile/fenix/issues/10587")
// @Test
// fun renameCollectionTest() {
// createCollection(firstCollectionName)
//
// homeScreen {