android-junit5
android-junit5 copied to clipboard
Compose Extension doesn't execute inside a test
class ExampleInstrumentedTest {
@JvmField
@RegisterExtension
@ExperimentalTestApi
val extension = createComposeExtension()
@OptIn(ExperimentalTestApi::class)
@Test
fun test() {
extension.use {
setContent {
MainScreen()
}
onNodeWithTag(SCREEN_A_TEST_TAG).assertTextEquals("false")
println("should be here")
}
println("but instead I am here")
}
}
In the above, inside test(), the code inside extension.use never executes. I know that because I do not see the print statement I put inside the code block ("should be here"). However, I do see "but instead I am here" which means extension.use was never executed. I am not sure if I am doing something wrong. I am simply following the comment here: https://github.com/mannodermaus/android-junit5/issues/234#issuecomment-1551463208