Hi, why is recomposition not working in this Compo...
# compose
j
Hi, why is recomposition not working in this Compose UI test code?
Copy code
@get:Rule
val composeTestRule = createComposeRule()

@Test
fun test_recomposition() {
    var recomposed = false
    composeTestRule.setContent {
        Box {
            println("composed!")
            if (!recomposed) {
                recomposed = true
                currentRecomposeScope.invalidate() // <--- try recomposition here
            }
        }
    }
}
The “composed” log is displayed only once.
y
Maybe try doing some check after setContent that causes it to wait for it to idle.
Check the box is visible for example
j
Hi Yuri Schimke, thanks for the help! I’ll try to do as you say.