Add scroll to item
parent
81ab082c1c
commit
dba2186e86
|
@ -6,11 +6,16 @@
|
||||||
|
|
||||||
package org.mozilla.fenix.ui.robots
|
package org.mozilla.fenix.ui.robots
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.test.espresso.Espresso.onView
|
import androidx.test.espresso.Espresso.onView
|
||||||
import androidx.test.espresso.action.ViewActions
|
import androidx.test.espresso.action.ViewActions
|
||||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||||
|
import androidx.test.espresso.contrib.RecyclerViewActions
|
||||||
import androidx.test.espresso.matcher.ViewMatchers
|
import androidx.test.espresso.matcher.ViewMatchers
|
||||||
|
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
|
||||||
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.withText
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import androidx.test.uiautomator.UiDevice
|
import androidx.test.uiautomator.UiDevice
|
||||||
import org.hamcrest.CoreMatchers
|
import org.hamcrest.CoreMatchers
|
||||||
|
@ -40,8 +45,10 @@ class SettingsSubMenuSearchRobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertDefaultSearchEngineHeader() = onView(ViewMatchers.withText("Default search engine"))
|
private fun assertDefaultSearchEngineHeader() =
|
||||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
onView(ViewMatchers.withText("Default search engine"))
|
||||||
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||||
|
|
||||||
private fun assertSearchEngineList() {
|
private fun assertSearchEngineList() {
|
||||||
onView(ViewMatchers.withText("Google"))
|
onView(ViewMatchers.withText("Google"))
|
||||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||||
|
@ -59,17 +66,55 @@ private fun assertSearchEngineList() {
|
||||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun assertShowSearchSuggestions() = onView(ViewMatchers.withText("Show search suggestions"))
|
private fun assertShowSearchSuggestions() {
|
||||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||||
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||||
|
hasDescendant(withText("Show search suggestions"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
onView(ViewMatchers.withText("Show search suggestions"))
|
||||||
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||||
|
}
|
||||||
|
|
||||||
private fun assertShowSearchShortcuts() = onView(ViewMatchers.withText("Show search shortcuts"))
|
private fun assertShowSearchShortcuts() {
|
||||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||||
private fun assertShowClipboardSuggestions() = onView(ViewMatchers.withText("Show clipboard suggestions"))
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
hasDescendant(withText("Show search shortcuts"))
|
||||||
private fun assertSearchBrowsingHistory() = onView(ViewMatchers.withText("Search browsing history"))
|
)
|
||||||
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
)
|
||||||
private fun assertSearchBookmarks() = onView(ViewMatchers.withText("Search bookmarks"))
|
onView(ViewMatchers.withText("Show search shortcuts"))
|
||||||
.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(ViewMatchers.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"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
onView(ViewMatchers.withText("Search browsing history"))
|
||||||
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun assertSearchBookmarks() {
|
||||||
|
onView(withId(androidx.preference.R.id.recycler_view)).perform(
|
||||||
|
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
|
||||||
|
hasDescendant(withText("Search bookmarks"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
onView(ViewMatchers.withText("Search bookmarks"))
|
||||||
|
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||||
|
}
|
||||||
|
|
||||||
private fun goBackButton() =
|
private fun goBackButton() =
|
||||||
onView(CoreMatchers.allOf(ViewMatchers.withContentDescription("Navigate up")))
|
onView(CoreMatchers.allOf(ViewMatchers.withContentDescription("Navigate up")))
|
||||||
|
|
Loading…
Reference in New Issue