@Test public void testTemplateConstructor() { espDrawer = new EspDrawer(espDrawer); espDrawer.open(); espDrawer.assertIsDisplayedOnScreen(); }
@Test public void testDrawer() { espDrawer.assertIsHidden(); espDrawer.open(); espDrawer.assertIsDisplayedOnScreen(); espDrawer.close(); espDrawer.assertIsHidden(); }
/** * Create new instance matching an element with given resources. * * @param drawerLayout Identifier for base drawer layout. * @param drawerContent Identifier for base layout with drawer content. * * @return New instance for actions and assertions. * * @since Espresso Macchiato 0.1 */ public static EspDrawer byId(int drawerLayout, int drawerContent) { return new EspDrawer(drawerLayout, drawerContent); }
@Test public void testNavigationMenuItemByText() { addNavigationMenuItem(); espDrawer.open(); espDrawer.navigationMenuItem(navigationItemTitleStandard).assertIsDisplayedOnScreen(); }
@Test public void testCompareDifferentPictures() { EspScreenshotTool.takeWithName("testCompareDifferentPictures"); EspDrawer.byId(NavigationDrawerActivity.drawerLayout, NavigationDrawerActivity.drawerNavigationView).open(); EspScreenshotTool.takeWithName("testCompareDifferentPictures2"); double percentage = EspScreenshotTool.comparePercentage( new EspScreenshotTool().obtainScreenshotDirectory() + "/testCompareDifferentPictures.png", new EspScreenshotTool().obtainScreenshotDirectory() + "/testCompareDifferentPictures2.png"); assertEquals(88.0, percentage, EspScreenshotTool.COMPARE_DELTA_TIME_CHANGE + DELTA_FOR_DIFFERENT_DEVICES); }
/** * Close the drawer. * * @since Espresso Macchiato 0.1 */ public void close() { findDrawerLayout().perform(ViewActions.actionWithAssertions(new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER_RIGHT, GeneralLocation.CENTER_LEFT, Press.FINGER))); }
@Test public void testClickStandard() { espTextViewClickFeedback.assertTextIs(initialClickFeedbackText); espDrawer.open(); espNavigationMenuItemStandard.assertIsNotSelected(); espNavigationMenuItemStandard.click(); espNavigationMenuItemStandard.assertIsSelected(); espTextViewClickFeedback.assertTextIs(navigationItemTitleStandard); }
@Test @SuppressWarnings("deprecation") public void testByIdObsolete() { exception.expect(UnsupportedOperationException.class); EspDrawer.byId(0); }
/** * Open the drawer. * * @since Espresso Macchiato 0.1 */ public void open() { findDrawerLayout().perform(ViewActions.actionWithAssertions(new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER_LEFT, GeneralLocation.CENTER_RIGHT, Press.FINGER))); }
@Test public void testClickCustomActionView() { espTextViewClickFeedback.assertTextIs(initialClickFeedbackText); espDrawer.open(); espNavigationMenuItemCustomActionView.assertIsNotSelected(); espNavigationMenuItemCustomActionView.click(); espNavigationMenuItemCustomActionView.assertIsSelected(); espTextViewClickFeedback.assertTextIs(navigationItemTitleCustomActionView); }