Hey guys. I have a question about Compose testing....
# compose
f
Hey guys. I have a question about Compose testing. My test has a
LaunchedEffect
which will change a state after a delay and trigger a recomposition. I want to wait for the end of the consequent recomposition and then do some assertions. How can I achieve the waiting?
waitForIdle
doesn’t work.
a
Have you tried
rule.mainClock.advanceTimeBy()
?
f
I've tried
waitUntil
to wait for the state changing. And I known the recomposition happens after that. If I use
advanceTimeBy
after the
waitUntil
. What's the appropriate time for it, so I can reach the end of the recomposition?
a
waitUntil
/
mainClock.advanceTimeUntil()
should also work if you know the condition.