Open lucasgcampos opened 6 years ago
Hey Lucas, thank you for your issue.
About the scenario with one item, and without the recyclerView wrapper, it works beacuse the method notExist will match only one view, because you have only one item in your list. If you try with more items in list, it won't work, and it should throw an exception saying that espresso matches more than one view with the same id.
My case is similar:
recyclerView(R.id.recycler_view_id) {
atPosition(1) {
notSwitchOn { id(R.id.switch) }
}
}
I don't think your response is related to the issue, actually i added a customized matcher in RecyclerViewMethods.
fun notSwitchOn(func: BaseMatchersImpl.() -> BaseMatchersImpl): Interactions {
BaseViewInteractions(false, itemMatchList(func)).check(CustomerMatcher.SwitchOff())
return this
}
I can find that when matchSafely is called inside my CustomerMatcher, it is not passing the matched childview but the recyclerView itself.
override fun matchesSafely(item: View): Boolean {
return (item as Checkable).isChecked() == false
}
Hey @iammini5 thanks for your response. I'll chek it out as soon as possible and I will get back here with more information. Thanks again! 😀
Hey guys, I'm sorry for the delay on answering. I'm been really busy here, I'll work on the library this weekend and will try to solve as many issues as possible. Thanks!
Well, after spending a lot of time on this bug and not getting into a solution, I've created new methods so we can match the child views in a RecyclerView
item. Unfortunately, now we can only use the child viewId
and not all the other attributes that we had (text, contentDescription, etc.).
Here is the PR with the work around for that issue: https://github.com/concretesolutions/kappuccino/pull/113 This should allow people to match child views in a recycler view item safely, but only using the view Id.
Need help to investigate this and came up with a proper solution 🙏
I have a scenario of test where I need the check if a specific view of an item of
RecyclerView.Adapter
was setted withvisibility = View.GONE
, so this is my assert:but when a run this code above the test fail. I made some asserts to verify the visibility of the
R.id.label_id
and always return thevisibility = View.GONE
.I tried to use
notDisplayed
, but I got the same result.The curious point is, when my
RecyclerView
has only one item and I usednotExist { id(R.id.label_id) }
without the recycler view wrapper (recyclerView(<id>) { ... }
) it worked.