|
|
@ -15,6 +15,7 @@ import androidx.test.espresso.matcher.ViewMatchers
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withChild
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withChild
|
|
|
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withClassName
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
|
|
@ -24,12 +25,16 @@ import androidx.test.uiautomator.By
|
|
|
|
import androidx.test.uiautomator.UiSelector
|
|
|
|
import androidx.test.uiautomator.UiSelector
|
|
|
|
import org.hamcrest.CoreMatchers
|
|
|
|
import org.hamcrest.CoreMatchers
|
|
|
|
import org.hamcrest.Matchers.allOf
|
|
|
|
import org.hamcrest.Matchers.allOf
|
|
|
|
|
|
|
|
import org.hamcrest.Matchers.endsWith
|
|
|
|
import org.junit.Assert.assertTrue
|
|
|
|
import org.junit.Assert.assertTrue
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
|
|
|
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
|
|
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.getStringResource
|
|
|
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.hasCousin
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.mDevice
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.packageName
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.packageName
|
|
|
|
import org.mozilla.fenix.helpers.click
|
|
|
|
import org.mozilla.fenix.helpers.click
|
|
|
|
|
|
|
|
import org.mozilla.fenix.helpers.isChecked
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Implementation of Robot Pattern for the settings search sub menu.
|
|
|
|
* Implementation of Robot Pattern for the settings search sub menu.
|
|
|
@ -38,18 +43,90 @@ class SettingsSubMenuSearchRobot {
|
|
|
|
fun verifySearchToolbar() = assertSearchToolbar()
|
|
|
|
fun verifySearchToolbar() = assertSearchToolbar()
|
|
|
|
fun verifyDefaultSearchEngineHeader() = assertDefaultSearchEngineHeader()
|
|
|
|
fun verifyDefaultSearchEngineHeader() = assertDefaultSearchEngineHeader()
|
|
|
|
fun verifySearchEngineList() = assertSearchEngineList()
|
|
|
|
fun verifySearchEngineList() = assertSearchEngineList()
|
|
|
|
fun verifyShowSearchSuggestions() = assertShowSearchSuggestions()
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyShowSearchSuggestions() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Show search suggestions")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
onView(withText("Show search suggestions"))
|
|
|
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyShowSearchShortcuts() = assertShowSearchShortcuts()
|
|
|
|
fun verifyShowSearchShortcuts() = assertShowSearchShortcuts()
|
|
|
|
fun verifyShowClipboardSuggestions() = assertShowClipboardSuggestions()
|
|
|
|
|
|
|
|
fun verifySearchBrowsingHistory() = assertSearchBrowsingHistory()
|
|
|
|
fun verifyShowClipboardSuggestionsDefault() {
|
|
|
|
fun verifySearchBookmarks() = assertSearchBookmarks()
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText(getStringResource(R.string.preferences_show_clipboard_suggestions))),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
onView(withText(getStringResource(R.string.preferences_show_clipboard_suggestions)))
|
|
|
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
.check(matches(hasCousin(allOf(withClassName(endsWith("Switch")), isChecked(true)))))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun toggleClipboardSuggestion() {
|
|
|
|
|
|
|
|
onView(withText(getStringResource(R.string.preferences_show_clipboard_suggestions)))
|
|
|
|
|
|
|
|
.click()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun verifySearchBrowsingHistory() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Search browsing history")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
searchHistoryToggle
|
|
|
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun verifySearchBookmarks() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Search bookmarks")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
searchBookmarksToggle
|
|
|
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun changeDefaultSearchEngine(searchEngineName: String) =
|
|
|
|
fun changeDefaultSearchEngine(searchEngineName: String) =
|
|
|
|
selectSearchEngine(searchEngineName)
|
|
|
|
selectSearchEngine(searchEngineName)
|
|
|
|
|
|
|
|
|
|
|
|
fun disableShowSearchSuggestions() = toggleShowSearchSuggestions()
|
|
|
|
fun toggleAutocomplete() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText(getStringResource(R.string.preferences_enable_autocomplete_urls))),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onView(withText(getStringResource(R.string.preferences_enable_autocomplete_urls)))
|
|
|
|
|
|
|
|
.click()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun toggleShowSearchSuggestions() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Show search suggestions")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onView(withText("Show search suggestions"))
|
|
|
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun enableShowSearchShortcuts() = toggleShowSearchShortcuts()
|
|
|
|
fun toggleShowSearchShortcuts() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Show search engines")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onView(withText("Show search engines"))
|
|
|
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun toggleVoiceSearch() {
|
|
|
|
fun toggleVoiceSearch() {
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
@ -78,6 +155,16 @@ class SettingsSubMenuSearchRobot {
|
|
|
|
searchBookmarksToggle.click()
|
|
|
|
searchBookmarksToggle.click()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun toggleShowSuggestionsInPrivateSessions() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText(getStringResource(R.string.preferences_show_search_suggestions_in_private))),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
onView(withText(getStringResource(R.string.preferences_show_search_suggestions_in_private)))
|
|
|
|
|
|
|
|
.click()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun openAddSearchEngineMenu() = addSearchEngineButton().click()
|
|
|
|
fun openAddSearchEngineMenu() = addSearchEngineButton().click()
|
|
|
|
|
|
|
|
|
|
|
|
fun verifyAddSearchEngineList() = assertAddSearchEngineList()
|
|
|
|
fun verifyAddSearchEngineList() = assertAddSearchEngineList()
|
|
|
@ -215,16 +302,6 @@ private fun assertSearchEngineList() {
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun assertShowSearchSuggestions() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Show search suggestions")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
onView(withText("Show search suggestions"))
|
|
|
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun assertShowSearchShortcuts() {
|
|
|
|
private fun assertShowSearchShortcuts() {
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
@ -235,38 +312,8 @@ private fun assertShowSearchShortcuts() {
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun assertShowClipboardSuggestions() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Show clipboard suggestions")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
onView(withText("Show clipboard suggestions"))
|
|
|
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun assertSearchBrowsingHistory() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Search browsing history")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
searchHistoryToggle
|
|
|
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val searchHistoryToggle = onView(withText("Search browsing history"))
|
|
|
|
private val searchHistoryToggle = onView(withText("Search browsing history"))
|
|
|
|
|
|
|
|
|
|
|
|
private fun assertSearchBookmarks() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Search bookmarks")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
searchBookmarksToggle
|
|
|
|
|
|
|
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private val searchBookmarksToggle = onView(withText("Search bookmarks"))
|
|
|
|
private val searchBookmarksToggle = onView(withText("Search bookmarks"))
|
|
|
|
|
|
|
|
|
|
|
|
private fun selectSearchEngine(searchEngine: String) {
|
|
|
|
private fun selectSearchEngine(searchEngine: String) {
|
|
|
@ -275,28 +322,6 @@ private fun selectSearchEngine(searchEngine: String) {
|
|
|
|
.perform(click())
|
|
|
|
.perform(click())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun toggleShowSearchSuggestions() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Show search suggestions")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onView(withText("Show search suggestions"))
|
|
|
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun toggleShowSearchShortcuts() {
|
|
|
|
|
|
|
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
|
|
|
|
|
|
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
|
|
|
|
|
|
|
hasDescendant(withText("Show search engines")),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onView(withText("Show search engines"))
|
|
|
|
|
|
|
|
.perform(click())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun goBackButton() =
|
|
|
|
private fun goBackButton() =
|
|
|
|
onView(CoreMatchers.allOf(withContentDescription("Navigate up")))
|
|
|
|
onView(CoreMatchers.allOf(withContentDescription("Navigate up")))
|
|
|
|
|
|
|
|
|
|
|
|