Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KRecyclerView built using IndexMatcher could not match children. #75

Open
jermainedilao opened this issue Apr 26, 2023 · 1 comment
Open

Comments

@jermainedilao
Copy link

Steps to reproduce:

  1. I have a TabLayout with 2 tabs. Both contain RecyclerView with the same id.
  2. I match the RecyclerView in the second tab using withIndex(1) { withId(R.id.recyclerView) }
  3. 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.

@Vacxe
Copy link
Member

Vacxe commented Jul 3, 2023

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants