public static void assertViewVisibleOnScreen(View view) {
    onView(equalTo(view)).check(matches(isDisplayed()));
    assertViewAndAllItsParentsVisible(view);
  }
Asserts that the provided {@link View} is on the screen and is visible (which means its parent
and the parent of its parent and so forth are visible too).
javatests/com/google/android/apps/authenticator/testing/TestUtilities.java