Skip to content

Instantly share code, notes, and snippets.

@ferPrieto
Last active January 5, 2022 00:20
Show Gist options
  • Save ferPrieto/2e38b5381874e3a155aa1854164560b5 to your computer and use it in GitHub Desktop.
Save ferPrieto/2e38b5381874e3a155aa1854164560b5 to your computer and use it in GitHub Desktop.
This is a simplified demonstration of a UI Test in Isolation where only one of the tabs is initialised with the desired use case
@Test
@InternalCoroutinesApi
fun elementsVisibilityAfterTwoItemsRetrieved() {
composeTestRule.apply {
setContent {
SpaceXTheme {
LaunchesScreen(
state = LaunchesContract.State(
listOf(
LaunchUiModel(
"Mission1", "08-12-2021", true, "0", RocketUiModel(
"Rocket1", "Rocket Type1"
), LinksUiModel("", "", "Youtube Link")
),
LaunchUiModel(
"Mission2", "09-12-2021", false, "0", RocketUiModel(
"Rocket2", "Rocket Type2"
), LinksUiModel("", "WikiPedia Link", "Youtube Link")
)
), isLoading = false, isError = false
),
effectFlow = flow { emit(LaunchesContract.Effect.ClickableLink.None) } )
}
}
onNodeWithText("Mission1", useUnmergedTree = true)
.assertIsDisplayed()
onNodeWithText("Mission2", useUnmergedTree = true)
.assertIsDisplayed()
onAllNodesWithContentDescription(
"Item",
substring = true,
useUnmergedTree = true
).assertCountEquals(numItemsShowed)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment