android - Espresso - Difference between not(isDisplayed()) vs doesNotExist() -


i reading todoapp android architectural blueprints when came across these 2 tests. cant seem understand why necessary use doesnotexist() in createtwotasks_deleteonetask(), check item specified title deleted, when totally okay use not(isdisplayed()) in createonetask_deletetask() checking same thing?

@test public void createonetask_deletetask() {     viewalltasks();      // add active task     createtask(title1, description);      // open in details view     onview(withtext(title1)).perform(click());      // click delete task in menu     onview(withid(r.id.menu_delete)).perform(click());      // verify deleted     viewalltasks();     onview(withtext(title1)).check(matches(not(isdisplayed()))); }  @test public void createtwotasks_deleteonetask() {     // add 2 active tasks     createtask(title1, description);     createtask(title2, description);      // open second task in details view     onview(withtext(title2)).perform(click());      // click delete task in menu     onview(withid(r.id.menu_delete)).perform(click());      // verify 1 task deleted     viewalltasks();     onview(withtext(title1)).check(matches(isdisplayed()));     onview(withtext(title2)).check(doesnotexist()); } 

i new in espresso testing know doesnotexist() called confirm view gone why not(isdisplayed()) working fine when view has been removed? tried use doesnotexist() throws error.

android.support.test.espresso.base.defaultfailurehandler$assertionfailedwithcauseerror: view present in hierarchy: appcompattextview{id=2131624010, res-name=title, visibility=visible, width=1120, height=107, 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, root-is-layout-requested=false, has-input-connection=false, x=256.0, y=74.0, text=title1, input-type=0, ime-target=false, has-links=false} expected: <false> got: <true>  @ dalvik.system.vmstack.getthreadstacktrace(native method) @ java.lang.thread.getstacktrace(thread.java:580) @ android.support.test.espresso.base.defaultfailurehandler.getuserfriendlyerror(defaultfailurehandler.java:92) @ android.support.test.espresso.base.defaultfailurehandler.handle(defaultfailurehandler.java:56) @ android.support.test.espresso.viewinteraction.runsynchronouslyonuithread(viewinteraction.java:184) @ android.support.test.espresso.viewinteraction.check(viewinteraction.java:158) @ com.example.android.architecture.blueprints.todoapp.tasks.tasksscreentest.createonetask_deletetask(tasksscreentest.java:284) @ java.lang.reflect.method.invoke(native method) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:50) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:12) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:47) @ org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:17) @ android.support.test.internal.statement.uithreadstatement.evaluate(uithreadstatement.java:55) @ android.support.test.rule.activitytestrule$activitystatement.evaluate(activitytestrule.java:270) @ org.junit.rules.runrules.evaluate(runrules.java:20) @ org.junit.runners.parentrunner.runleaf(parentrunner.java:325) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:78) @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:57) @ org.junit.runners.parentrunner$3.run(parentrunner.java:290) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:288) @ org.junit.runners.parentrunner.access$000(parentrunner.java:58) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) @ org.junit.runners.parentrunner.run(parentrunner.java:363) @ org.junit.runners.suite.runchild(suite.java:128) @ org.junit.runners.suite.runchild(suite.java:27) @ org.junit.runners.parentrunner$3.run(parentrunner.java:290) @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:71) @ org.junit.runners.parentrunner.runchildren(parentrunner.java:288) @ org.junit.runners.parentrunner.access$000(parentrunner.java:58) @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:268) @ org.junit.runners.parentrunner.run(parentrunner.java:363) @ org.junit.runner.junitcore.run(junitcore.java:137) @ org.junit.runner.junitcore.run(junitcore.java:115) @ android.support.test.internal.runner.testexecutor.execute(testexecutor.java:59) @ android.support.test.runner.androidjunitrunner.onstart(androidjunitrunner.java:262) @ android.app.instrumentation$instrumentationthread.run(instrumentation.java:1959) caused by: junit.framework.assertionfailederror: view present in hierarchy: appcompattextview{id=2131624010, res-name=title, visibility=visible, width=1120, height=107, 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, root-is-layout-requested=false, has-input-connection=false, x=256.0, y=74.0, text=title1, input-type=0, ime-target=false, has-links=false} expected: <false> got: <true>  @ android.support.test.espresso.matcher.viewmatchers.assertthat(viewmatchers.java:1053) @ android.support.test.espresso.assertion.viewassertions$1.check(viewassertions.java:62) @ android.support.test.espresso.viewinteraction$2.run(viewinteraction.java:170) @ java.util.concurrent.executors$runnableadapter.call(executors.java:423) @ java.util.concurrent.futuretask.run(futuretask.java:237) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:158) @ android.app.activitythread.main(activitythread.java:7224) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1230) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1120) 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -