android - RecyclerView espresso test click() not working -
i faced strange espresso instrumentation test behavior. clicking on recycler view's item not working.
click not happened here:
onview(withid(r.id.recyclerview)).perform(actiononitematposition(0, click())); but workaround works:
onview(withid(r.id.recyclerview)).perform(actiononitematposition(0, recyclerclick())); // ... public static viewaction recyclerclick() { return new viewaction() { @override public matcher<view> getconstraints() { return any(view.class); } @override public string getdescription() { return "performing click() on recycler view item"; } @override public void perform(uicontroller uicontroller, view view) { view.performclick(); } }; } is espresso or recyclerview issue?
should nothing recyclerview specifically. espresso viewactions.click() implementation sending motionevent center of target view. make sure no child intercepts it.
Comments
Post a Comment