示例#1
0
  @Test
  public void testTellAFriend() {
    openDrawer(R.id.drawer_layout);
    Intents.intending(
            AllOf.allOf(
                hasAction(Intent.ACTION_CHOOSER),
                hasExtra(Intent.EXTRA_TITLE, mActivity.getString(R.string.share_via))))
        .respondWith(new Instrumentation.ActivityResult(Activity.RESULT_OK, null));

    onView(
            allOf(
                is(instanceOf(NavigationMenuItemView.class)),
                withText(R.string.action_tellafriend)))
        .perform(click());
    intended(
        allOf(
            hasAction(Intent.ACTION_CHOOSER),
            hasExtra(Intent.EXTRA_TITLE, mActivity.getString(R.string.share_via))));
  }
 /**
  * Given a user that has logged in, when the StartGameButton is pressed the next activity,
  * JoinGameActivity, is started.
  */
 @Test
 public void testJoinGameButton() {
   onView(withId(R.id.button2)).check(matches(isClickable()));
   onView(withId(R.id.button2)).perform(click());
   intended(hasComponent(JoinGameActivity.class.getName()));
 }