Skip to content

Instantly share code, notes, and snippets.

@rakib10rr3
Created September 4, 2019 06:47
Show Gist options
  • Save rakib10rr3/2468ff4ef34fe82095e0fd9cb196ef5d to your computer and use it in GitHub Desktop.
Save rakib10rr3/2468ff4ef34fe82095e0fd9cb196ef5d to your computer and use it in GitHub Desktop.
private fun customScroll(): ViewAction {
return object : ViewAction {
override fun getDescription(): String? {
return null
}
override fun getConstraints(): Matcher<View> {
return CoreMatchers.allOf(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE), isDescendantOfA(anyOf(
isAssignableFrom(ScrollView::class.java),
isAssignableFrom(HorizontalScrollView::class.java),
isAssignableFrom(NestedScrollView::class.java)))
)
}
override
fun perform(uiController: UiController, view: View) {
ScrollToAction().perform(uiController,view)
}
}
}
//Call it like this
onView(withId(R.id.contactMobileNumberTIET)).perform(customScroll(), typeText("0123456789"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment