Skip to content

Instantly share code, notes, and snippets.

@mcatta
Created October 4, 2021 20:58
Show Gist options
  • Select an option

  • Save mcatta/85e649398b28ed4d7a06b68e0ca88c08 to your computer and use it in GitHub Desktop.

Select an option

Save mcatta/85e649398b28ed4d7a06b68e0ca88c08 to your computer and use it in GitHub Desktop.
UI testing with robot pattern
@HiltAndroidTest
internal class RepositoriesListingTest: BaseAndroidComposeTest() {
override fun provideTestInstance() = this
@Test
fun testConfirmButtonBehaviour() {
welcomeRobotScreen {
isConfirmEnabled(false)
typeUsername("mcatta")
isConfirmEnabled(true)
typeUsername("")
isConfirmEnabled(false)
typeUsername("mcatta")
}
}
@Test
fun testRepositoriesListing() {
coEvery { githubRepository.repositoriesByName(any()) } returns listOf(
TestUtils.fakeRepo(), TestUtils.fakeRepo()
)
welcomeRobotScreen {
typeUsername("mcatta")
isConfirmEnabled(true)
} confirmUsername {
countRepositories(2)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment