Skip to content

Instantly share code, notes, and snippets.

@cdmunoz
Created May 17, 2020 21:57
Show Gist options
  • Save cdmunoz/0396fb111bad72820de9dba5d1084fb6 to your computer and use it in GitHub Desktop.
Save cdmunoz/0396fb111bad72820de9dba5d1084fb6 to your computer and use it in GitHub Desktop.
Espresso IdleResource UI Test
@LargeTest
@RunWith(AndroidJUnit4::class)
class HomeFragmentUITest {
@get:Rule
val activityTestRule = ActivityScenarioRule(MainActivity::class.java)
@Before
fun setUp() {
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
}
@After
fun tearDown() {
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
}
@Test
fun initial_state_home_screen_UI_test() {
activityTestRule.scenario.moveToState(Lifecycle.State.RESUMED)
onView(withId(R.id.home_photos_progress_container)).check(matches(not(isDisplayed())))
onView(withId(R.id.home_photos_list)).check(matches(isDisplayed()))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment