Android Testing UI with Espresso suggest change

Up Navigation

@Test
public void testUpNavigation() {
    intending(hasComponent(ParentActivity.class.getName())).respondWith(new Instrumentation.ActivityResult(0, null));

    onView(withContentDescription("Navigate up")).perform(click());

    intended(hasComponent(ParentActivity.class.getName()));
}

Note that this is a workaround and will collide with other Views that have the same content description.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents