Skip to content

Instantly share code, notes, and snippets.

@parthdesai1208
Created April 4, 2022 07:20
Show Gist options
  • Save parthdesai1208/fe289fd0b12e56be66b2137092bd1394 to your computer and use it in GitHub Desktop.
Save parthdesai1208/fe289fd0b12e56be66b2137092bd1394 to your computer and use it in GitHub Desktop.
Compose testing
******************************************************************************************************************************************
ex-1
statement = here, we want to test that, from 3 tabs, whatever value is set for current screen so according that same tab should selected.
******************************************************************************************************************************************
passed case)
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun rallyTopAppBarTest() {
val allScreens = RallyScreen.values().toList()
composeTestRule.setContent {
RallyTopAppBar(
allScreens = allScreens,
onTabSelected = { /*TODO*/ },
currentScreen = RallyScreen.Accounts
)
}
composeTestRule.onNodeWithContentDescription(RallyScreen.Accounts.name) //pass Bill instead of Accounts for "failed" case
.assertIsSelected()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment