Closed vkosovskii closed 4 years ago
Hi and thanks for reaching out.
Although, the recycler views in your ViewPager
are not displayed, pager works in a fashion that keeps at least 3 pages active, which means the non-displayed recyclers are present within the view hierarchy, thus the ambiguous match exception. The easiest thing to do is to match the actively displayed recycler in your case:
val rvAppList = KRecyclerView({
withId(R.id.rvAppList)
isDisplayed() // or isCompletelyDisplayed()
}, ...
I hope that helps 👍
Yes! Thanks a lot!! isCompletelyDisplayed() completely solved my problem.
Steps to reproduce:
On the ViewPager I have three RecyclerViews and when I just try to check "rvAppsList.isVisible()" test failed and shows an error: androidx.test.espresso.AmbiguousViewMatcherException: '(with id: com.malwarebytes.antimalware.cloud:id/rvAppsList)' matches multiple views in the hierarchy. Problem views are marked with 'MATCHES' below.
Create a recycler view:
Failing on the step "isVisible"
Observed Results: