use of com.karumi.rosie.sample.idlingresources.ViewPagerIdlingResource in project Rosie by Karumi.
the class MainActivityTest method shouldOpenComicSeriesDetailActivityOnRecyclerViewItemClicked.
@Test
public void shouldOpenComicSeriesDetailActivityOnRecyclerViewItemClicked() throws Exception {
givenThereAreSomeCharacters(ANY_NUMBER_OF_CHARACTERS);
List<ComicSeries> comicSeries = givenThereAreSomeComicSeries(ANY_NUMBER_OF_COMIC_SERIES);
givenAnyComicSeriesDetail();
int comicSeriesIndex = 0;
Activity activity = startActivity();
registerIdlingResources(new ViewPagerIdlingResource((ViewPager) activity.findViewById(R.id.vp_main)));
onView(withId(R.id.vp_main)).perform(swipeLeft());
onView(withId(R.id.rv_comics)).perform(RecyclerViewActions.actionOnItemAtPosition(comicSeriesIndex, click()));
ComicSeries comicSeriesSelected = comicSeries.get(comicSeriesIndex);
intended(hasComponent(ComicSeriesDetailsActivity.class.getCanonicalName()));
intended(hasExtra("ComicSeriesDetailsActivity.ComicSeriesKey", comicSeriesSelected.getKey().intValue()));
}
Aggregations