Is it possible to click the first item of a ListView inside a ViewPager?
I already tried to get it working like this:
onData(anything()).inAdapterView(withId(R.id.myListView)).atPosition(0).perform(click());
.
But as I understand from here: Testing ViewPager with Espresso. How perfom action to a button of an Item? you cant use onData for a ViewPager. Plus if I run the Test i get a AmbiguousViewMatcherException for multiple matches.
android.support.test.espresso.AmbiguousViewMatcherException: 'with id: my.awesome.app:id/myListView' matches multiple views in the hierarchy.
Problem views are marked with '****MATCHES****' below.
If i run the test like this onView(allOf(withId(R.id.myListView),isDisplayed())).perform(click());
the first item is never clicked.
Is there another way to click the first item of the list?