KRecyclerView built using IndexMatcher could not match children.
jermainedilao opened this issue · comments
Steps to reproduce:
- I have a TabLayout with 2 tabs. Both contain RecyclerView with the same id.
- I match the RecyclerView in the second tab using
withIndex(1) { withId(R.id.recyclerView) }
- Now if I try to do any child matching with the RecyclerView inside second tab, it fails. (childAt, childWith, etc).
Observed Results:
androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: view holder at 0 position of recycler view: (1th view with: (view.getId() is <2131363464/com.package.name.debug:id/recyclerView>))
Expected Results:
I am expecting it to match the children of the RecyclerView inside the second tab.
Note that matching child items of the RecyclerView inside the first tab (withIndex(0)
) works properly.
Relevant Code:
This is how I match my RecyclerViews.
// First tab RecyclerView
KRecyclerView(
builder = {
withIndex(0) {
withId(R.id.recyclerView)
}
},
itemTypeBuilder = {
itemType(::Item)
}
)
// Second tab RecyclerView
KRecyclerView(
builder = {
withIndex(1) {
withId(R.id.recyclerView)
}
},
itemTypeBuilder = {
itemType(::Item)
}
)
// Item
private class Item(parent: Matcher<View>) : KRecyclerItem<Item>(parent) {
val moreOptionsIcon = KImageView(parent) { withId(R.id.moreIcon) }
}
Is there something wrong with how it is set up? Please help.
@jermainedilao could you create a Pull Request to reproduce your issue. By sample provided by you - it looks definitely incorrect. For issues like that I can suggest you use support chat in Telegram. Link can be found in repo README