简体   繁体   中英

Android Studio espresso test recorder - swipe events

I've been playing around with the espresso test recorder and reading the documentation

The documentation states:

Interact with your device to start logging events such as “tap” and “type” actions.

Is it possible to record swipe events like swiping on a view pager? I've been unable to find any examples of this being done, though I know it's still in beta.

Thanks

我目前知道的唯一解决方案是将手势手动添加到生成的测试代码中。

onView(withId(R.id.xyz)).perform(swipeLeft());

Nowadays, Espresso Test Recorder lacks in features like swipe events or starting from actual activity. Maybe that would be fixed in the nearest feature.

Nowadays, still more simple and less flaky way is to write Espresso tests.

This might be useful: https://google.github.io/android-testing-support-library/downloads/espresso-cheat-sheet-2.1.0.pdf

Hope it will help.

Recycler view particular item swap

    ViewInteraction recyclerView = onView(allOf(withId(R.id.rc_vehicle_list),
                withParent(withId(R.id.ll_vehicle)),
                isDisplayed()));
        recyclerView.perform(actionOnItemAtPosition(3,swipeUp()));




 public static ViewAction swipeUp() {
        return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER_LEFT,
                GeneralLocation.CENTER_RIGHT, Press.FINGER);
    }

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