RecyclerView espresso test click() not working


I faced with strange espresso instrumentation test behavior. Clicking on recycler view’s item not working.

Click not happened here:

onView(withId(, click()));

But this workaround works:

onView(withId(, recyclerClick()));

// ...

public static ViewAction recyclerClick() {
    return new ViewAction() {

        public Matcher<View> getConstraints() {
            return any(View.class);

        public String getDescription() {
            return "performing click() on recycler view item";

        public void perform(UiController uiController, View view) {

Is this Espresso or RecyclerView issue?


Should be nothing to do with RecyclerView specifically. What Espresso does with its implementation is sending the MotionEvent to the center of the target view. Make sure no child intercepts it.

Answered By – riwnodennyk

Leave a Comment