Skip to content

Instantly share code, notes, and snippets.

@tatocaster
Created August 9, 2020 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatocaster/e400a44a397615c539e0bdbb5bd292d7 to your computer and use it in GitHub Desktop.
Save tatocaster/e400a44a397615c539e0bdbb5bd292d7 to your computer and use it in GitHub Desktop.
Nested Scroll View Espresso scroll viewaction
fun nestedScrollTo(): ViewAction {
return object : ViewAction {
override fun getConstraints(): Matcher<View> {
return CoreMatchers.allOf(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE),
ViewMatchers.isDescendantOfA(CoreMatchers.anyOf(
ViewMatchers.isAssignableFrom(ScrollView::class.java),
ViewMatchers.isAssignableFrom(HorizontalScrollView::class.java),
ViewMatchers.isAssignableFrom(NestedScrollView::class.java)))
)
}
override fun getDescription(): String? {
return "not found"
}
override fun perform(uiController: UiController?, view: View?) {
ScrollToAction().perform(uiController, view)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment