Issue
In my android app, I have a ListView
of custom items (made of a clickable title + one checkbox without text). Those items are dynamically added.
How can I check one of those checkboxes in my unit tests using Espresso or a similar framework ?
I can't find how to get a reference to one of the checkboxes. Since they are dynamically added, I can't find them by id, like I usually do with static .xml views.
Solution
Here is how we did it without changing the app's code:
int indexOfItem = 1;
onData(anything()).inAdapterView(withId(R.id.listView))
.atPosition(indexOfItem)
.onChildView(withId(R.id.checkBox))
.perform(click());
Answered By - Julien__
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.