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
Post a Comment