Giter Club home page Giter Club logo

Comments (10)

Unlimity avatar Unlimity commented on August 16, 2024 1

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.

iamthevoid avatar iamthevoid commented on August 16, 2024

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.

Vacxe avatar Vacxe commented on August 16, 2024

@iamthevoid could you try to change object to class

from kakao.

Vacxe avatar Vacxe commented on August 16, 2024

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.

iamthevoid avatar iamthevoid commented on August 16, 2024

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.

Unlimity avatar Unlimity commented on August 16, 2024

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.

uziassantosferreira avatar uziassantosferreira commented on August 16, 2024

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.

Vacxe avatar Vacxe commented on August 16, 2024

@uziassantosferreira could you create PR with example in the sample app with reproducing the issue? That will probably help us a lot.

from kakao.

Unlimity avatar Unlimity commented on August 16, 2024

@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.

Unlimity avatar Unlimity commented on August 16, 2024

Closing this issue due to no activity

from kakao.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.