androidx.test.espresso.contrib.NavigationViewActions Java Examples

The following examples show how to use androidx.test.espresso.contrib.NavigationViewActions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EspressoTest.java    From yubikit-android with Apache License 2.0 6 votes vote down vote up
@Test
public void smartcarddemo_nfc() throws Exception {

    //wait for completion, or timeout in ElapsedTimeIdlingResource(X) where X is in milliseconds
    ElapsedTimeIdlingResource iresLogRead = new ElapsedTimeIdlingResource(3000);

    //navigate to Smartcard Demo
    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.smartcard_fragment));

    IdlingRegistry.getInstance().register(iresLogRead);

    //Test pass if "signature is valid" is shown; otherwise, test fails.
    onView(withId(R.id.log))
            .check(matches(withSubstring("Signature is valid")));

    IdlingRegistry.getInstance().unregister(iresLogRead);
}
 
Example #2
Source File: PostTypeFormsTest.java    From indigenous-android with GNU General Public License v3.0 4 votes vote down vote up
@Test
public void testAllPostTypeForms() {
    openDrawer();

    // Article
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createArticle));
    onView(withId(R.id.body)).perform(replaceText("Hello!"));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
    onView(withText(R.string.confirm_close)).inRoot(isDialog()).check(matches(isDisplayed()));
    onView(withId(android.R.id.button1)).perform((click()));

    // Note
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createNote));
    onView(withId(R.id.body)).perform(replaceText("Hello!"));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
    onView(withText(R.string.confirm_close)).inRoot(isDialog()).check(matches(isDisplayed()));
    onView(withId(android.R.id.button1)).perform((click()));

    // Like
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createLike));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());

    // Reply
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createReply));
    onView(withId(R.id.body)).perform(replaceText("Hello!"));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
    onView(withText(R.string.confirm_close)).inRoot(isDialog()).check(matches(isDisplayed()));
    onView(withId(android.R.id.button1)).perform((click()));

    // Bookmark
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createBookmark));
    onView(withId(R.id.body)).perform(replaceText("Hello!"));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
    onView(withText(R.string.confirm_close)).inRoot(isDialog()).check(matches(isDisplayed()));
    onView(withId(android.R.id.button1)).perform((click()));

    // Repost
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createRepost));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());

    // Event
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createEvent));
    onView(withId(R.id.body)).perform(replaceText("Hello!"));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
    onView(withText(R.string.confirm_close)).inRoot(isDialog()).check(matches(isDisplayed()));
    onView(withId(android.R.id.button1)).perform((click()));

    // RSVP
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createRSVP));
    onView(withId(R.id.body)).perform(replaceText("Hello!"));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
    onView(withText(R.string.confirm_close)).inRoot(isDialog()).check(matches(isDisplayed()));
    onView(withId(android.R.id.button1)).perform((click()));

    // Issue
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createIssue));
    onView(withId(R.id.body)).perform(replaceText("Hello!"));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
    onView(withText(R.string.confirm_close)).inRoot(isDialog()).check(matches(isDisplayed()));
    onView(withId(android.R.id.button1)).perform((click()));

    // Checkin
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createCheckin));
    onView(withId(R.id.body)).perform(replaceText("Hello!"));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
    onView(withText(R.string.confirm_close)).inRoot(isDialog()).check(matches(isDisplayed()));
    onView(withId(android.R.id.button1)).perform((click()));

    // Geocache
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.createGeocache));
    onView(withId(R.id.body)).perform(replaceText("Hello!"));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
    onView(withText(R.string.confirm_close)).inRoot(isDialog()).check(matches(isDisplayed()));
    onView(withId(android.R.id.button1)).perform((click()));

    // Upload
    onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.nav_upload));
    onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());
}