java - What to do in Espresso when the recyclerView itself returns AmbiguousViewMatcherException? -
the problem have tabbed view, , each page contains same recyclerview different data pertaining tab. if i'm not describing well, it's same described in tutorial: https://github.com/codepath/android_guides/wiki/viewpager-with-fragmentpageradapter
i creating instrumentation tests using espresso, , when try call
onview(withid(r.id.recycler_view)
to use recyclerviewaction, returned ambiguousviewmatcher telling me there more 1 recyclerview in hierarchy. how can specify particular recyclerview? assume need 'customrecyclerviewmatcher' of sort
ok! first needed give each view tag (see petey's answer how catch view tag espresso in android?)
i found oncreate , added:
recyclerview.settag(screentab.getid())
which enabled me set within test class (fyi i'm using kotlin)
private val tab1recyclerview = onview( allof( withid(r.id.recycler_view), withtagvalue(`is`(id.tab1)) ) )
so tests begin :
@test fun tab1test() { tab1recyclerview.perform(recyclerviewactions.actiononitematposition... etc }
wiki
Comments
Post a Comment