How is it possible to scroll down to the bottom of ScrollView in Espresso test? Thanks!
If at the bottom of the ScrollView you need to find a view and match something against it, then simply perform the scrollTo() action on it, before any other actions that require it to be displayed. works only if you know your child elements - what to do if you dont know the last element?
As you may know the latest Espresso release contains new left and right swiping actions: swipeLeft() and swipeRight() . They both are really useful when you'd like to swipe between activity fragments, tab layouts or any other UI elements. You can use it as any other view action: onView(withId(R.
If at the bottom of the ScrollView you need to find a view and match something against it, then simply perform the scrollTo()
action on it, before any other actions that require it to be displayed.
onView(withId(R.id.onBottomOfScrollView)) .perform(scrollTo(), click());
Note: scrollTo will have no effect if the view is already displayed so you can safely use it in cases when the view is displayed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With