Issue
I'm very new to Espresso, and I feel like this is doable, but I'm not sure exactly how.
I know you can click on a RecyclerView row using:
onView(withId(viewId)).perform(RecyclerViewActions.actionOnItemAtPosition(position, click()));
The problem I'm having is that in the piece of code I'm testing the RecyclerView is added at runtime. How do I get the viewId to pass to this function? Or how else can I get this to work?
Solution
If the RecyclerView does not have an id, you can still use other matchers:
// Any RecyclerView
onView(isAssignableFrom(RecyclerView.class)).perform(...);
// RecyclerView that is a child/descendant of a container view
onView(allOf(isAssignableFrom(RecyclerView.class), isDescendantOfA(withId(container_id)))).perform(...);
Answered By - Aaron
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.