So far we can do:
How can we swipeTop(all the way to the Top) or swipeBottom(all the way to the bottom) is expresso. Please give me an example if these methods already exists.
Have you tried a GeneralSwipeAction
like that?
private static ViewAction swipeFromTopToBottom() {
return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER,
GeneralLocation.BOTTOM_CENTER, Press.FINGER);
}
Maybe you have to provide a custom implementation for the second and/or third parameter, as Anna already mentioned:
new CoordinatesProvider() {
@Override
public float[] calculateCoordinates(View view) {
float[] coordinates = GeneralLocation.CENTER.calculateCoordinates(view);
coordinates[1] = 0;
return coordinates;
}
}
For example if you use recyclerView in yours application, you can use something like this:
Espresso.onView(ViewMatchers.withId(R.id.recyclerView)).perform(ViewActions.swipeUp())
or
Espresso.onView(ViewMatchers.withId(R.id.recyclerView)).perform(ViewActions.swipeDown())
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