@Test public void listOfCitiesShows() { List<Show> testDataShows = TestDataFactory.makeCities(20); when(mComponent.getMockDataManager().getShows()) .thenReturn(Observable.just(testDataShows)); mCityListTestRule.launchActivity(null); int position = 0; for (Show show : testDataShows) { onView(withId(R.id.recycler_view)) .perform(RecyclerViewActions.scrollToPosition(position)); onView(withText(show.getName())) .check(matches(isDisplayed())); position++; } }
@Test public void onItemClicked_OpenContentScreen() throws Exception { FakeContentRepository.setFakeData(new ArrayList<>(Arrays.asList( createFakeContentItem(1), createFakeContentItem(2), createFakeContentItem(3), createFakeContentItem(4)))); createActivity(); onView(withId(R.id.recyclerContent)).check(matches(isDisplayed())); onView(withId(R.id.recyclerContent)).check(withItemCount(4)); onView(withId(R.id.progressBar)).check(matches(not(isDisplayed()))); onView(withId(R.id.textLoadingError)).check(matches(not(isDisplayed()))); // click on the first item in the list: onView(withId(R.id.recyclerContent)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); // content screen should be opened: onView(withId(R.id.textDescription)).check(matches(isDisplayed())); }
/** * Click a random set on the board */ @Test public void clickRandomSet() { // Pick a random valid SET SetGame.Triplet location = mSetGame.getRandomSet(); if (location != null) { int first = (int) location.getFirst(); int second = (int) location.getSecond(); int third = (int) location.getThird(); onView(withId(R.id.game_recycler_grid)) .perform(RecyclerViewActions .actionOnItemAtPosition(first, click())); onView(withId(R.id.game_recycler_grid)) .perform(RecyclerViewActions .actionOnItemAtPosition(second, click())); onView(withId(R.id.game_recycler_grid)) .perform(RecyclerViewActions .actionOnItemAtPosition(third, click())); } }
@Test public void clickOnFirstItem_opensComments() throws Throwable { drain(); // When clicking on the first product onView(ViewMatchers.withContentDescription(R.string.cd_products_list)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); drain(); // Then the second screen with the comments should appear. onView(withContentDescription(R.string.cd_comments_list)) .check(matches(isDisplayed())); drain(); // Then the second screen with the comments should appear. onView(withContentDescription(R.string.cd_product_name)) .check(matches(not(withText("")))); }
@Test public void rotate_LMHasItems_firstItemNotChanged() throws Exception { //arrange recyclerView.perform(RecyclerViewActions.scrollToPosition(18)); InstrumentalUtil.waitForIdle(); int expected = layoutManager.findFirstVisibleItemPosition(); //act rotateAndWaitIdle(); int actual = layoutManager.findFirstVisibleItemPosition(); //assert assertNotEquals(-1, expected); assertNotEquals(-1, actual); assertEquals("first visible positions before and after rotation doesn't match", expected, actual); System.out.println("first visible position = " + actual); resetToInitialAfterRotate(); }
@Test public void gapsNormalization_OnLastRowDeleted_PaddingStaySame() throws Exception { //arrange { items.remove(39); items.remove(38); items.remove(37); activity.runOnUiThread(() -> activity.initialize()); InstrumentalUtil.waitForIdle(); } recyclerView.perform(RecyclerViewActions.scrollToPosition(36)); //act recyclerView.perform(actionDelegate((uiController, recyclerView) -> items.remove(36)), notifyItemRemovedAction(36)); //assert recyclerView.check(matches(atPosition(29, rvPaddingMatcher()))); }
@Test public void scrollBy_LastItemInLastRowHasSmallSize_scrolledCompletelyToBiggestItemSize() throws Exception { //arrange { items.remove(39); items.remove(37); } activity.runOnUiThread(() -> activity.initialize()); InstrumentalUtil.waitForIdle(); //act recyclerView.perform(RecyclerViewActions.scrollToPosition(37), scrollBy(0, -200), scrollBy(0, 200)); //assert recyclerView.check(matches(atPosition(36, rvPaddingMatcher()))); }
@Test public void rotate_LMHasItems_firstItemNotChanged() throws Exception { //arrange recyclerView.perform(RecyclerViewActions.scrollToPosition(7)); InstrumentalUtil.waitForIdle(); int expected = layoutManager.findFirstVisibleItemPosition(); //act rotateAndWaitIdle(); int actual = layoutManager.findFirstVisibleItemPosition(); resetToInitialAfterRotate(); //assert assertNotEquals(-1, expected); assertNotEquals(-1, actual); assertEquals("first visible positions before and after rotation doesn't match", expected, actual); System.out.println("first visible position = " + actual); }
@Test public void listOfRibotsShows() { List<Ribot> testDataRibots = TestDataFactory.makeListRibots(20); when(component.getMockDataManager().getRibots()) .thenReturn(Observable.just(testDataRibots)); main.launchActivity(null); int position = 0; for (Ribot ribot : testDataRibots) { onView(withId(R.id.recycler_view)) .perform(RecyclerViewActions.scrollToPosition(position)); String name = String.format("%s %s", ribot.profile().name().first(), ribot.profile().name().last()); onView(withText(name)) .check(matches(isDisplayed())); onView(withText(ribot.profile().email())) .check(matches(isDisplayed())); position++; } }
@Test public void swipeOnEntry_ShowsDeletionDialog() { String newDiaryText1 = "I'm going to delete this entry"; String newDiaryText2 = newDiaryText1 + " - pt2"; String newDiaryText3 = newDiaryText1 + " - pt3"; String newDiaryText4 = newDiaryText1 + " - pt4"; String newDiaryText5 = newDiaryText1 + " - pt5"; // Click on the diary tab onView(withText(R.string.diary_tab_name)).perform(click()); // Add an entry addNewDiaryEntry(newDiaryText1, newDiaryText2, newDiaryText3, newDiaryText4, newDiaryText5); // Swipe the entry onView(withId(R.id.diary_view)) .perform(scrollTo(hasDescendant(withText(newDiaryText1)))) .perform(RecyclerViewActions.actionOnItemAtPosition(0, swipeLeft())); // Verify deletion dialog message is shown onView(withText(R.string.dialog_delete_diary_entry)).check(matches(isDisplayed())); // Delete it to clean up onView(withText(R.string.ok_delete_diary_entry)).perform(click()); }
@Test public void listOfRibotsShows() { List<Ribot> testDataRibots = TestDataFactory.makeListRibots(20); when(component.getMockDataManager().getRibots()) .thenReturn(Observable.just(testDataRibots)); main.launchActivity(null); int position = 0; for (Ribot ribot : testDataRibots) { onView(withId(R.id.recycler_view)) .perform(RecyclerViewActions.scrollToPosition(position)); String name = String.format("%s %s", ribot.profile.name.first, ribot.profile.name.last); onView(withText(name)) .check(matches(isDisplayed())); onView(withText(ribot.profile.email)) .check(matches(isDisplayed())); position++; } }
public void testCommentSegmentLoggedOut () { Boolean isLoggedIn = PreferenceManager.getDefaultSharedPreferences (activityOnTest.getBaseContext()).getBoolean("IsLoggedIn", false); if(isLoggedIn){ onView(withId(R.id.action_profile_logged)).perform(click()); onView(withText("Sair")).perform(click()); } closeSoftKeyboard(); onView(withText("Visitante")).perform(ViewActions.scrollTo()).perform(click()); onView(withId(R.id.recycler_view_open)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); onView(withId(R.id.recycler_viewBill)) .perform(RecyclerViewActions.actionOnItemAtPosition(2, click())); onView(withId(R.id.recycler_viewSegment)) .perform(RecyclerViewActions.actionOnItemAtPosition(1, click())); onView(withId(R.id.floatingButton)) .perform((click())); onView(withId(R.id.emailLoginField)).check(matches(isDisplayed())); }
public void testResultSearchExistWithInternet() { Boolean isLoggedIn = PreferenceManager.getDefaultSharedPreferences (activityOnTest.getBaseContext()).getBoolean("IsLoggedIn", false); if(isLoggedIn){ onView(withId(R.id.action_profile_logged)).perform(click()); onView(withText("Sair")).perform(click()); } closeSoftKeyboard(); onView(withText("Visitante")).perform(ViewActions.scrollTo()).perform(click()); onView(withId(R.id.action_search)).perform(click()); onView(isAssignableFrom(EditText.class)).perform(typeText("Gr"), pressKey(KeyEvent.KEYCODE_ENTER)); closeSoftKeyboard(); onView(withId(R.id.recycler_view_search)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); onView(withId(R.id.textViewTitleBill)).check(matches(isDisplayed())); }
public void testResultSearchExistWithoutInternet() { disabledInternet(); Boolean isLoggedIn = PreferenceManager.getDefaultSharedPreferences (activityOnTest.getBaseContext()).getBoolean("IsLoggedIn", false); if(isLoggedIn){ onView(withId(R.id.action_profile_logged)).perform(click()); onView(withText("Sair")).perform(click()); } closeSoftKeyboard(); onView(withText("Visitante")).perform(ViewActions.scrollTo()).perform(click()); onView(withId(R.id.action_search)).perform(click()); onView(isAssignableFrom(EditText.class)).perform(typeText("Gr"), pressKey(KeyEvent.KEYCODE_ENTER)); closeSoftKeyboard(); onView(withId(R.id.recycler_view_search)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); onView(withId(R.id.textViewTitleBill)).check(matches(isDisplayed())); }
public void testSuggestProposalLoggedOut(){ Boolean isLoggedIn = PreferenceManager.getDefaultSharedPreferences (activityOnTest.getBaseContext()).getBoolean("IsLoggedIn", false); if(isLoggedIn){ onView(withId(R.id.action_profile_logged)).perform(click()); onView(withText("Sair")).perform(click()); } closeSoftKeyboard(); onView(withText("Visitante")).perform(scrollTo()).perform(click()); onView(withId(R.id.recycler_view_open)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); onView(withId(R.id.recycler_viewBill)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); onView(withId(R.id.recycler_viewSegment)) .perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); onView(withId(R.id.floatingButton)) .perform((click())); onView(withId(R.id.emailLoginField)).check(matches(isDisplayed())); }
@Test public void shouldShowsListOfPhotos() { // Initialize: prepare test photos List<Photo> testPhotos = TestDataFactory.getRandomPhotos(); Context testContext = InstrumentationRegistry.getTargetContext(); DataManager mockedDataManager = FunctionalTestApp.get(testContext) .getComponent() .dataManager(); when(mockedDataManager.getPhotos()) .thenReturn(Observable.just(testPhotos)); // Run: launch MainActivity mainActivityTestRule.launchActivity(null); // Check: should show all photos int position = 0; for (Photo photo : testPhotos) { onView(withId(R.id.recycler_view)) .perform(RecyclerViewActions.scrollToPosition(position)); onView(withText(photo.getText())) .check(matches(isDisplayed())); position++; } }
@Test public void whenUserHitsDeviceBackButtonAndTheyDidNotMakeChangesToTheMacroMacroTheMacroChangesFoundDialogShouldNotBeCalled() { //launch the main activity Intent intent = new Intent(); mMainActivityActivityTestRule.launchActivity(intent); //Click the macro onView(withId(R.id.noteListRecyclerView)).perform( RecyclerViewActions.actionOnItemAtPosition(0, click())); //press the back button to get rid of keyboard pressBack(); //Press back again to go back pressBack(); //Validate that the the pop up that detects changes is not called onView(withText("Changes Found")).check(doesNotExist()); }
@Test public void whenUserHitsToolbarBackButtonAndTheyDidNotMakeChangesToTheMacroTheMacroChangesFoundDialogShouldNotBeCalled() { //launch the main activity Intent intent = new Intent(); mMainActivityActivityTestRule.launchActivity(intent); //Click the macro onView(withId(R.id.noteListRecyclerView)).perform( RecyclerViewActions.actionOnItemAtPosition(0, click())); //press the back button to get rid of keyboard onView(withContentDescription("Navigate up")).perform(click()); //Validate that the the pop up that detects changes is not called onView(withText("Changes Found")).check(doesNotExist()); }
@Test public void whenUserAddsDynamicValueToPhraseThePhraseShouldContainTheDynamicValueTheySelected(){ //Clear shared Prefs clearSharedPrefs(InstrumentationRegistry.getTargetContext()); //Set pref setBooleanPref(InstrumentationRegistry.getTargetContext(), "isDynamicValuesEnabled", true); //launch the main activity Intent intent = new Intent(); mActivityTestRule.launchActivity(intent); //Input text into the phrase field onView(withId(R.id.input_phrase)).perform(clearText(), typeText("Test Phrase")); //Click the dynamic value button onView(withId(R.id.dynamic_value_button)).perform(click()); //Click the first item in the recycler view onView(withId(R.id.dynamicValueRecyclerView)).perform( RecyclerViewActions.actionOnItemAtPosition(1, click())); //Validate the phrase now contains the dynamic value phrase for day of week onView(withId(R.id.input_phrase)).check(matches(withText("Test Phrase !date"))); }
@Test public void testStartSearching() { when(repository.searchRecipes(Mockito.<String, String>anyMap())) .thenReturn(Single.just(AssetUtils.getRecipeList(context))); when(repository.loadMore(Mockito.<String, String>anyMap())) .thenReturn(Single.just(AssetUtils.getMoreRecipeList(context))); when(repository.isInFavorites(Mockito.<Recipe>any())) .thenReturn(Single.just(true)); rule.launchActivity(new Intent()); performSearch(); onView(withText(firstRecipeTitle)).check(matches(isDisplayed())); onView(ViewMatchers.withId(R.id.rv_recipe_list)).perform(RecyclerViewActions.scrollToPosition(9)); onView(withText(lastRecipeTitle)).check(matches(isDisplayed())); // Scroll to top and click upon the first item Recipe recipe = AssetUtils.getRecipeEntity(InstrumentationRegistry.getContext()); onView(withId(R.id.rv_recipe_list)).perform(RecyclerViewActions.scrollToPosition(0)); onView(withText(recipe.getLabel())).perform(ViewActions.click()); onView(withId(R.id.tv_health_labels)).check(matches(isDisplayed())); onView(withId(R.id.iv_recipe_image)).check(matches(isDisplayed())); onView(withId(R.id.toolbar)).check(matches(isDisplayed())); }
@Test public void sendStreamMessage() { //Wait to make sure the messages are loaded sleep(2000); onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.scrollToHolder(withMessageHolderAndClick(MessageType.STREAM_MESSAGE, R.id.contentView))); sleep(1000); //Fill message EditText ViewInteraction messageInteraction = onView(allOf(withId(R.id.message_et), isDisplayed())); messageInteraction.perform(replaceText(testMessageStream)); //Click Send Button ViewInteraction imageView = onView(allOf(withId(R.id.send_btn), isDisplayed())); imageView.perform(click()); sleep(2000); //Scroll And check the new sent message onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.scrollToHolder(withMessageHolder(testMessageStream, R.id.contentView))); onView(AllOf.allOf(withId(R.id.contentView), withText(testMessageStream))).check(matches(isDisplayed())); checkIfMessagesMatchTheHeaderParent(); checkOrderOfMessagesCurrentList(); }
@Test public void checkAfterNarrowToStream() { sleep(2000); hideToolBar(); sleep(2000); //Scroll to Stream MessageHeaderParent onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.scrollToHolder(withMessageHeaderHolder(MessageType.STREAM_MESSAGE))); //Perform a click on the subject textView to narrow to the topic onView(withFirstId(R.id.instance)).perform(click()); sleep(4000); //Check if all messages belong to this subject onView(withId(R.id.recyclerView)).check(ViewAssertions.checkIfBelongToSameNarrow(mActivityTestRule.getActivity())); }
@Test public void sendPrivateMessage() { //Wait to make sure the messages are loaded sleep(2000); onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.scrollToHolder(withMessageHolderAndClick(MessageType.PRIVATE_MESSAGE, R.id.contentView))); sleep(1000); //Fill message EditText ViewInteraction messageInteraction = onView(allOf(withId(R.id.message_et), isDisplayed())); messageInteraction.perform(replaceText(testMessagePrivate)); //Click Send Button ViewInteraction imageView = onView(allOf(withId(R.id.send_btn), isDisplayed())); imageView.perform(click()); sleep(2000); //Scroll And check the new sent message onView(withId(R.id.recyclerView)).perform(RecyclerViewActions.scrollToHolder(withMessageHolder(testMessagePrivate, R.id.contentView))); onView(AllOf.allOf(withId(R.id.contentView), withText(testMessagePrivate))).check(matches(isDisplayed())); checkIfMessagesMatchTheHeaderParent(); checkOrderOfMessagesCurrentList(); }
public void testTapItem() { Intents.init(); addInitialData(); pause(); // DO UI INTERACTION onView(withId(R.id.recycler)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click ())); pause(); // Confirm that the TodoListActivity was started! intended(hasComponent(TodoListActivity.class.getName())); Intents.release(); }
@Test public void allCategoriesAreDisplayed() { stubVideoFeedData(); main.launchActivity(null); List<String> categoryList = getCategoriesArray(); for (int i = 0; i < categoryList.size(); i++) { // We don't need to click on the first item as it's already in focus if (i > 0) { onView(withId(R.id.browse_headers)) .perform(RecyclerViewActions.actionOnItemAtPosition(i, click())); } onView(withItemText(categoryList.get(i), R.id.browse_headers)) .check(matches(isDisplayed())); } }
@Test public void testOptionsDisplayAndAreBrowsable() { stubVideoFeedData(); main.launchActivity(null); List<String> categoryList = getCategoriesArray(); for (int i = 0; i < categoryList.size(); i++) { // We don't need to click on the first item as it's already in focus if (i > 0) { onView(withId(R.id.browse_headers)) .perform(RecyclerViewActions.actionOnItemAtPosition(i, click())); } } onView(withId(R.id.browse_headers)) .perform(RecyclerViewActions.actionOnItemAtPosition(categoryList.size() - 1, click())); onView(withItemText("Options", R.id.browse_container_dock)) .check(matches(isDisplayed())); onView(withItemText("Auto-loop", R.id.browse_container_dock)) .check(matches(isDisplayed())); }
@Test public void autoLoopGuidedStepOpens() { stubVideoFeedData(); main.launchActivity(null); List<String> categoryList = getCategoriesArray(); for (int i = 0; i < categoryList.size(); i++) { // We don't need to click on the first item as it's already in focus if (i > 0) { onView(withId(R.id.browse_headers)) .perform(RecyclerViewActions.actionOnItemAtPosition(i, click())); } } onView(withId(R.id.browse_headers)) .perform(RecyclerViewActions.actionOnItemAtPosition(categoryList.size() - 1, click())); onView(withItemText("Auto-loop", R.id.browse_container_dock)) .check(matches(isDisplayed())) .perform(click()); onView(withText(R.string.guided_step_auto_loop_title)) .check(matches(isDisplayed())); }
@Test public void checkInAtVenueSuccessful() { main.launchActivity(null); int venuePosition = 3; Venue venue = mVenues.get(venuePosition); CheckIn checkIn = MockModelFabric.newCheckInWithVenue(); checkIn.venue = venue; doReturn(Observable.just(checkIn)) .when(component.getMockDataManager()) .checkIn(CheckInRequest.fromVenue(venue.id)); onView(withId(R.id.recycler_view_venues)) .perform(RecyclerViewActions.actionOnItemAtPosition(venuePosition, click())); onView(allOf(withId(R.id.image_venue_tick), isDisplayed())) .check(matches(isDisplayed())); }
private void checkRibotDisplayOnRecyclerView(List<Ribot> ribotsToCheck) { for (int i = 0; i < ribotsToCheck.size(); i++) { onView(withId(R.id.recycler_view_team)) .perform(RecyclerViewActions.scrollToPosition(i)); Ribot ribot = ribotsToCheck.get(i); CheckIn checkIn = ribot.latestCheckIn; if (checkIn != null) { Encounter encounter = checkIn.latestBeaconEncounter; String expectedLocationName = encounter == null ? checkIn.getLocationName() : encounter.beacon.zone.label; onView(withText(expectedLocationName)) .check(matches(isDisplayed())); onView(withText(ribot.profile.name.first)) .check(matches(isDisplayed())); } } }
@Test public void checkingFields_WithPlatform() { Game game = GameBuilder.aGame() .withPlatform(PlatformBuilder.aPlatform().withImage(ImageBuilder.aImage().build()).build()) .withImage(ImageBuilder.aImage().build()) .build(); activityRule.launchActivity(GameActivity.newInstance(game)); onView(allOf(withId(R.id.textview_name), withParent(withId(R.id.linearlayout_header)))).check(matches(withText(game.getName()))); onView(allOf(withId(R.id.imageview_cover), hasSibling(withId(R.id.imageview_photo)))).check(matches(isDisplayed())); onView(allOf(withId(R.id.imageview_photo), hasSibling(withId(R.id.imageview_cover)))).check(matches(isDisplayed())); onView(withId(R.id.textview_noplatform)).check(matches(not(isDisplayed()))); onView(withId(R.id.recyclerview_platforms)).check(matches(isDisplayed())); onView(withId(R.id.recyclerview_platforms)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); }
@Test public void checkingFields_ScreenRotation() { String description = "A Game"; Game game = GameBuilder.aGame() .withDeck(description) .withPlatform(PlatformBuilder.aPlatform().withImage(ImageBuilder.aImage().build()).build()) .withImage(ImageBuilder.aImage().build()) .build(); activityRule.launchActivity(GameActivity.newInstance(game)); activityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); onView(allOf(withId(R.id.textview_name), withParent(withId(R.id.linearlayout_header)))).check(matches(withText(game.getName()))); onView(allOf(withId(R.id.imageview_cover), hasSibling(withId(R.id.imageview_photo)))).check(matches(isDisplayed())); onView(allOf(withId(R.id.imageview_photo), hasSibling(withId(R.id.imageview_cover)))).check(matches(isDisplayed())); onView(withId(R.id.textview_description)).check(matches(isDisplayed())); onView(withId(R.id.textview_description)).check(matches(withText(description))); onView(withId(R.id.textview_noplatform)).check(matches(not(isDisplayed()))); onView(withId(R.id.recyclerview_platforms)).check(matches(isDisplayed())); onView(withId(R.id.recyclerview_platforms)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); }
@Test public void selectAGame() { String description = "A Platform"; Platform platform = PlatformBuilder.aPlatform() .withDeck(description) .withImage(ImageBuilder.aImage().build()) .build(); activityRule.launchActivity(PlatformActivity.newInstance(platform)); try { Thread.sleep(10000); } catch (Exception ex) { ex.printStackTrace(); } onView(withId(R.id.recyclerview_games)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); onView(withId(R.id.ratingBar)).check(matches(isDisplayed())); onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click()); }
@Test public void selectingAGame() { onView(isAssignableFrom(EditText.class)) .perform(typeText(GameBuilder.DEFAULT_NAME), pressImeActionButton()); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } onView(withId(R.id.recyclerview_games)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); onView(withId(R.id.ratingBar)).check(matches(isDisplayed())); onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click()); }
@Test public void selectingAPlatform() { onView(isAssignableFrom(EditText.class)) .perform(typeText(PlatformBuilder.DEFAULT_NAME), pressImeActionButton()); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } onView(withId(R.id.recyclerview_platforms)).perform(RecyclerViewActions.actionOnItemAtPosition(0, click())); onView(withId(R.id.ratingBar)).check(matches(isDisplayed())); onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click()); }
@Test public void testViewAlert() { final HomePagerActivity activity = rule.getActivity(); activity.runOnUiThread(new Runnable() { @Override public void run() { activity.showPagerItem(HomePages.MEDICINES.ordinal()); } }); onView(withId(R.id.medicines_list)).perform( RecyclerViewActions.actionOnItemAtPosition(0, CustomViewActions.clickChildViewWithId(R.id.imageView))); TestUtils.sleep(400); onView(withId(R.id.rv)).check(matches(CustomViewMatchers.withRecyclerViewSize(1))); onView(withId(R.id.rv)).check(matches(drivingAlertRecyclerMatcher())); }
private void checkPostsDisplayOnRecyclerView(List<Post> postsToCheck) { for (int i = 0; i < postsToCheck.size(); i++) { onView(withId(R.id.recycler_stories)) .perform(RecyclerViewActions.scrollToPosition(i)); checkPostDisplays(postsToCheck.get(i)); } }
private void checkLocationsDisplayOnRecyclerView(List<PointOfInterest> charactersToCheck) { for (int i = 0; i < charactersToCheck.size(); i++) { onView(withId(R.id.recycler_places)) .perform(RecyclerViewActions.scrollToPosition(i)); checkLocationDisplays(charactersToCheck.get(i)); } }
@Test public void clickRecyclerViewItem_OpensDetailActivity() { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } onView(withId(R.id.recipe_recycler_view)) .perform(RecyclerViewActions.actionOnItem( hasDescendant(withText(RECIPE_NAME)), click())); matchToolbarTitle(RECIPE_NAME); }