1
0
Fork 0

For 11468 - Show tab tray after opening links from history and bookmarks

master
David Walsh 2020-06-11 19:06:19 -05:00 committed by Jeff Boek
parent 2ac8496315
commit c4a4beb6b9
6 changed files with 40 additions and 20 deletions

View File

@ -340,7 +340,7 @@ class BookmarksTest {
} }
multipleSelectionToolbar { multipleSelectionToolbar {
}.clickOpenNewTab { }.openTabDrawer { }.clickOpenNewTab {
verifyNormalModeSelected() verifyNormalModeSelected()
verifyExistingTabList() verifyExistingTabList()
} }
@ -363,7 +363,7 @@ class BookmarksTest {
} }
multipleSelectionToolbar { multipleSelectionToolbar {
}.clickOpenPrivateTab { }.openTabDrawer { }.clickOpenPrivateTab {
verifyPrivateModeSelected() verifyPrivateModeSelected()
verifyExistingTabList() verifyExistingTabList()
} }

View File

@ -216,7 +216,7 @@ class HistoryTest {
} }
multipleSelectionToolbar { multipleSelectionToolbar {
}.clickOpenNewTab { }.openTabDrawer { }.clickOpenNewTab {
verifyExistingTabList() verifyExistingTabList()
verifyNormalModeSelected() verifyNormalModeSelected()
} }
@ -236,7 +236,7 @@ class HistoryTest {
} }
multipleSelectionToolbar { multipleSelectionToolbar {
}.clickOpenPrivateTab { }.openTabDrawer { }.clickOpenPrivateTab {
verifyPrivateModeSelected() verifyPrivateModeSelected()
verifyExistingTabList() verifyExistingTabList()
} }

View File

@ -85,23 +85,26 @@ class LibrarySubMenusMultipleSelectionToolbarRobot {
return BookmarksRobot.Transition() return BookmarksRobot.Transition()
} }
fun clickOpenNewTab(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { fun clickOpenNewTab(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
openInNewTabButton().click() openInNewTabButton().click()
mDevice.waitNotNull(Until.findObject(By.text("Collections")), waitingTime)
HomeScreenRobot().interact()
return HomeScreenRobot.Transition()
}
fun clickOpenPrivateTab(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
openInPrivateTabButton().click()
mDevice.waitNotNull( mDevice.waitNotNull(
Until.findObject(By.text(PRIVATE_SESSION_MESSAGE)), Until.findObject(By.res("org.mozilla.fenix.debug:id/tab_layout")),
waitingTime waitingTime
) )
HomeScreenRobot().interact() TabDrawerRobot().interact()
return HomeScreenRobot.Transition() return TabDrawerRobot.Transition()
}
fun clickOpenPrivateTab(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
openInPrivateTabButton().click()
mDevice.waitNotNull(
Until.findObject(By.res("org.mozilla.fenix.debug:id/tab_layout")),
waitingTime
)
TabDrawerRobot().interact()
return TabDrawerRobot.Transition()
} }
} }
} }

View File

@ -26,6 +26,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By import androidx.test.uiautomator.By
import androidx.test.uiautomator.By.text import androidx.test.uiautomator.By.text
import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import androidx.test.uiautomator.Until.findObject import androidx.test.uiautomator.Until.findObject
import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.allOf
import org.mozilla.fenix.R import org.mozilla.fenix.R
@ -104,6 +105,20 @@ class TabDrawerRobot {
return ThreeDotMenuMainRobot.Transition() return ThreeDotMenuMainRobot.Transition()
} }
fun openTabDrawer(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
org.mozilla.fenix.ui.robots.mDevice.waitForIdle()
tabsCounter().click()
org.mozilla.fenix.ui.robots.mDevice.waitNotNull(
Until.findObject(By.res("org.mozilla.fenix.debug:id/tab_layout")),
waitingTime
)
TabDrawerRobot().interact()
return TabDrawerRobot.Transition()
}
fun openHomeScreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition { fun openHomeScreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
mDevice.waitForIdle() mDevice.waitForIdle()
@ -196,3 +211,5 @@ private fun tab(title: String) =
withText(title) withText(title)
) )
) )
private fun tabsCounter() = onView(withId(R.id.tab_button))

View File

@ -204,14 +204,14 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
R.id.open_bookmarks_in_new_tabs_multi_select -> { R.id.open_bookmarks_in_new_tabs_multi_select -> {
openItemsInNewTab { node -> node.url } openItemsInNewTab { node -> node.url }
navigate(BookmarkFragmentDirections.actionGlobalHome()) navigate(BookmarkFragmentDirections.actionGlobalTabTrayDialogFragment())
metrics?.track(Event.OpenedBookmarksInNewTabs) metrics?.track(Event.OpenedBookmarksInNewTabs)
true true
} }
R.id.open_bookmarks_in_private_tabs_multi_select -> { R.id.open_bookmarks_in_private_tabs_multi_select -> {
openItemsInNewTab(private = true) { node -> node.url } openItemsInNewTab(private = true) { node -> node.url }
navigate(BookmarkFragmentDirections.actionGlobalHome()) navigate(BookmarkFragmentDirections.actionGlobalTabTrayDialogFragment())
metrics?.track(Event.OpenedBookmarksInPrivateTabs) metrics?.track(Event.OpenedBookmarksInPrivateTabs)
true true
} }

View File

@ -183,7 +183,7 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
nav( nav(
R.id.historyFragment, R.id.historyFragment,
HistoryFragmentDirections.actionGlobalHome() HistoryFragmentDirections.actionGlobalTabTrayDialogFragment()
) )
true true
} }
@ -199,7 +199,7 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
} }
nav( nav(
R.id.historyFragment, R.id.historyFragment,
HistoryFragmentDirections.actionGlobalHome() HistoryFragmentDirections.actionGlobalTabTrayDialogFragment()
) )
true true
} }