I am learning about testing navigation in Jetpack Compose using this link:
https://developer.android.com/develop/ui/compose/navigation#testing-actions
When I use assertTrue
in the code below, it gives an error: “No type arguments expected for fun hasRoute(route: String, arguments: Bundle?): Boolean.”
@Serializable data class Profile(id: String)
@Test
fun appNavHost_clickAllProfiles_navigateToProfiles() {
composeTestRule.onNodeWithContentDescription("All Profiles")
.performScrollTo()
.performClick()
assertTrue(navController.currentBackStackEntry?.destination?.hasRoute<Profile>() ?: false)
}
I have updated the version of both the navigation testing library and the navigation compose library to the latest version (2.8.1), but I still get this error.
QuangTran is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.