Android Espresso: How do I assert that a view should not be displayed -


this seem correct...

onview (withid (r.id.menu_delete)).check (matches (not (isdisplayed ()))); 

...but throws exception:

android.support.test.espresso.nomatchingviewexception: no views in hierarchy found matching: id: com.just10.android:id/menu_delete if target view not part of view hierarchy, may need use espresso.ondata load 1 of following adapterviews:com.github.ksoichiro.android.observablescrollview.observablelistview{3169f0f3 vfed.vc. .f...... 0,0-480,724 #102000a android:id/list} 

what's best way assert view should not displayed?

what should have used this:

onview (withid(r.id.menu_delete)).check (doesnotexist ()); 

this maybe particular fact view in options menu , may or may not exist @ given time, depending on implementation in oncreateoptionsmenu , onprepareoptionsmenu

edit

this method worked me non-menu views:

onview (withid(r.id.menu_delete))  .check(matches(witheffectivevisibility(viewmatchers.visibility.gone))); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -