2019-04-10 18:59:38 +02:00
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
|
|
@file:Suppress("TooManyFunctions")
|
|
|
|
|
|
|
|
|
|
package org.mozilla.fenix.ui.robots
|
|
|
|
|
|
2020-02-06 21:58:47 +01:00
|
|
|
|
import android.graphics.Bitmap
|
2020-03-31 20:11:41 +02:00
|
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
2019-04-10 18:59:38 +02:00
|
|
|
|
import androidx.test.espresso.Espresso.onView
|
2020-05-12 09:51:44 +02:00
|
|
|
|
import androidx.test.espresso.NoMatchingViewException
|
2019-10-28 20:10:19 +01:00
|
|
|
|
import androidx.test.espresso.action.ViewActions
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import androidx.test.espresso.action.ViewActions.click
|
2020-05-12 09:51:44 +02:00
|
|
|
|
import androidx.test.espresso.action.ViewActions.longClick
|
|
|
|
|
import androidx.test.espresso.action.ViewActions.swipeLeft
|
|
|
|
|
import androidx.test.espresso.action.ViewActions.swipeRight
|
2019-08-20 22:10:08 +02:00
|
|
|
|
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
|
2019-04-10 18:59:38 +02:00
|
|
|
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
2020-02-06 22:06:28 +01:00
|
|
|
|
import androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem
|
2019-04-10 18:59:38 +02:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers
|
2020-02-06 21:58:47 +01:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.Visibility
|
2020-02-06 22:06:28 +01:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
2020-05-12 09:51:44 +02:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.hasSibling
|
2019-08-27 19:56:12 +02:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
2020-01-30 22:15:40 +01:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
2020-03-31 20:11:41 +02:00
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import androidx.test.platform.app.InstrumentationRegistry
|
2019-10-28 20:10:19 +01:00
|
|
|
|
import androidx.test.uiautomator.By
|
2020-03-31 20:11:41 +02:00
|
|
|
|
import androidx.test.uiautomator.By.text
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import androidx.test.uiautomator.UiDevice
|
2019-07-13 01:19:08 +02:00
|
|
|
|
import androidx.test.uiautomator.UiScrollable
|
|
|
|
|
import androidx.test.uiautomator.UiSelector
|
2020-01-30 22:15:40 +01:00
|
|
|
|
import androidx.test.uiautomator.Until
|
2020-03-31 20:11:41 +02:00
|
|
|
|
import androidx.test.uiautomator.Until.findObject
|
2020-02-06 22:06:28 +01:00
|
|
|
|
import org.hamcrest.CoreMatchers.allOf
|
2020-03-31 20:11:41 +02:00
|
|
|
|
import org.hamcrest.CoreMatchers.containsString
|
2020-02-06 22:06:28 +01:00
|
|
|
|
import org.hamcrest.CoreMatchers.not
|
2019-05-16 02:32:25 +02:00
|
|
|
|
import org.mozilla.fenix.R
|
2020-03-31 20:11:41 +02:00
|
|
|
|
import org.mozilla.fenix.components.Search
|
2020-01-30 22:15:40 +01:00
|
|
|
|
import org.mozilla.fenix.helpers.TestAssetHelper
|
2019-10-28 20:10:19 +01:00
|
|
|
|
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
2020-01-30 22:15:40 +01:00
|
|
|
|
import org.mozilla.fenix.helpers.click
|
2019-12-10 12:05:47 +01:00
|
|
|
|
import org.mozilla.fenix.helpers.ext.waitNotNull
|
2020-02-06 22:06:28 +01:00
|
|
|
|
import org.mozilla.fenix.helpers.matchers.hasItem
|
2020-03-31 20:11:41 +02:00
|
|
|
|
import org.mozilla.fenix.helpers.withBitmapDrawable
|
2019-04-10 18:59:38 +02:00
|
|
|
|
|
2019-05-16 02:32:25 +02:00
|
|
|
|
/**
|
|
|
|
|
* Implementation of Robot Pattern for the home screen menu.
|
|
|
|
|
*/
|
2019-04-10 18:59:38 +02:00
|
|
|
|
class HomeScreenRobot {
|
2019-07-05 19:38:09 +02:00
|
|
|
|
fun verifyNavigationToolbar() = assertNavigationToolbar()
|
2019-05-16 02:32:25 +02:00
|
|
|
|
fun verifyHomeScreen() = assertHomeScreen()
|
|
|
|
|
fun verifyHomePrivateBrowsingButton() = assertHomePrivateBrowsingButton()
|
|
|
|
|
fun verifyHomeMenu() = assertHomeMenu()
|
2020-06-05 19:59:08 +02:00
|
|
|
|
fun verifyTabButton() = assertTabButton()
|
2019-07-05 19:38:09 +02:00
|
|
|
|
fun verifyCollectionsHeader() = assertCollectionsHeader()
|
|
|
|
|
fun verifyNoCollectionsHeader() = assertNoCollectionsHeader()
|
|
|
|
|
fun verifyNoCollectionsText() = assertNoCollectionsText()
|
2019-05-16 02:32:25 +02:00
|
|
|
|
fun verifyHomeWordmark() = assertHomeWordmark()
|
|
|
|
|
fun verifyHomeToolbar() = assertHomeToolbar()
|
|
|
|
|
fun verifyHomeComponent() = assertHomeComponent()
|
2020-02-06 21:58:47 +01:00
|
|
|
|
fun verifyDefaultSearchEngine(searchEngine: String) = verifySearchEngineIcon(searchEngine)
|
2020-07-21 14:49:24 +02:00
|
|
|
|
fun verifyNoTabsOpened() = assertNoTabsOpened()
|
2019-05-16 02:32:25 +02:00
|
|
|
|
|
2019-07-09 23:52:15 +02:00
|
|
|
|
// First Run elements
|
|
|
|
|
fun verifyWelcomeHeader() = assertWelcomeHeader()
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-07-09 23:52:15 +02:00
|
|
|
|
fun verifyGetTheMostHeader() = assertGetTheMostHeader()
|
|
|
|
|
fun verifyAccountsSignInButton() = assertAccountsSignInButton()
|
|
|
|
|
fun verifyGetToKnowHeader() = assertGetToKnowHeader()
|
|
|
|
|
fun verifyChooseThemeHeader() = assertChooseThemeHeader()
|
|
|
|
|
fun verifyChooseThemeText() = assertChooseThemeText()
|
|
|
|
|
fun verifyLightThemeToggle() = assertLightThemeToggle()
|
|
|
|
|
fun verifyLightThemeDescription() = assertLightThemeDescription()
|
|
|
|
|
fun verifyDarkThemeToggle() = assertDarkThemeToggle()
|
|
|
|
|
fun verifyDarkThemeDescription() = assertDarkThemeDescription()
|
|
|
|
|
fun verifyAutomaticThemeToggle() = assertAutomaticThemeToggle()
|
|
|
|
|
fun verifyAutomaticThemeDescription() = assertAutomaticThemeDescription()
|
2020-06-05 09:02:21 +02:00
|
|
|
|
fun verifyAutomaticPrivacyfHeader() = assertAutomaticPrivacyHeader()
|
2019-07-09 23:52:15 +02:00
|
|
|
|
fun verifyTrackingProtectionToggle() = assertTrackingProtectionToggle()
|
2020-06-05 09:02:21 +02:00
|
|
|
|
fun verifyAutomaticPrivacyText() = assertAutomaticPrivacyText()
|
2019-07-09 23:52:15 +02:00
|
|
|
|
|
2020-03-13 16:16:47 +01:00
|
|
|
|
// What's new elements
|
|
|
|
|
fun verifyWhatsNewHeader() = assertWhatsNewHeather()
|
|
|
|
|
fun verifyWhatsNewLink() = assertWhatsNewLink()
|
|
|
|
|
|
|
|
|
|
// Browse privately
|
2019-07-09 23:52:15 +02:00
|
|
|
|
fun verifyBrowsePrivatelyHeader() = assertBrowsePrivatelyHeader()
|
|
|
|
|
fun verifyBrowsePrivatelyText() = assertBrowsePrivatelyText()
|
2020-03-13 16:16:47 +01:00
|
|
|
|
|
|
|
|
|
// Take a position
|
|
|
|
|
fun verifyTakePositionHeader() = assertTakePositionheader()
|
|
|
|
|
fun verifyTakePositionElements() {
|
|
|
|
|
assertTakePositionBottomRadioButton()
|
|
|
|
|
assertTakePositionTopRadioButton()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Your privacy
|
2019-07-09 23:52:15 +02:00
|
|
|
|
fun verifyYourPrivacyHeader() = assertYourPrivacyHeader()
|
|
|
|
|
fun verifyYourPrivacyText() = assertYourPrivacyText()
|
|
|
|
|
fun verifyPrivacyNoticeButton() = assertPrivacyNoticeButton()
|
|
|
|
|
fun verifyStartBrowsingButton() = assertStartBrowsingButton()
|
|
|
|
|
|
2020-06-05 19:59:08 +02:00
|
|
|
|
fun verifyPrivateSessionMessage() = assertPrivateSessionMessage()
|
2019-08-27 19:56:12 +02:00
|
|
|
|
|
2020-02-06 22:06:28 +01:00
|
|
|
|
fun verifyExistingTopSitesList() = assertExistingTopSitesList()
|
|
|
|
|
fun verifyNotExistingTopSitesList(title: String) = assertNotExistingTopSitesList(title)
|
|
|
|
|
fun verifyExistingTopSitesTabs(title: String) = assertExistingTopSitesTabs(title)
|
|
|
|
|
fun verifyTopSiteContextMenuItems() = assertTopSiteContextMenuItems()
|
|
|
|
|
|
2019-10-28 20:10:19 +01:00
|
|
|
|
// Collections element
|
|
|
|
|
fun clickCollectionThreeDotButton() {
|
|
|
|
|
collectionThreeDotButton().click()
|
2020-05-12 09:51:44 +02:00
|
|
|
|
mDevice.waitNotNull(findObject(text("Delete collection")), waitingTime)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun selectOpenTabs() {
|
|
|
|
|
onView(allOf(withText("Open tabs"))).click()
|
2019-10-28 20:10:19 +01:00
|
|
|
|
}
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
2019-10-28 20:10:19 +01:00
|
|
|
|
fun selectRenameCollection() {
|
2020-05-12 09:51:44 +02:00
|
|
|
|
onView(allOf(withText("Rename collection"))).click()
|
|
|
|
|
mDevice.waitNotNull(findObject(text("Rename collection")))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun selectAddTabToCollection() {
|
|
|
|
|
onView(allOf(withText("Add tab"))).click()
|
|
|
|
|
mDevice.waitNotNull(findObject(text("Select Tabs")))
|
2019-10-28 20:10:19 +01:00
|
|
|
|
}
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
2019-10-28 20:10:19 +01:00
|
|
|
|
fun selectDeleteCollection() {
|
2020-05-12 09:51:44 +02:00
|
|
|
|
onView(allOf(withText("Delete collection"))).click()
|
|
|
|
|
mDevice.waitNotNull(findObject(By.res("android:id/message")), waitingTime)
|
2019-10-28 20:10:19 +01:00
|
|
|
|
}
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
2019-10-28 20:10:19 +01:00
|
|
|
|
fun confirmDeleteCollection() {
|
2020-05-12 09:51:44 +02:00
|
|
|
|
onView(allOf(withText("DELETE"))).click()
|
|
|
|
|
mDevice.waitNotNull(findObject(By.res("org.mozilla.fenix.debug:id/collections_header")), waitingTime)
|
2019-10-28 20:10:19 +01:00
|
|
|
|
}
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
2019-10-28 20:10:19 +01:00
|
|
|
|
fun typeCollectionName(name: String) {
|
2020-05-12 09:51:44 +02:00
|
|
|
|
mDevice.wait(findObject(By.res("org.mozilla.fenix.debug:id/name_collection_edittext")), waitingTime)
|
2019-10-28 20:10:19 +01:00
|
|
|
|
collectionNameTextField().perform(ViewActions.replaceText(name))
|
|
|
|
|
collectionNameTextField().perform(ViewActions.pressImeActionButton())
|
2020-05-12 09:51:44 +02:00
|
|
|
|
mDevice.waitNotNull(Until.gone(text("Name collection")))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun saveTabsSelectedForCollection() = onView(withId(R.id.save_button)).click()
|
|
|
|
|
|
|
|
|
|
fun verifyCollectionIsDisplayed(title: String) {
|
|
|
|
|
mDevice.wait(findObject(text(title)), waitingTime)
|
|
|
|
|
collectionTitle(title).check(matches(isDisplayed()))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyCollectionIcon() =
|
|
|
|
|
onView(withId(R.id.collection_icon)).check(matches(isDisplayed()))
|
|
|
|
|
|
|
|
|
|
fun expandCollection(title: String) {
|
|
|
|
|
try {
|
|
|
|
|
mDevice.waitNotNull(findObject(text(title)), waitingTime)
|
|
|
|
|
collectionTitle(title).click()
|
|
|
|
|
} catch (e: NoMatchingViewException) {
|
|
|
|
|
scrollToElementByText(title)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun collapseCollection(title: String) {
|
|
|
|
|
try {
|
|
|
|
|
mDevice.waitNotNull(findObject(text(title)), waitingTime)
|
|
|
|
|
onView(allOf(withId(R.id.chevron), hasSibling(withText(title)))).click()
|
|
|
|
|
} catch (e: NoMatchingViewException) {
|
|
|
|
|
scrollToElementByText(title)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun clickSaveCollectionButton() = saveCollectionButton().click()
|
|
|
|
|
|
|
|
|
|
fun verifyItemInCollectionExists(title: String, visible: Boolean = true) {
|
|
|
|
|
try {
|
|
|
|
|
collectionItem(title)
|
|
|
|
|
.check(
|
|
|
|
|
if (visible) matches(isDisplayed()) else doesNotExist()
|
|
|
|
|
)
|
|
|
|
|
} catch (e: NoMatchingViewException) {
|
|
|
|
|
scrollToElementByText(title)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyCollectionItemLogo() =
|
|
|
|
|
onView(withId(R.id.list_item_favicon)).check(matches(isDisplayed()))
|
|
|
|
|
|
|
|
|
|
fun verifyCollectionItemUrl() =
|
|
|
|
|
onView(withId(R.id.list_item_url)).check(matches(isDisplayed()))
|
|
|
|
|
|
|
|
|
|
fun verifyShareCollectionButtonIsVisible(visible: Boolean) {
|
|
|
|
|
shareCollectionButton()
|
|
|
|
|
.check(
|
|
|
|
|
if (visible) matches(withEffectiveVisibility(Visibility.VISIBLE))
|
|
|
|
|
else matches(withEffectiveVisibility(Visibility.GONE))
|
|
|
|
|
)
|
2019-10-28 20:10:19 +01:00
|
|
|
|
}
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
2020-05-12 09:51:44 +02:00
|
|
|
|
fun verifyCollectionMenuIsVisible(visible: Boolean) {
|
|
|
|
|
collectionThreeDotButton()
|
|
|
|
|
.check(
|
|
|
|
|
if (visible) matches(withEffectiveVisibility(Visibility.VISIBLE))
|
|
|
|
|
else matches(withEffectiveVisibility(Visibility.GONE))
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun verifyCollectionItemRemoveButtonIsVisible(title: String, visible: Boolean) {
|
|
|
|
|
removeTabFromCollectionButton(title)
|
|
|
|
|
.check(
|
|
|
|
|
if (visible) matches(withEffectiveVisibility(Visibility.VISIBLE))
|
|
|
|
|
else doesNotExist()
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
|
|
|
|
|
fun removeTabFromCollection(title: String) = removeTabFromCollectionButton(title).click()
|
|
|
|
|
|
|
|
|
|
fun swipeCollectionItemRight(title: String) {
|
|
|
|
|
try {
|
|
|
|
|
collectionItem(title).perform(swipeRight())
|
|
|
|
|
} catch (e: NoMatchingViewException) {
|
|
|
|
|
scrollToElementByText(title)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun swipeCollectionItemLeft(title: String) {
|
|
|
|
|
try {
|
|
|
|
|
collectionItem(title).perform(swipeLeft())
|
|
|
|
|
} catch (e: NoMatchingViewException) {
|
|
|
|
|
scrollToElementByText(title)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun longTapSelectTab(title: String) {
|
|
|
|
|
tab(title).perform(longClick())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun goBackCollectionFlow() = collectionFlowBackButton().click()
|
|
|
|
|
|
2019-10-28 20:10:19 +01:00
|
|
|
|
fun scrollToElementByText(text: String): UiScrollable {
|
2019-07-13 01:19:08 +02:00
|
|
|
|
val appView = UiScrollable(UiSelector().scrollable(true))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
appView.scrollTextIntoView(text)
|
2019-07-13 01:19:08 +02:00
|
|
|
|
return appView
|
|
|
|
|
}
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
2019-10-29 10:36:19 +01:00
|
|
|
|
fun closeTab() {
|
|
|
|
|
closeTabButton().click()
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-10 12:05:47 +01:00
|
|
|
|
fun togglePrivateBrowsingModeOnOff() {
|
|
|
|
|
onView(ViewMatchers.withResourceName("privateBrowsingButton"))
|
2020-01-30 22:15:40 +01:00
|
|
|
|
.perform(click())
|
2019-12-10 12:05:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-13 16:16:47 +01:00
|
|
|
|
fun swipeToBottom() = onView(withId(R.id.homeLayout)).perform(ViewActions.swipeUp())
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
2020-03-31 20:11:41 +02:00
|
|
|
|
fun swipeToTop() =
|
|
|
|
|
onView(withId(R.id.sessionControlRecyclerView)).perform(ViewActions.swipeDown())
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
|
|
|
|
fun swipeTabRight(title: String) =
|
2020-05-12 09:51:44 +02:00
|
|
|
|
tab(title).perform(ViewActions.swipeRight())
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
|
|
|
|
fun swipeTabLeft(title: String) =
|
2020-05-12 09:51:44 +02:00
|
|
|
|
tab(title).perform(ViewActions.swipeLeft())
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
|
|
|
|
fun verifySnackBarText(expectedText: String) {
|
|
|
|
|
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
2020-05-12 09:51:44 +02:00
|
|
|
|
mDevice.waitNotNull(findObject(By.text(expectedText)), TestAssetHelper.waitingTime)
|
2020-01-30 22:15:40 +01:00
|
|
|
|
}
|
2019-12-10 12:05:47 +01:00
|
|
|
|
|
2020-01-30 22:15:40 +01:00
|
|
|
|
fun snackBarButtonClick(expectedText: String) {
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withId(R.id.snackbar_btn), withText(expectedText))).check(
|
2020-03-31 20:11:41 +02:00
|
|
|
|
matches(withEffectiveVisibility(Visibility.VISIBLE))
|
|
|
|
|
).perform(click())
|
2020-01-30 22:15:40 +01:00
|
|
|
|
}
|
2019-12-10 12:05:47 +01:00
|
|
|
|
|
2020-03-31 20:11:41 +02:00
|
|
|
|
fun verifyTabMediaControlButtonState(action: String) {
|
|
|
|
|
mDevice.waitNotNull(
|
2020-04-13 12:17:35 +02:00
|
|
|
|
findObject(
|
|
|
|
|
By
|
|
|
|
|
.res("org.mozilla.fenix.debug:id/play_pause_button")
|
|
|
|
|
.desc(action)
|
|
|
|
|
),
|
2020-03-31 20:11:41 +02:00
|
|
|
|
waitingTime
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
tabMediaControlButton().check(matches(withContentDescription(action)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun clickTabMediaControlButton() = tabMediaControlButton().click()
|
|
|
|
|
|
2019-07-13 01:19:08 +02:00
|
|
|
|
class Transition {
|
2019-05-16 02:32:25 +02:00
|
|
|
|
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
|
|
|
|
|
2020-06-05 19:59:08 +02:00
|
|
|
|
fun openTabDrawer(interact: TabDrawerRobot.() -> Unit): TabDrawerRobot.Transition {
|
|
|
|
|
mDevice.waitForIdle()
|
|
|
|
|
|
|
|
|
|
tabsCounter().click()
|
|
|
|
|
|
|
|
|
|
mDevice.waitNotNull(
|
|
|
|
|
Until.findObject(By.res("org.mozilla.fenix.debug:id/tab_layout")),
|
|
|
|
|
waitingTime
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
TabDrawerRobot().interact()
|
|
|
|
|
return TabDrawerRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-03 18:30:55 +02:00
|
|
|
|
fun openThreeDotMenu(interact: ThreeDotMenuMainRobot.() -> Unit): ThreeDotMenuMainRobot.Transition {
|
2019-05-16 02:32:25 +02:00
|
|
|
|
threeDotButton().perform(click())
|
|
|
|
|
|
2019-10-03 18:30:55 +02:00
|
|
|
|
ThreeDotMenuMainRobot().interact()
|
|
|
|
|
return ThreeDotMenuMainRobot.Transition()
|
2019-05-16 02:32:25 +02:00
|
|
|
|
}
|
2019-07-05 19:38:09 +02:00
|
|
|
|
|
2019-07-15 23:25:31 +02:00
|
|
|
|
fun openSearch(interact: SearchRobot.() -> Unit): SearchRobot.Transition {
|
|
|
|
|
navigationToolbar().perform(click())
|
|
|
|
|
|
|
|
|
|
SearchRobot().interact()
|
|
|
|
|
return SearchRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-13 01:19:08 +02:00
|
|
|
|
fun dismissOnboarding() {
|
|
|
|
|
openThreeDotMenu { }.openSettings { }.goBack { }
|
2019-07-05 19:38:09 +02:00
|
|
|
|
}
|
2019-08-20 22:10:08 +02:00
|
|
|
|
|
2019-08-27 19:56:12 +02:00
|
|
|
|
fun togglePrivateBrowsingMode() {
|
2019-08-20 22:10:08 +02:00
|
|
|
|
onView(ViewMatchers.withResourceName("privateBrowsingButton"))
|
|
|
|
|
.perform(click())
|
|
|
|
|
}
|
2019-08-27 19:56:12 +02:00
|
|
|
|
|
2019-10-03 18:30:55 +02:00
|
|
|
|
fun openTabsListThreeDotMenu(interact: ThreeDotMenuMainRobot.() -> Unit): ThreeDotMenuMainRobot.Transition {
|
2020-06-05 19:59:08 +02:00
|
|
|
|
// tabsListThreeDotButton().perform(click())
|
2019-08-27 19:56:12 +02:00
|
|
|
|
|
2019-10-03 18:30:55 +02:00
|
|
|
|
ThreeDotMenuMainRobot().interact()
|
|
|
|
|
return ThreeDotMenuMainRobot.Transition()
|
2019-08-27 19:56:12 +02:00
|
|
|
|
}
|
2020-01-30 22:15:40 +01:00
|
|
|
|
|
|
|
|
|
fun closeAllPrivateTabs(interact: HomeScreenRobot.() -> Unit): Transition {
|
|
|
|
|
onView(withId(R.id.close_tabs_button))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
HomeScreenRobot().interact()
|
|
|
|
|
return Transition()
|
|
|
|
|
}
|
2020-02-06 21:58:47 +01:00
|
|
|
|
|
|
|
|
|
fun openNavigationToolbar(interact: NavigationToolbarRobot.() -> Unit): NavigationToolbarRobot.Transition {
|
|
|
|
|
|
|
|
|
|
assertNavigationToolbar().perform(click())
|
|
|
|
|
NavigationToolbarRobot().interact()
|
|
|
|
|
return NavigationToolbarRobot.Transition()
|
|
|
|
|
}
|
2020-02-06 22:06:28 +01:00
|
|
|
|
|
2020-03-31 20:11:41 +02:00
|
|
|
|
fun openContextMenuOnTopSitesWithTitle(
|
|
|
|
|
title: String,
|
|
|
|
|
interact: HomeScreenRobot.() -> Unit
|
|
|
|
|
): Transition {
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(withId(R.id.top_sites_list)).perform(
|
2020-03-31 20:11:41 +02:00
|
|
|
|
actionOnItem<RecyclerView.ViewHolder>(
|
|
|
|
|
hasDescendant(withText(title)),
|
|
|
|
|
ViewActions.longClick()
|
|
|
|
|
)
|
2020-02-06 22:06:28 +01:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
HomeScreenRobot().interact()
|
|
|
|
|
return Transition()
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-31 20:11:41 +02:00
|
|
|
|
fun openTopSiteTabWithTitle(
|
|
|
|
|
title: String,
|
|
|
|
|
interact: BrowserRobot.() -> Unit
|
|
|
|
|
): BrowserRobot.Transition {
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(withId(R.id.top_sites_list)).perform(
|
|
|
|
|
actionOnItem<RecyclerView.ViewHolder>(hasDescendant(withText(title)), click())
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun removeTopSite(interact: HomeScreenRobot.() -> Unit): Transition {
|
|
|
|
|
onView(withText("Remove"))
|
|
|
|
|
.check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
HomeScreenRobot().interact()
|
|
|
|
|
return Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openTopSiteInPrivateTab(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
|
|
|
|
onView(withText("Open in private tab"))
|
|
|
|
|
.check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
2020-03-13 16:16:47 +01:00
|
|
|
|
|
|
|
|
|
fun openCommonMythsLink(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
|
|
|
|
onView(withId(R.id.private_session_common_myths))
|
2020-03-31 20:11:41 +02:00
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun openTab(title: String, interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
|
|
|
|
mDevice.waitNotNull(findObject(text(title)))
|
2020-05-12 09:51:44 +02:00
|
|
|
|
tab(title).click()
|
2020-03-13 16:16:47 +01:00
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
|
}
|
2019-05-16 02:32:25 +02:00
|
|
|
|
}
|
2019-04-10 18:59:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-16 02:32:25 +02:00
|
|
|
|
fun homeScreen(interact: HomeScreenRobot.() -> Unit): HomeScreenRobot.Transition {
|
2019-04-10 18:59:38 +02:00
|
|
|
|
HomeScreenRobot().interact()
|
2019-05-16 02:32:25 +02:00
|
|
|
|
return HomeScreenRobot.Transition()
|
2019-04-10 18:59:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-05 19:38:09 +02:00
|
|
|
|
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
2020-02-06 21:58:47 +01:00
|
|
|
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
2019-07-05 19:38:09 +02:00
|
|
|
|
|
2019-08-14 22:36:50 +02:00
|
|
|
|
private fun navigationToolbar() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Search or enter address")))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-10-29 10:36:19 +01:00
|
|
|
|
private fun closeTabButton() = onView(withId(R.id.close_tab_button))
|
|
|
|
|
|
2019-08-14 22:36:50 +02:00
|
|
|
|
private fun assertNavigationToolbar() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Search or enter address")))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-07-15 23:25:31 +02:00
|
|
|
|
|
2019-05-16 02:32:25 +02:00
|
|
|
|
private fun assertHomeScreen() = onView(ViewMatchers.withResourceName("homeLayout"))
|
2019-04-10 18:59:38 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-05-16 02:32:25 +02:00
|
|
|
|
private fun assertHomeMenu() = onView(ViewMatchers.withResourceName("menuButton"))
|
2019-04-10 18:59:38 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
|
|
|
|
private fun assertHomePrivateBrowsingButton() =
|
|
|
|
|
onView(ViewMatchers.withResourceName("privateBrowsingButton"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
2019-05-16 02:32:25 +02:00
|
|
|
|
private fun assertHomeWordmark() = onView(ViewMatchers.withResourceName("wordmark"))
|
2019-04-10 18:59:38 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-05-16 02:32:25 +02:00
|
|
|
|
private fun assertHomeToolbar() = onView(ViewMatchers.withResourceName("toolbar"))
|
2019-08-02 18:10:35 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2020-06-05 19:59:08 +02:00
|
|
|
|
private fun assertTabButton() =
|
|
|
|
|
onView(allOf(withId(R.id.tab_button), isDisplayed()))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
2019-08-14 22:36:50 +02:00
|
|
|
|
private fun assertCollectionsHeader() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Collections")))
|
2019-07-05 19:38:09 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
|
|
|
|
private fun assertNoCollectionsHeader() =
|
2020-06-13 00:01:38 +02:00
|
|
|
|
onView(allOf(withText("Collect the things that matter to you")))
|
2019-07-05 19:38:09 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-07-05 19:38:09 +02:00
|
|
|
|
private fun assertNoCollectionsText() =
|
2020-03-31 20:11:41 +02:00
|
|
|
|
onView(
|
|
|
|
|
allOf(
|
2020-06-13 00:01:38 +02:00
|
|
|
|
withText("Group together similar searches, sites, and tabs for quick access later.")
|
2020-03-02 15:35:00 +01:00
|
|
|
|
)
|
2020-03-31 20:11:41 +02:00
|
|
|
|
)
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2020-03-02 15:35:00 +01:00
|
|
|
|
|
2020-03-31 20:11:41 +02:00
|
|
|
|
private fun assertHomeComponent() =
|
|
|
|
|
onView(ViewMatchers.withResourceName("sessionControlRecyclerView"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-05-16 02:32:25 +02:00
|
|
|
|
|
2020-07-21 14:49:24 +02:00
|
|
|
|
private fun assertNoTabsOpened() = onView(withId(R.id.counter_text)).check(matches(withText("0")))
|
|
|
|
|
|
2019-12-27 16:55:35 +01:00
|
|
|
|
private fun threeDotButton() = onView(allOf(withId(R.id.menuButton)))
|
2019-07-09 23:52:15 +02:00
|
|
|
|
|
2020-02-06 21:58:47 +01:00
|
|
|
|
private fun verifySearchEngineIcon(searchEngineIcon: Bitmap, searchEngineName: String) {
|
|
|
|
|
onView(withId(R.id.search_engine_icon))
|
|
|
|
|
.check(matches(withBitmapDrawable(searchEngineIcon, searchEngineName)))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun getSearchEngine(searchEngineName: String) =
|
|
|
|
|
Search(appContext).searchEngineManager.getDefaultSearchEngine(appContext, searchEngineName)
|
|
|
|
|
|
|
|
|
|
private fun verifySearchEngineIcon(searchEngineName: String) {
|
|
|
|
|
val ddgSearchEngine = getSearchEngine(searchEngineName)
|
|
|
|
|
verifySearchEngineIcon(ddgSearchEngine.icon, ddgSearchEngine.name)
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-09 23:52:15 +02:00
|
|
|
|
// First Run elements
|
2019-08-14 22:36:50 +02:00
|
|
|
|
private fun assertWelcomeHeader() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Welcome to Firefox Preview!")))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
2019-07-16 00:02:55 +02:00
|
|
|
|
private fun assertGetTheMostHeader() =
|
2020-08-20 18:05:11 +02:00
|
|
|
|
onView(allOf(withText("Start syncing bookmarks, passwords, and more with your Firefox account.")))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
|
|
|
|
private fun assertAccountsSignInButton() =
|
2020-08-20 18:05:11 +02:00
|
|
|
|
onView(ViewMatchers.withResourceName("fxa_sign_in_button"))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertGetToKnowHeader() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Get to know Firefox Preview")))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
|
|
|
|
|
private fun assertChooseThemeHeader() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Choose your theme")))
|
2019-07-13 01:19:08 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
|
2019-07-13 01:19:08 +02:00
|
|
|
|
private fun assertChooseThemeText() =
|
2020-03-13 16:16:47 +01:00
|
|
|
|
onView(allOf(withText("Save some battery and your eyesight by enabling dark mode.")))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-07-13 01:19:08 +02:00
|
|
|
|
|
2019-08-14 22:36:50 +02:00
|
|
|
|
private fun assertLightThemeToggle() =
|
|
|
|
|
onView(ViewMatchers.withResourceName("theme_light_radio_button"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertLightThemeDescription() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Light theme")))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertDarkThemeToggle() =
|
|
|
|
|
onView(ViewMatchers.withResourceName("theme_dark_radio_button"))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertDarkThemeDescription() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Dark theme")))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertAutomaticThemeToggle() =
|
2020-03-13 16:16:47 +01:00
|
|
|
|
onView(withId(R.id.theme_automatic_radio_button))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertAutomaticThemeDescription() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Automatic")))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
|
2020-06-05 09:02:21 +02:00
|
|
|
|
private fun assertAutomaticPrivacyHeader() =
|
|
|
|
|
onView(allOf(withText("Automatic privacy")))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-07-16 00:02:55 +02:00
|
|
|
|
private fun assertTrackingProtectionToggle() = onView(
|
2020-02-06 22:06:28 +01:00
|
|
|
|
allOf(ViewMatchers.withResourceName("tracking_protection_toggle"))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
)
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2020-06-05 09:02:21 +02:00
|
|
|
|
private fun assertAutomaticPrivacyText() {
|
2019-08-14 22:36:50 +02:00
|
|
|
|
onView(
|
2020-02-06 22:06:28 +01:00
|
|
|
|
allOf(
|
2019-12-27 16:55:35 +01:00
|
|
|
|
withText(
|
2020-06-05 09:02:21 +02:00
|
|
|
|
"Privacy and security settings block trackers, malware, and companies that follow you."
|
2019-08-14 22:36:50 +02:00
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-07-09 23:52:15 +02:00
|
|
|
|
}
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-07-16 00:02:55 +02:00
|
|
|
|
private fun assertBrowsePrivatelyHeader() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Browse privately")))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-07-16 00:02:55 +02:00
|
|
|
|
private fun assertBrowsePrivatelyText() =
|
2020-03-13 16:16:47 +01:00
|
|
|
|
onView(allOf(withText(containsString("Update your private browsing settings."))))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertYourPrivacyHeader() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Your privacy")))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-07-16 00:02:55 +02:00
|
|
|
|
private fun assertYourPrivacyText() =
|
2020-01-30 22:15:40 +01:00
|
|
|
|
onView(
|
2020-02-06 22:06:28 +01:00
|
|
|
|
allOf(
|
2020-01-30 22:15:40 +01:00
|
|
|
|
withText(
|
|
|
|
|
"We’ve designed Firefox Preview to give you control over what you share online and what you share with us."
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
)
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-14 22:36:50 +02:00
|
|
|
|
|
2019-07-16 00:02:55 +02:00
|
|
|
|
private fun assertPrivacyNoticeButton() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Read our privacy notice")))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
2020-03-13 16:16:47 +01:00
|
|
|
|
// What's new elements
|
|
|
|
|
private fun assertWhatsNewHeather() = onView(allOf(withText("See what’s new")))
|
2020-03-31 20:11:41 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2020-03-13 16:16:47 +01:00
|
|
|
|
|
|
|
|
|
private fun assertWhatsNewLink() = onView(allOf(withText("Get answers here")))
|
2020-03-31 20:11:41 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2020-03-13 16:16:47 +01:00
|
|
|
|
|
2019-07-16 00:02:55 +02:00
|
|
|
|
private fun assertStartBrowsingButton() =
|
2020-02-06 22:06:28 +01:00
|
|
|
|
onView(allOf(withText("Start browsing")))
|
2019-07-16 00:02:55 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2019-08-20 22:10:08 +02:00
|
|
|
|
|
2020-03-13 16:16:47 +01:00
|
|
|
|
// Take a position
|
|
|
|
|
private fun assertTakePositionheader() = onView(allOf(withText("Take a position")))
|
2020-03-31 20:11:41 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
2020-03-13 16:16:47 +01:00
|
|
|
|
|
2020-03-31 20:11:41 +02:00
|
|
|
|
private fun assertTakePositionTopRadioButton() =
|
|
|
|
|
onView(ViewMatchers.withResourceName("toolbar_top_radio_button"))
|
2020-03-13 16:16:47 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
2020-03-31 20:11:41 +02:00
|
|
|
|
private fun assertTakePositionBottomRadioButton() =
|
|
|
|
|
onView(ViewMatchers.withResourceName("toolbar_bottom_radio_button"))
|
2020-03-13 16:16:47 +01:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
2020-04-21 06:48:53 +02:00
|
|
|
|
const val PRIVATE_SESSION_MESSAGE =
|
2020-04-24 04:50:14 +02:00
|
|
|
|
"Firefox Preview clears your search and browsing history from private tabs when you close them" +
|
|
|
|
|
" or quit the app. While this doesn’t make you anonymous to websites or your internet" +
|
|
|
|
|
" service provider, it makes it easier to keep what you do online private from anyone" +
|
|
|
|
|
" else who uses this device."
|
2019-08-20 22:10:08 +02:00
|
|
|
|
|
2020-06-05 19:59:08 +02:00
|
|
|
|
private fun assertPrivateSessionMessage() =
|
2020-04-28 16:46:42 +02:00
|
|
|
|
onView(withId(R.id.private_session_description))
|
2019-08-27 19:56:12 +02:00
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
2020-02-06 21:58:47 +01:00
|
|
|
|
private fun collectionThreeDotButton() =
|
|
|
|
|
onView(allOf(withId(R.id.collection_overflow_button)))
|
2019-10-28 20:10:19 +01:00
|
|
|
|
|
2020-01-30 22:15:40 +01:00
|
|
|
|
private fun collectionNameTextField() =
|
|
|
|
|
onView(allOf(ViewMatchers.withResourceName("name_collection_edittext")))
|
|
|
|
|
|
2020-05-12 09:51:44 +02:00
|
|
|
|
private fun collectionTitle(title: String) =
|
|
|
|
|
onView(allOf(withId(R.id.collection_title), withText(title)))
|
|
|
|
|
|
2020-02-06 22:06:28 +01:00
|
|
|
|
private fun assertExistingTopSitesList() =
|
|
|
|
|
onView(allOf(withId(R.id.top_sites_list)))
|
|
|
|
|
.check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
|
|
|
|
|
|
|
|
|
|
private fun assertExistingTopSitesTabs(title: String) =
|
|
|
|
|
onView(allOf(withId(R.id.top_sites_list)))
|
|
|
|
|
.check(matches(hasItem(hasDescendant(withText(title)))))
|
|
|
|
|
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
|
|
private fun assertNotExistingTopSitesList(title: String) =
|
|
|
|
|
onView(allOf(withId(R.id.top_sites_list)))
|
|
|
|
|
.check(matches(not(hasItem(hasDescendant(withText(title))))))
|
|
|
|
|
|
|
|
|
|
private fun assertTopSiteContextMenuItems() {
|
|
|
|
|
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
|
|
|
|
|
|
|
|
|
mDevice.waitNotNull(
|
2020-05-12 09:51:44 +02:00
|
|
|
|
findObject(By.text("Open in private tab")),
|
2020-02-06 22:06:28 +01:00
|
|
|
|
waitingTime
|
|
|
|
|
)
|
|
|
|
|
mDevice.waitNotNull(
|
2020-05-12 09:51:44 +02:00
|
|
|
|
findObject(By.text("Remove")),
|
2020-02-06 22:06:28 +01:00
|
|
|
|
waitingTime
|
|
|
|
|
)
|
|
|
|
|
}
|
2020-03-31 20:11:41 +02:00
|
|
|
|
|
2020-05-12 09:51:44 +02:00
|
|
|
|
private fun assertShareTabsOverlay() {
|
|
|
|
|
onView(withId(R.id.shared_site_list)).check(matches(isDisplayed()))
|
|
|
|
|
onView(withId(R.id.share_tab_title)).check(matches(isDisplayed()))
|
|
|
|
|
onView(withId(R.id.share_tab_favicon)).check(matches(isDisplayed()))
|
|
|
|
|
onView(withId(R.id.share_tab_url)).check(matches(isDisplayed()))
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-31 20:11:41 +02:00
|
|
|
|
private fun tabMediaControlButton() = onView(withId(R.id.play_pause_button))
|
2020-05-12 09:51:44 +02:00
|
|
|
|
|
|
|
|
|
private fun collectionItem(title: String) =
|
|
|
|
|
onView(allOf(withId(R.id.list_element_title), withText(title)))
|
|
|
|
|
|
|
|
|
|
private fun saveCollectionButton() = onView(withId(R.id.save_tab_group_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),
|
|
|
|
|
hasSibling(withText(title))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
private fun collectionFlowBackButton() = onView(withId(R.id.back_button))
|
2020-06-05 19:59:08 +02:00
|
|
|
|
private fun tabsCounter() = onView(withId(R.id.tab_button))
|
2020-05-12 09:51:44 +02:00
|
|
|
|
|
|
|
|
|
private fun tab(title: String) =
|
|
|
|
|
onView(
|
|
|
|
|
allOf(
|
|
|
|
|
withId(R.id.tab_title),
|
|
|
|
|
withText(title)
|
|
|
|
|
)
|
|
|
|
|
)
|