This is a simplified demonstration of a UI Test in Isolation where only one of the tabs is initialised with the desired use case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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