|
|
|
@ -14,7 +14,6 @@ import androidx.test.espresso.NoMatchingViewException
|
|
|
|
|
import androidx.test.espresso.ViewInteraction
|
|
|
|
|
import androidx.test.espresso.action.ViewActions
|
|
|
|
|
import androidx.test.espresso.action.ViewActions.click
|
|
|
|
|
import androidx.test.espresso.action.ViewActions.longClick
|
|
|
|
|
import androidx.test.espresso.action.ViewActions.swipeLeft
|
|
|
|
|
import androidx.test.espresso.action.ViewActions.swipeRight
|
|
|
|
|
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
|
|
|
|
@ -74,7 +73,6 @@ class HomeScreenRobot {
|
|
|
|
|
fun verifyHomeMenu() = assertHomeMenu()
|
|
|
|
|
fun verifyTabButton() = assertTabButton()
|
|
|
|
|
fun verifyCollectionsHeader() = assertCollectionsHeader()
|
|
|
|
|
fun verifyNoCollectionsHeader() = assertNoCollectionsHeader()
|
|
|
|
|
fun verifyNoCollectionsText() = assertNoCollectionsText()
|
|
|
|
|
fun verifyHomeWordmark() = assertHomeWordmark()
|
|
|
|
|
fun verifyHomeToolbar() = assertHomeToolbar()
|
|
|
|
@ -152,25 +150,18 @@ class HomeScreenRobot {
|
|
|
|
|
|
|
|
|
|
fun confirmDeleteCollection() {
|
|
|
|
|
onView(allOf(withText("DELETE"))).click()
|
|
|
|
|
mDevice.waitNotNull(findObject(By.res("org.mozilla.fenix.debug:id/collections_header")), waitingTime)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun typeCollectionName(name: String) {
|
|
|
|
|
mDevice.wait(findObject(By.res("org.mozilla.fenix.debug:id/name_collection_edittext")), waitingTime)
|
|
|
|
|
collectionNameTextField().perform(ViewActions.replaceText(name))
|
|
|
|
|
collectionNameTextField().perform(ViewActions.pressImeActionButton())
|
|
|
|
|
mDevice.waitNotNull(Until.gone(text("Name collection")))
|
|
|
|
|
mDevice.waitNotNull(
|
|
|
|
|
findObject(By.res("org.mozilla.fenix.debug:id/no_collections_header")),
|
|
|
|
|
waitingTime
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun saveTabsSelectedForCollection() = onView(withId(R.id.save_button)).click()
|
|
|
|
|
|
|
|
|
|
fun verifyCollectionIsDisplayed(title: String) {
|
|
|
|
|
mDevice.wait(findObject(text(title)), waitingTime)
|
|
|
|
|
mDevice.findObject(UiSelector().text(title)).waitForExists(waitingTime)
|
|
|
|
|
collectionTitle(title).check(matches(isDisplayed()))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyCollectionIcon() =
|
|
|
|
|
onView(withId(R.id.collection_icon)).check(matches(isDisplayed()))
|
|
|
|
|
fun verifyCollectionIcon() = onView(withId(R.id.collection_icon)).check(matches(isDisplayed()))
|
|
|
|
|
|
|
|
|
|
fun expandCollection(title: String) {
|
|
|
|
|
try {
|
|
|
|
@ -190,9 +181,7 @@ class HomeScreenRobot {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun clickSaveCollectionButton() = saveCollectionButton().click()
|
|
|
|
|
|
|
|
|
|
fun verifyItemInCollectionExists(title: String, visible: Boolean = true) {
|
|
|
|
|
fun verifyTabSavedInCollection(title: String, visible: Boolean = true) {
|
|
|
|
|
try {
|
|
|
|
|
collectionItem(title)
|
|
|
|
|
.check(
|
|
|
|
@ -203,11 +192,11 @@ class HomeScreenRobot {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyCollectionItemLogo() =
|
|
|
|
|
onView(withId(R.id.list_item_favicon)).check(matches(isDisplayed()))
|
|
|
|
|
fun verifyCollectionTabLogo() =
|
|
|
|
|
onView(withId(R.id.favicon)).check(matches(isDisplayed()))
|
|
|
|
|
|
|
|
|
|
fun verifyCollectionItemUrl() =
|
|
|
|
|
onView(withId(R.id.list_item_url)).check(matches(isDisplayed()))
|
|
|
|
|
fun verifyCollectionTabUrl() =
|
|
|
|
|
onView(withId(R.id.caption)).check(matches(isDisplayed()))
|
|
|
|
|
|
|
|
|
|
fun verifyShareCollectionButtonIsVisible(visible: Boolean) {
|
|
|
|
|
shareCollectionButton()
|
|
|
|
@ -233,54 +222,6 @@ class HomeScreenRobot {
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifySelectTabsView(vararg tabTitles: String) {
|
|
|
|
|
onView(allOf(withId(R.id.back_button), withText("Select Tabs")))
|
|
|
|
|
.check(matches(isDisplayed()))
|
|
|
|
|
|
|
|
|
|
for (title in tabTitles)
|
|
|
|
|
onView(withId(R.id.tab_list)).check(matches(hasItem(withText(title))))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyTabsSelectedCounterText(tabsSelected: Int) {
|
|
|
|
|
when (tabsSelected) {
|
|
|
|
|
0 -> onView(withId(R.id.bottom_bar_text)).check(matches(withText("Select tabs to save")))
|
|
|
|
|
1 -> onView(withId(R.id.bottom_bar_text)).check(matches(withText("1 tab selected")))
|
|
|
|
|
else -> onView(withId(R.id.bottom_bar_text)).check(matches(withText("$tabsSelected tabs selected")))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun selectAllTabsForCollection() {
|
|
|
|
|
onView(withId(R.id.select_all_button))
|
|
|
|
|
.check(matches(withText("Select All")))
|
|
|
|
|
.click()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun deselectAllTabsForCollection() {
|
|
|
|
|
onView(withId(R.id.select_all_button))
|
|
|
|
|
.check(matches(withText("Deselect All")))
|
|
|
|
|
.click()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun selectTabForCollection(title: String) {
|
|
|
|
|
tab(title).click()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun clickAddNewCollection() =
|
|
|
|
|
onView(allOf(withText("Add new collection"))).click()
|
|
|
|
|
|
|
|
|
|
fun verifyNameCollectionView() {
|
|
|
|
|
onView(allOf(withId(R.id.back_button), withText("Name collection")))
|
|
|
|
|
.check(matches(isDisplayed()))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyDefaultCollectionName(name: String) =
|
|
|
|
|
onView(withId(R.id.name_collection_edittext)).check(matches(withText(name)))
|
|
|
|
|
|
|
|
|
|
fun verifySelectCollectionView() {
|
|
|
|
|
onView(allOf(withId(R.id.back_button), withText("Select collection")))
|
|
|
|
|
.check(matches(isDisplayed()))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyShareTabsOverlay() = assertShareTabsOverlay()
|
|
|
|
|
|
|
|
|
|
fun clickShareCollectionButton() = onView(withId(R.id.collection_share_button)).click()
|
|
|
|
@ -303,22 +244,12 @@ class HomeScreenRobot {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun longTapSelectTab(title: String) {
|
|
|
|
|
tab(title).perform(longClick())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun goBackCollectionFlow() = collectionFlowBackButton().click()
|
|
|
|
|
|
|
|
|
|
fun scrollToElementByText(text: String): UiScrollable {
|
|
|
|
|
val appView = UiScrollable(UiSelector().scrollable(true))
|
|
|
|
|
appView.scrollTextIntoView(text)
|
|
|
|
|
return appView
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun closeTab() {
|
|
|
|
|
closeTabButton().click()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun togglePrivateBrowsingModeOnOff() {
|
|
|
|
|
onView(ViewMatchers.withResourceName("privateBrowsingButton"))
|
|
|
|
|
.perform(click())
|
|
|
|
@ -501,12 +432,11 @@ class HomeScreenRobot {
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openTab(title: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
|
|
|
|
mDevice.waitNotNull(findObject(text(title)))
|
|
|
|
|
tab(title).click()
|
|
|
|
|
fun clickSaveTabsToCollectionButton(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
|
|
|
|
|
saveTabsToCollectionButton().click()
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
TabDrawerRobot().interact()
|
|
|
|
|
return TabDrawerRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -564,17 +494,14 @@ private fun assertCollectionsHeader() =
|
|
|
|
|
onView(allOf(withText("Collections")))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertNoCollectionsHeader() =
|
|
|
|
|
onView(allOf(withText("Collect the things that matter to you")))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertNoCollectionsText() =
|
|
|
|
|
onView(
|
|
|
|
|
allOf(
|
|
|
|
|
withText("Group together similar searches, sites, and tabs for quick access later.")
|
|
|
|
|
withText(
|
|
|
|
|
containsString("Collect the things that matter to you.\n" +
|
|
|
|
|
"Group together similar searches, sites, and tabs for quick access later."
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
).check(matches(isDisplayed()))
|
|
|
|
|
|
|
|
|
|
private fun assertHomeComponent() =
|
|
|
|
|
onView(ViewMatchers.withResourceName("sessionControlRecyclerView"))
|
|
|
|
@ -752,9 +679,6 @@ private fun assertPrivateSessionMessage() =
|
|
|
|
|
private fun collectionThreeDotButton() =
|
|
|
|
|
onView(allOf(withId(R.id.collection_overflow_button)))
|
|
|
|
|
|
|
|
|
|
private fun collectionNameTextField() =
|
|
|
|
|
onView(allOf(ViewMatchers.withResourceName("name_collection_edittext")))
|
|
|
|
|
|
|
|
|
|
private fun collectionTitle(title: String) =
|
|
|
|
|
onView(allOf(withId(R.id.collection_title), withText(title)))
|
|
|
|
|
|
|
|
|
@ -794,21 +718,20 @@ private fun assertShareTabsOverlay() {
|
|
|
|
|
private fun tabMediaControlButton() = onView(withId(R.id.play_pause_button))
|
|
|
|
|
|
|
|
|
|
private fun collectionItem(title: String) =
|
|
|
|
|
onView(allOf(withId(R.id.list_element_title), withText(title)))
|
|
|
|
|
onView(allOf(withId(R.id.label), withText(title)))
|
|
|
|
|
|
|
|
|
|
private fun saveCollectionButton() = onView(withId(R.id.save_tab_group_button))
|
|
|
|
|
private fun saveTabsToCollectionButton() = onView(withId(R.id.add_tabs_to_collections_button))
|
|
|
|
|
|
|
|
|
|
private fun shareCollectionButton() = onView(withId(R.id.collection_share_button))
|
|
|
|
|
|
|
|
|
|
private fun removeTabFromCollectionButton(title: String) =
|
|
|
|
|
onView(
|
|
|
|
|
allOf(
|
|
|
|
|
withId(R.id.list_item_action_button),
|
|
|
|
|
withId(R.id.secondary_button),
|
|
|
|
|
hasSibling(withText(title))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
private fun collectionFlowBackButton() = onView(withId(R.id.back_button))
|
|
|
|
|
private fun tabsCounter() = onView(withId(R.id.tab_button))
|
|
|
|
|
|
|
|
|
|
private fun tab(title: String) =
|
|
|
|
|