compose-destinations
compose-destinations copied to clipboard
Documentation on how to do navigation testing in compose-destinations
I don't know if this is meant for this, but I'm having a problem with the testing with Espresso. I'm in the login page and I want to introduce the credentials and navigate to the next screen, but I haven't found a proper way to do it with the classes that the library offer. Maybe I'm missing something?
I want to do something like this:
composeTestRule.setContent {
SobuuTheme {
LoginScreen(nav = EmptyDestinationsNavigator)
}
}
composeTestRule.onNodeWithTag("Username").performTextInput("username")
composeTestRule.onNodeWithTag("Password").performTextInput("pass123")
composeTestRule.onNodeWithTag("LoginButton").performClick()
composeTestRule.waitUntil(timeoutMillis = 10000) {
composeTestRule
.onAllNodesWithTag("SearchField")
.fetchSemanticsNodes().size == 1
}
But with the empty destinations navigator it doesn't work. Would be possible to get a testing navigator with all the graph? Or maybe there is already a not documented way to do it?
Documentation around testing is coming on v2!.