Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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