Skip to content

Instantly share code, notes, and snippets.

@zurche
Created July 17, 2023 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zurche/d1cee9bd3bbddfe756de64caed94510f to your computer and use it in GitHub Desktop.
Save zurche/d1cee9bd3bbddfe756de64caed94510f to your computer and use it in GitHub Desktop.
Full suite
class ClothingScreenTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun whenFavouriteIsTrueThenFilledHeartIconIsDisplayed() {
val isFavourite = true
composeTestRule.setContent {
ClothingAppTDDTheme {
FavouriteButton(isFavourite)
}
}
composeTestRule.onNodeWithContentDescription("Filled Heart Icon").assertIsDisplayed()
composeTestRule.onNodeWithContentDescription("Empty Heart Icon").assertDoesNotExist()
}
@Test
fun whenFavouriteIsFalseThenEmptyHeartIconIsDisplayed() {
val isFavourite = false
composeTestRule.setContent {
ClothingAppTDDTheme {
FavouriteButton(isFavourite)
}
}
composeTestRule.onNodeWithContentDescription("Empty Heart Icon").assertIsDisplayed()
composeTestRule.onNodeWithContentDescription("Filled Heart Icon").assertDoesNotExist()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment