Reputation: 976
onView(withId(R.id.feeding_name)).check(matches(isDisplayed()));
causes AmbiguousViewMatcherException.
Due to multiple fragments on the screen the id "feeding_name" matches multiple views.
I am wondering, if there is any way to specify the parent of the view so that I could do something like onView(withIdAndParentId(R.id.feeding_name, R.id.fragment_show_feeding)).check(matches(isDisplayed()));
Upvotes: 0
Views: 883
Reputation: 3894
You could try combination of matchers with allOf
, like for example:
onView(allOf(withId(R.id.feeding_name), withParent(withId(R.id.fragment_show_feeding))))
.check(matches(isDisplayed()));
Upvotes: 2