Skip to content

Instantly share code, notes, and snippets.

@reactivedroid
Created July 30, 2019 13:13
Show Gist options
  • Save reactivedroid/ed947609a06ee6e550dfffce0decc560 to your computer and use it in GitHub Desktop.
Save reactivedroid/ed947609a06ee6e550dfffce0decc560 to your computer and use it in GitHub Desktop.
@LargeTest
@RunWith(AndroidJUnit4::class)
class HomeTest {
@get:Rule
val homeActivityTestRule = ActivityTestRule(HomeActivity::class.java)
private lateinit var loadingIdlingResource: LoadingIdlingResource
@Before
fun setUp() {
loadingIdlingResource =
LoadingIdlingResource(homeActivityTestRule.activity)
IdlingRegistry.getInstance().register(loadingIdlingResource)
}
@Test
fun testHomePageWithFavorites() {
launchHome {
verifyHome()
// Click on add to favorites icon
verifyFavorite()
// Verify that added to favorites toast is shown
verifyToast(homeActivityTestRule.activity)
verifyFavoriteScreen()
// Verify that pressing back from favorites goes to home
pressBack()
verifyHome()
}
}
@After
fun tearDown() {
IdlingRegistry.getInstance().unregister(loadingIdlingResource)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment