Repository navigation
How can we do navaigation tests? (Unit and Integration) #43
Replies: 1 comment
|
For integration tests, host the real For an Android JUnit4 test, with your screens tagged using @get:Rule
val compose = createComposeRule()
@Test
fun detailsReturnsToHome() {
compose.setContent {
Navigator(HomeScreen)
}
compose.onNodeWithTag("open_details").performClick()
compose.onNodeWithTag("details_screen").assertIsDisplayed()
compose.onNodeWithTag("back_button").performClick()
compose.onNodeWithTag("home_screen").assertIsDisplayed()
}Here For unit tests, keep the navigation decision in your own presenter/ScreenModel or callback contract, and assert the requested destination/arguments for each input. Use the UI test above to verify that the request is connected to Voyager correctly. Add |
Uh oh!
There was an error while loading. Please reload this page.
Is there a way that we can easily test navigation?
All reactions