agoda-com / Kakao

This repo is no longer supported. Please visit a https://github.com/KakaoCup/Kakao
Apache License 2.0
1.11k stars 102 forks source link

RecyclerView AmbiguousViewMatcherException with ONE SINGLE MATCH 0_o #184

Closed iamthevoid closed 4 years ago

iamthevoid commented 4 years ago

Steps to reproduce:

I have object like

 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 {
            withParent { withMatcher(parent) }
            withId(R.id.clickableView)
        }
    }
}

and use it like

            CatalogItemsScreen {
                recycler.childAt<CatalogItemsScreen.Item>(1) {
                    clickable.click()
                }
            }  

Observed Results:

at this place I got exception (sorry for full listing, but it need for clearly show the issue)

Message in exception say "MULTIPLE views marked", but i found with simple text search ONLY ONE mark. How can it be?

androidx.test.espresso.AmbiguousViewMatcherException: '(has parent matching: (view holder at 1 position of recycler view: (with id: ru.butik.android.debug:id/recyclerView)) and with id: ru.butik.android.debug:id/clickableView)' matches multiple views in the hierarchy. Problem views are marked with 'MATCHES' below.

View Hierarchy: +>DecorView{id=-1, visibility=VISIBLE, width=768, height=1280, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params={(0,0)(fillxfill) sim={adjust=nothing} ty=BASE_APPLICATION wanim=0x10302f8 fl=LAYOUT_IN_SCREEN LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED TRANSLUCENT_STATUS DRAWS_SYSTEM_BAR_BACKGROUNDS pfl=FORCE_DRAW_STATUS_BAR_BACKGROUND}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3} +->LinearLayout{id=-1, visibility=VISIBLE, width=768, height=1184, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@1197392, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
+-->ViewStub{id=16908682, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@df8e163, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} +-->FrameLayout{id=-1, visibility=VISIBLE, width=768, height=1184, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@d365160, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
+--->FitWindowsLinearLayout{id=2131230778, res-name=action_bar_root, visibility=VISIBLE, width=768, height=1184, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@ad736de, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} +---->ViewStubCompat{id=2131230810, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e0e30bf, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
+---->ContentFrameLayout{id=16908290, res-name=content, visibility=VISIBLE, width=768, height=1184, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@19f238c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1} +----->FrameLayout{id=-1, visibility=VISIBLE, width=768, height=1184, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@1be2ea, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=5}
+------>FrameLayout{id=2131231243, res-name=nav_host_fragment, visibility=VISIBLE, width=768, height=1184, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@5ff19db, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1} +------->FrameLayout{id=2131230978, res-name=contentContainer, visibility=VISIBLE, width=768, height=1184, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@eb55bb3, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=4}
+-------->FrameLayout{id=2131230977, res-name=content, visibility=VISIBLE, width=768, height=1024, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@49ac570, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=160.0, child-count=2} +--------->RecyclerView{id=2131231337, res-name=recyclerView, desc=catalog-items, visibility=VISIBLE, width=768, height=1024, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@2ae60e9, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=5}
+---------->View{id=-1, visibility=VISIBLE, width=768, height=96, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.GridLayoutManager$LayoutParams@2fc716e, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} +---------->LinearLayout{id=-1, desc=catalog-item, visibility=VISIBLE, width=383, height=804, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.GridLayoutManager$LayoutParams@920000f, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=96.0, child-count=1}
+----------->FrameLayout{id=2131230956, res-name=clickableView, visibility=VISIBLE, width=381, height=802, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@d3ec89c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=1.0, y=1.0, child-count=1} MATCHES +------------>LinearLayout{id=-1, visibility=VISIBLE, width=381, height=802, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@98322a5, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
+------------->FrameLayout{id=2131231157, res-name=imageContainer, visibility=VISIBLE, width=381, height=602, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@202367a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3} +-------------->AppCompatImageView{id=2131231156, res-name=image, visibility=VISIBLE, width=383, height=602, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@3e68e2b, tag=com.bumptech.glide.request.ThumbnailRequestCoordinator@56a33ac, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
+-------------->AppCompatTextView{id=2131231310, res-name=priceOff, visibility=VISIBLE, width=83, height=56, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@8bdd288, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=New, input-type=0, ime-target=false, has-links=false} +-------------->AppCompatImageView{id=2131231065, res-name=favorite, visibility=VISIBLE, width=80, height=80, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@c284421, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=0.0}
+------------->LinearLayout{id=-1, visibility=VISIBLE, width=381, height=202, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@46d4046, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=602.0, child-count=3} +-------------->AppCompatTextView{id=2131230884, res-name=brand, visibility=VISIBLE, width=317, height=38, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@83de207, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=16.0, text=ALISIA HIT, input-type=0, ime-target=false, has-links=false}
+-------------->AppCompatTextView{id=2131231494, res-name=title, visibility=VISIBLE, width=317, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@5a18f34, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=60.0, text=Платье, input-type=0, ime-target=false, has-links=false} +-------------->LinearLayout{id=-1, visibility=VISIBLE, width=317, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@5a4015d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=104.0, child-count=2}
+--------------->AppCompatTextView{id=2131231306, res-name=price, visibility=VISIBLE, width=113, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@a2d1ad2, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=8 750 ₽, input-type=0, ime-target=false, has-links=false} +--------------->AppCompatTextView{id=2131231309, res-name=priceNew, visibility=VISIBLE, width=120, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@3cc97a3, tag=null, root-is-layout-requested=false, has-input-connection=false, x=121.0, y=0.0, text=7 000 ₽, input-type=0, ime-target=false, has-links=false}
+---------->LinearLayout{id=-1, desc=catalog-item, visibility=VISIBLE, width=383, height=804, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.GridLayoutManager$LayoutParams@f626aa0, tag=null, root-is-layout-requested=false, has-input-connection=false, x=384.0, y=96.0, child-count=1} +----------->FrameLayout{id=2131230956, res-name=clickableView, visibility=VISIBLE, width=381, height=802, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@1245659, tag=null, root-is-layout-requested=false, has-input-connection=false, x=1.0, y=1.0, child-count=1}
+------------>LinearLayout{id=-1, visibility=VISIBLE, width=381, height=802, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@9e121e, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} +------------->FrameLayout{id=2131231157, res-name=imageContainer, visibility=VISIBLE, width=381, height=602, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e070aff, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
+-------------->AppCompatImageView{id=2131231156, res-name=image, visibility=VISIBLE, width=383, height=602, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@e9390cc, tag=com.bumptech.glide.request.ThumbnailRequestCoordinator@a58c00a, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} +-------------->AppCompatTextView{id=2131231310, res-name=priceOff, visibility=VISIBLE, width=83, height=56, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@4baff15, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=New, input-type=0, ime-target=false, has-links=false}
+-------------->AppCompatImageView{id=2131231065, res-name=favorite, visibility=VISIBLE, width=80, height=80, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@c95322a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=0.0} +------------->LinearLayout{id=-1, visibility=VISIBLE, width=381, height=202, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@74b581b, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=602.0, child-count=3}
+-------------->AppCompatTextView{id=2131230884, res-name=brand, visibility=VISIBLE, width=317, height=38, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@fceedb8, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=16.0, text=ALISIA HIT, input-type=0, ime-target=false, has-links=false} +-------------->AppCompatTextView{id=2131231494, res-name=title, visibility=VISIBLE, width=317, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@bd97791, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=60.0, text=Платье, input-type=0, ime-target=false, has-links=false}
+-------------->LinearLayout{id=-1, visibility=VISIBLE, width=317, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@92c46f6, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=104.0, child-count=2} +--------------->AppCompatTextView{id=2131231306, res-name=price, visibility=VISIBLE, width=119, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@dbd5af7, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=11 250 ₽, input-type=0, ime-target=false, has-links=false}
+--------------->AppCompatTextView{id=2131231309, res-name=priceNew, visibility=VISIBLE, width=123, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@d612d64, tag=null, root-is-layout-requested=false, has-input-connection=false, x=127.0, y=0.0, text=9 000 ₽, input-type=0, ime-target=false, has-links=false} +---------->LinearLayout{id=-1, desc=catalog-item, visibility=VISIBLE, width=383, height=804, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.GridLayoutManager$LayoutParams@d8cfbcd, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=900.0, child-count=1}
+----------->FrameLayout{id=2131230956, res-name=clickableView, visibility=VISIBLE, width=381, height=802, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@74ddc82, tag=null, root-is-layout-requested=false, has-input-connection=false, x=1.0, y=1.0, child-count=1} +------------>LinearLayout{id=-1, visibility=VISIBLE, width=381, height=802, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@3e2af93, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
+------------->FrameLayout{id=2131231157, res-name=imageContainer, visibility=VISIBLE, width=381, height=602, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@7b5bbd0, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3} +-------------->AppCompatImageView{id=2131231156, res-name=image, visibility=VISIBLE, width=383, height=602, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@a7a87c9, tag=com.bumptech.glide.request.ThumbnailRequestCoordinator@7a0f80c, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
+-------------->AppCompatTextView{id=2131231310, res-name=priceOff, visibility=VISIBLE, width=96, height=56, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@a013ece, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=-30%, input-type=0, ime-target=false, has-links=false} +-------------->AppCompatImageView{id=2131231065, res-name=favorite, visibility=VISIBLE, width=80, height=80, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@4feb1ef, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=0.0}
+------------->LinearLayout{id=-1, visibility=VISIBLE, width=381, height=202, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@882c4fc, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=602.0, child-count=3} +-------------->AppCompatTextView{id=2131230884, res-name=brand, visibility=VISIBLE, width=317, height=38, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e9ad785, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=16.0, text=EA7, input-type=0, ime-target=false, has-links=false}
+-------------->AppCompatTextView{id=2131231494, res-name=title, visibility=VISIBLE, width=317, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@b7679da, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=60.0, text=Пуховик, input-type=0, ime-target=false, has-links=false} +-------------->LinearLayout{id=-1, visibility=VISIBLE, width=317, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@32e7e0b, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=104.0, child-count=2}
+--------------->AppCompatTextView{id=2131231306, res-name=price, visibility=VISIBLE, width=135, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@cb534e8, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=29 990 ₽, input-type=0, ime-target=false, has-links=false} +--------------->AppCompatTextView{id=2131231309, res-name=priceNew, visibility=VISIBLE, width=132, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@2b66701, tag=null, root-is-layout-requested=false, has-input-connection=false, x=143.0, y=0.0, text=20 993 ₽, input-type=0, ime-target=false, has-links=false}
+---------->LinearLayout{id=-1, desc=catalog-item, visibility=VISIBLE, width=383, height=804, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.GridLayoutManager$LayoutParams@6d259a6, tag=null, root-is-layout-requested=false, has-input-connection=false, x=384.0, y=900.0, child-count=1} +----------->FrameLayout{id=2131230956, res-name=clickableView, visibility=VISIBLE, width=381, height=802, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@b44efe7, tag=null, root-is-layout-requested=false, has-input-connection=false, x=1.0, y=1.0, child-count=1}
+------------>LinearLayout{id=-1, visibility=VISIBLE, width=381, height=802, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@11cb794, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} +------------->FrameLayout{id=2131231157, res-name=imageContainer, visibility=VISIBLE, width=381, height=602, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@9a1723d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
+-------------->AppCompatImageView{id=2131231156, res-name=image, visibility=VISIBLE, width=383, height=602, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@2ba6a32, tag=com.bumptech.glide.request.ThumbnailRequestCoordinator@9b10b6a, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} +-------------->AppCompatTextView{id=2131231310, res-name=priceOff, visibility=VISIBLE, width=96, height=56, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@a66a383, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=-30%, input-type=0, ime-target=false, has-links=false}
+-------------->AppCompatImageView{id=2131231065, res-name=favorite, visibility=VISIBLE, width=80, height=80, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@dd7b900, tag=null, root-is-layout-requested=false, has-input-connection=false, x=301.0, y=0.0} +------------->LinearLayout{id=-1, visibility=VISIBLE, width=381, height=202, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@537f539, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=602.0, child-count=3}
+-------------->AppCompatTextView{id=2131230884, res-name=brand, visibility=VISIBLE, width=317, height=38, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@8a0f77e, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=16.0, text=EA7, input-type=0, ime-target=false, has-links=false} +-------------->AppCompatTextView{id=2131231494, res-name=title, visibility=VISIBLE, width=317, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@165f4df, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=60.0, text=Пуховик, input-type=0, ime-target=false, has-links=false}
+-------------->LinearLayout{id=-1, visibility=VISIBLE, width=317, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@c7f652c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=32.0, y=104.0, child-count=2} +--------------->AppCompatTextView{id=2131231306, res-name=price, visibility=VISIBLE, width=133, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@f19abf5, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=23 990 ₽, input-type=0, ime-target=false, has-links=false}
+--------------->AppCompatTextView{id=2131231309, res-name=priceNew, visibility=VISIBLE, width=120, height=40, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@4d10d8a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=141.0, y=0.0, text=16 793 ₽, input-type=0, ime-target=false, has-links=false} +--------->FrameLayout{id=-1, visibility=VISIBLE, width=768, height=912, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@1defffb, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
+---------->FrameLayout{id=-1, visibility=VISIBLE, width=768, height=912, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@513a818, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1} +----------->ProgressBar{id=2131231184, res-name=loading, visibility=INVISIBLE, width=80, height=80, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@1261271, tag=null, root-is-layout-requested=false, has-input-connection=false, x=344.0, y=416.0}

+-------->LinearLayout{id=2131231141, res-name=handler_holder, visibility=VISIBLE, width=768, height=100, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@113a0d7, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=160.0, child-count=2} | +--------->FrameLayout{id=2131231351, res-name=rubricator_recycler_holder, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@9b864ad, tag=null, root-i

Unlimity commented 4 years ago

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)
}
iamthevoid commented 4 years ago

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

Vacxe commented 4 years ago

@iamthevoid could you try to change object to class

Vacxe commented 4 years ago

Or follow by guide See: https://github.com/agoda-com/Kakao/blob/master/sample/src/androidTest/kotlin/com/agoda/sample/screen/TestListScreen.kt

iamthevoid commented 4 years ago

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?

Unlimity commented 4 years ago

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()
    }
}))
uziassantosferreira commented 4 years ago

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

Vacxe commented 4 years ago

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

Unlimity commented 4 years ago

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

Unlimity commented 4 years ago

Closing this issue due to no activity