Espresso:测试滑动即可删除ViewPager中的Recyclerview项目

时间:2019-06-13 10:41:33

标签: android testing android-recyclerview android-viewpager android-espresso

我想测试向左滑动以删除,但它触发了ViewPager滑动动作,如何解决?

 onView(withId(R.id.orders)).perform(
        RecyclerViewActions.actionOnItemAtPosition<ProductItemViewHolder>(
            1,
            swipeLeft()
        )
    )

1 个答案:

答案 0 :(得分:0)

测试此:

    onView(withId(R.id.rv_recyclerview)).perform(
            RecyclerViewActions.actionOnItemAtPosition(0, new GeneralSwipeAction(
                    Swipe.SLOW, GeneralLocation.BOTTOM_RIGHT, GeneralLocation.BOTTOM_LEFT,
                    Press.FINGER)));