android - Espresso - why is matchesSafely called twice for View Matchers? -


i had following function find particular view when multiple elements have same r.id:

enter image description here

which called doing:

onview(withindex(withid(r.id.design_menu_item_text), 2)).check(matches(withtext("logout"))) 

this approach fails saying no element @ index <2> found.

however, if use following approach instead, works:

enter image description here

debugging - looks though approach works because matchessafely function goes through views twice, , needs have return true both times in order work. since first approach fail on second loop through of views (the index no longer match in case), fails.

is correct - in goes through views twice? , if so, why espresso this?


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -