Skip to content

Instantly share code, notes, and snippets.

@Egorand
Created July 17, 2016 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Egorand/13d7e83431349cea37fb9d7a8836a5c1 to your computer and use it in GitHub Desktop.
Save Egorand/13d7e83431349cea37fb9d7a8836a5c1 to your computer and use it in GitHub Desktop.
android-testing-runtime-permissions-should-display-long-rationale
@Test
public void c_shouldDisplayLongRationaleIfPermissionWasDeniedPermanently() throws Exception {
denyCurrentPermissionPermanently(device);
onView(withText(R.string.permission_denied_rationale_long)).check(matches(isDisplayed()));
onView(withText(R.string.grant_permission)).check(matches(isDisplayed()));
// will grant the permission for the next test
onView(withText(R.string.grant_permission)).perform(click());
openPermissions(device);
grantPermission(device, "Contacts");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment