I have one RecyclerView with ItemTouchHelper to swipe the internal items LEFT and RIGHT - when I perform swipeLeft() and swipeRight() on them via espresso like this:
onView(withId(R.id.pass_recyclerview)).perform(RecyclerViewActions.actionOnItemAtPosition(0,swipeRight()));
but unfortunately the tests are flaky - on some devices they work and on some they don't - is there a reliable way to perform this swipe action? I already played around with other EDGE_FUZZ_FACTORs - but this is also not the way to make it work 100%
Update: I debugged the problem a bit more - somehow on some devices there is a cancel event in between:
event_t1 = {android.view.MotionEvent@830019549128} "MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=546.0, y[0]=40.0, toolType[0]=TOOL_TYPE_UNKNOWN, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=788701990, downTime=788701990, deviceId=0, source=0x1002 }"
event_t2 = {android.view.MotionEvent@830019178264} "MotionEvent { action=ACTION_CANCEL, id[0]=0, x[0]=500.98276, y[0]=40.0, toolType[0]=TOOL_TYPE_UNKNOWN, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=1, eventTime=788722868, downTime=788701990, deviceId=0, source=0x1002 }"
I see this on the "public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent event)" of ItemTouchHelper. These are the only events I see there - Interestingly when activating the Screen overlay showing touch data then I see the swipe completing fine after this cancel on ~1/10 the way