Comments (10)
Hi there!
You should pass the parent matcher of your RecyclerView's item as an argument of a constructor:
val clickable = KView(parent) {
withId(R.id.clickableView)
}
from kakao.
Did it:
object CatalogItemsScreen : Screen<CatalogItemsScreen>() {
val recycler = KRecyclerView(
builder = { withId(R.id.recyclerView) },
itemTypeBuilder = { itemType(::Item) }
)
class Item(parent: Matcher<View>) : KRecyclerItem<Item>(parent) {
val clickable = KView(parent) { withId(R.id.clickableView) }
}
}
but error the same
from kakao.
@iamthevoid could you try to change object
to class
from kakao.
Or follow by guide
See: https://github.com/agoda-com/Kakao/blob/master/sample/src/androidTest/kotlin/com/agoda/sample/screen/TestListScreen.kt
from kakao.
Tried to use as 'class' same as 'KAbsListView' and got the same result. Seems rly strange to me, because screens without adapters works good.
May different adapter items types provoke this error? If answer is 'yes' - how can I resolve it?
from kakao.
Usually, if you get AmbiguousViewMatcherException
that means there is something wrong with the layout of the screen, not necessarily with Kakao itself. Kakao is a wrapper around Espresso, and to be sure that the issue is coming not from the library, you can reproduce it with direct espresso matching:
onView(allOf(withParent(PositionMatcher(withId(R.id. recyclerView), 1), withId(R.id.clickableView)).perform(click())
Most probable issues that I think might happen:
Issues with generated R file (in a multi-module project while merging ids from different modules)
You can have multiple fragments on activity with the same contents
Incompatible versions of espresso/androidx libraries
Please try to reproduce issue with raw espresso call instead of Kakao call and provide us full stacktrace, as well as your screen layout + item layout files.
Specifying the versions of your dependencies might help too.
Also, just try to click your item with the official Espresso way of doing it:
onView(withId(R.id.recyclerView)).perform(actionOnItemAtPosition(1, object : ViewAction {
override fun perform(controller: UiController, view: View) {
view.findViewById(R.id.clickableView).click()
}
}))
from kakao.
Hey @Unlimity I have the same problem with ViewPager, I have two fragment in viewpager and this fragments have a recyclerview with the same Id
from kakao.
@uziassantosferreira could you create PR with example in the sample app with reproducing the issue? That will probably help us a lot.
from kakao.
@uziassantosferreira right now KViewPager
do not have the api to match exact page (but maybe we will add it somewhere in the future), but you still can match the recycler view with withIndex()
matcher. Basically, if you need the recycler on the second page, you match it with withIndex(1)
and so on.
But keep in mind that withIndex()
matcher is one-time use per instance, so your recycler view matching should be function based, not property based.
Cheers!
from kakao.
Closing this issue due to no activity
from kakao.
Related Issues (20)
- NestedScrollView not supported by ScrollTo ViewAction HOT 1
- [Question] how to do action on compound customview child ? HOT 1
- ActionBar - Support homeAsUpIndicator HOT 10
- Add TextInputLayoutAssertions.hasHint(@StringRes resId: Int) HOT 6
- isDescendantOfA{ } and withMatcher(isDescendantOfA( )) not the same? HOT 2
- Misleading readme? HOT 2
- AmbiguousViewMatcherException with recycler views HOT 2
- Lot of UI Test fail after upgrading to 2.3.3 HOT 7
- Issue with hasDrawable when ImageView is using scaleType HOT 5
- RecyclerView inside RecyclerView items, cannot get it to be recognized
- Does hasDrawable method work for AppCompatImageView? HOT 2
- Upgrade Espresso version to 3.3.0 HOT 4
- Optional View Elements HOT 2
- Android Compose support HOT 2
- Migrate away from JCenter HOT 8
- DrawableMatcher fails in 2.3.4 HOT 5
- Scroll to RecyclerView element that part can be off screen HOT 1
- Impossible to check if KAlertDialog isn't on the screen HOT 3
- Checking MenuItems
- DrawableMatcher getDrawable from resource
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kakao.