Android espresso multiple test paths -


how have if/else path in tests

for example

when dialog present dismiss , continue

vs

when it's not present continue nonetheless

what need isvisible(int id), implementation of this:

public boolean isvisible(int elementid) {         try {             onview(withid(elementid)).check(matches(isdisplayed()));             return true;         } catch (throwable t) {             return false;         }     } 

you check dialog in test this:

if(isvisible(r.id.dialogid)) {     onview(withtext("ok")).perform(click()); // dismiss dialog clicking 'ok' button     // whatever want after } 

this should take care of problem.


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -