Skip to content

Instantly share code, notes, and snippets.

@heitorcolangelo
Last active September 9, 2016 02:16
Show Gist options
  • Save heitorcolangelo/47601a09fd3082cc1b40c36d28aad2be to your computer and use it in GitHub Desktop.
Save heitorcolangelo/47601a09fd3082cc1b40c36d28aad2be to your computer and use it in GitHub Desktop.
UserDetailsActivityTest - test with permission
@Test
public void clickOnPhone_shouldStartPhoneIntent() throws IOException {
mActivityRule.launchActivity(createIntent(false));
Intents.init();
intending(hasAction(Intent.ACTION_CALL))
.respondWith(new Instrumentation.ActivityResult(Activity.RESULT_OK, new Intent()));
onView(withId(R.id.user_details_phone)).perform(scrollTo(), click());
PermissionUtils.allowPermissionsIfNeeded(Manifest.permission.CALL_PHONE);
intended(hasAction(Intent.ACTION_CALL));
Intents.release();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment