I want to assert the activity is finished after clicking a button. eg: if the user clicked button with id R.id.finish, then the activity is finished.
I'm trying to look up apis with ActivitySenerio and Espresso, but none of these helps.
Ref:
I want to assert the activity is finished after clicking a button. eg: if the user clicked button with id R.id.finish, then the activity is finished.
I'm trying to look up apis with ActivitySenerio and Espresso, but none of these helps.
Ref:
Without ActivitySenerio:
try {
onView(withId(R.id.finish)).perform(click());
} catch (Exception e) {
// assert the activity is finished
assertEquals(NoActivityResumedException.class, e.getClass());
}
With ActivitySenerio(Rule):
activity.findViewById(R.id.finish).performclick();
assertTrue(activity.isFinishing());