android.support.test.espresso.contrib.DrawerActions Java Examples

The following examples show how to use android.support.test.espresso.contrib.DrawerActions. 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: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 6 votes vote down vote up
/**
 * Check if the username, password and userAvatar are visible and verify when click on
 * userAvatar UserProfileActivity will open
 */
@Test
public void checkAllViewsVisible_and_OnClickAvatar_openUserProfileActivity() throws Exception {

    Intents.init();
    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    //Please Login first otherwise it will not find username and email
    onView(withId(R.id.nav_user_avatar)).check(matches((isDisplayed())));
    onView(withId(R.id.nav_user_name)).check(matches((isDisplayed())));
    onView(withId(R.id.nav_user_email)).check(matches((isDisplayed())));

    onView(withId(R.id.nav_user_avatar)).perform(click());

    intended(hasComponent(UserProfileActivity.class.getName()));
    Intents.release();
}
 
Example #2
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if the usage activity is launched when we click on usage in nav drawer
 */
@Test
public void onClickNavUsage_openUsageActivity() throws Exception {

    Intents.init();

    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.nav_usage));

    intended(hasComponent(UsageActivity.class.getName()));

    Intents.release();
}
 
Example #3
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if the login is launched when click on logout in nav drawer and click on
 * sign out in alert dialouge box
 */
@Test
public void onClickLogout_ClickSignOut_OpenLoginScreen() throws Exception {

    Intents.init();
    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.nav_logout));

    onView(withId(android.R.id.button1)).perform(click());

    intended(hasComponent(LoginActivity.class.getName()));

    Intents.release();
}
 
Example #4
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if alert dialogue box is dismiss when click on cancel in logout alert sign in box
 */
@Test
public void onClickLogout_clickCancel_dismissDialogueBoz() throws Exception {

    Intents.init();
    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.nav_logout));

    onView(withId(android.R.id.button2)).perform(click());

    onView(withId(R.id.drawer_layout))
            .check(matches(isOpen(Gravity.LEFT)));

    Intents.release();
}
 
Example #5
Source File: AppNavigationTest.java    From Awesome-WanAndroid with Apache License 2.0 5 votes vote down vote up
private void openNavigationItem(@IdRes int itemId) {
    onView(withId(R.id.drawer_layout))
            .check(matches(DrawerMatchers.isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(itemId));
}
 
Example #6
Source File: AppNavigationTest.java    From Awesome-WanAndroid with Apache License 2.0 5 votes vote down vote up
private void openLoginPage() {
    onView(withId(R.id.drawer_layout))
            .check(matches(DrawerMatchers.isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    clickView(R.id.nav_header_login_tv);
}
 
Example #7
Source File: BaseADFTest.java    From aws-device-farm-sample-app-for-android with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the activity and navigates to the Class's category in the navigation drawer
 *
 * Uses espresso-contrib dor navigation drawer and recyclerView support
 *
 * @throws Exception instrumentation ActivityInstrumentationTestCase2 exception
 */
@Override
protected void setUp() throws Exception {
    getActivity(); //IMPORTANT you must call this before your tests!
    super.setUp();
    DrawerActions.openDrawer(R.id.drawer_layout);
    RecyclerViewActions.scrollTo(withText(getClassName()));
    onView(withId(R.id.drawerList)).perform(RecyclerViewActions.actionOnItem(hasDescendant(withText(getClassName())), click()));
    InstrumentationRegistry.getInstrumentation().waitForIdleSync();
}
 
Example #8
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if the Workflow fragment is launched when we click on Workflow in nav drawer
 */
@Test
public void onClickNavAllWorkflows_openWorkflowsFragment() throws Exception {

    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.nav_workflows));

    onView(withId(R.id.frame_container)).check(matches((isDisplayed())));

}
 
Example #9
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if the myWorkflow fragment is launched when we click on myWorkflow in nav drawer.
 * Without login, The app does not have any user then it also does not have any myworkflow
 * Without login it will fail
 */
@Test
public void onClickNavMyWorkflows_openMyWorkflowActivity() throws Exception {

    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.nav_my_workflows));

    onView(withId(R.id.frame_container)).check(matches((isDisplayed())));

}
 
Example #10
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if the About dialouge is launched when we click on about in nav drawer
 */
@Test
public void onClickNavAbout_checkAboutDialogue() throws Exception {

    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.nav_about));

    onView(withId(R.id.about_dialouge_layout)).check(matches((isDisplayed())));

}
 
Example #11
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if the Licence dialouge is launched when we click on licence in nav drawer
 */
@Test
public void onClickNavLicence_openLicenceDialouge() throws Exception {

    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.os_licences));

    onView(withText(R.string.title_nav_os_licences)).check(matches(isDisplayed()));

}
 
Example #12
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if the Licence dialogue is launched when we click on licence in nav drawer
 */
@Test
public void onClickNavApacheLicence_openApacheLicence_NoticeDialouge() throws Exception {

    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.apache_licences));

    onView(withText(R.string.title_nav_apache_licences)).check(matches(isDisplayed()));

}
 
Example #13
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 5 votes vote down vote up
/**
 * Checks if the setting fragment is launched
 * when we click on settings in navigation drawer
 */
@Test
public void onClickNavSetting_openSettingFragment() throws Exception {

    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.nav_settings));

    onView(withId(R.id.frame_container)).check(matches((isDisplayed())));

}
 
Example #14
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 4 votes vote down vote up
/**
 * Checks if the favoriteWorkflow fragment is launched when we click on
 * favoriteWorkflow in nav drawer
 */
@Test
public void onClickNavFavWorkflows_openFavoriteWorkflowActivity() throws Exception {

    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.nav_favourite_workflow));

    sleep(3000);

    onView(withId(R.id.frame_container)).check(matches((isDisplayed())));

}
 
Example #15
Source File: DashboardActivityTest.java    From incubator-taverna-mobile with Apache License 2.0 4 votes vote down vote up
/**
 * Checks if the Announcement fragment is launched when we click on
 * announcement in nav drawer
 */
@Test
public void onClickNavAnnouncement_openAnnouncementActivity() throws Exception {

    onView(withId(R.id.drawer_layout))
            .check(matches(isClosed(Gravity.LEFT)))
            .perform(DrawerActions.open());

    onView(withId(R.id.nav_view))
            .perform(NavigationViewActions.navigateTo(R.id.nav_announcement));

    sleep(3000);

    onView(withId(R.id.frame_container)).check(matches((isDisplayed())));

}