简体   繁体   中英

How to test swipe gesture with robolectric?

I need to verify that after swipe the needed fragment have been shows. Is there a way to do that with robolectric or espresso?

Yes, you can use something like:

onView(withId(R.id.viewId)).perform(swipeRight()); //or swipeLeft()

and then

onView(withId(R.id.secondViewId)).check(matches(isDisplayed()));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM