コード例 #1
0
 private void overFlowItemsCheck(
     int firstActivityName, int secondActivityName, int thirdActivityName) {
   openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getTargetContext());
   onView(withText(firstActivityName)).check(ViewAssertions.matches(isDisplayed()));
   onView(withText(secondActivityName)).check(ViewAssertions.matches(isDisplayed()));
   onView(withText(thirdActivityName)).check(ViewAssertions.matches(isDisplayed()));
 }
コード例 #2
0
  public void testOverflowMenuOrOptionsMenu() {
    // Open the action bar overflow or options menu (depending if the device has or not a hardware
    // menu button.)
    //        openActionBarOverflowOrOptionsMenu(getInstrumentation().getContext());
    openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getTargetContext());

    // Find the menu item with text "About" and click on it
    onView(withText("Settings")).perform(click());

    // Verify the correct item was clicked by checking the content of the status TextView
    onView(withId(R.id.action_settings)).check(matches(withText("Settings")));
  }
コード例 #3
0
 @Test
 public void openMenu() {
   /* Open ActionBar Menu*/
   openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
   onView(withText("Settings")).perform(click());
 }
コード例 #4
0
 public void testClickOnMenuItem() {
   // Click on an item from ActionBar
   openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getTargetContext());
   //        onView(withId(R.id.action_settings)).perform(click());
   onView(withText(R.string.action_settings)).perform(click());
 }
コード例 #5
0
ファイル: AddNoteScreenTest.java プロジェクト: rmm01/step-1-5
  /** Convenience method which opens the options menu and select the take image option. */
  private void selectTakeImageFromMenu() {
    openActionBarOverflowOrOptionsMenu(getTargetContext());

    // Click on add picture option
    onView(withText(R.string.take_picture)).perform(click());
  }