theapache64
02/04/2022, 6:34 AMComposeTestRule#advanceTimeBy
method. It doesn’t work as expected with animations.
▶️ Here’s more details : https://stackoverflow.com/questions/70982285/compose-advancetimeby-doesnt-work-with-animation.Doris Liu
02/05/2022, 4:50 AMAnimatedVisibility
were never added to the Transition, because measure() was not called and slide animation is initialized during measure. As a result, we ended up having an empty Transition that finished right away. That's why the test failed.
Note that adding advanceTimeByFrame()
before advanceTimeBy(1500)
seems to allow the test to pass. This might be useful for narrowing down the cause. Could you file a bug please?theapache64
02/05/2022, 5:22 AMRohil Chodankar
05/09/2022, 4:55 PMrule.onNodeWithText("title").assertDoesNotExist()
rule.mainClock.autoAdvance = false
rule.runOnUiThread { expanded = true }
rule.mainClock.advanceTimeByFrame() // Trigger the popup
rule.waitForIdle()
rule.mainClock.advanceTimeByFrame() // Kick off the animation
rule.mainClock.advanceTimeBy(InTransitionDuration.toLong())
rule.onNodeWithText("title").assertExists()
the code assertExists() doesn't complete and the test hangs on that step. We run the test as instrumentation and unit test using Robolectric. The instrumentation test seems to get executed but facing problem with running as unit test.
Any thoughts ?
@Doris Liu @theapache64Doris Liu
05/09/2022, 6:41 PMInTransitionDuration
, to double check it's within reasonable range and isn't nano-second based.
2. Did this work before 1.1.1?Rohil Chodankar
05/09/2022, 6:46 PMInTransitionDuration
to 120, thats the same to the duration of the animation.
2. Yes, it worked with compose version 1.0.5 (currently used version). But as we were trying to migrate to 1.1.0 or 1.1.1, it fails on both versionDoris Liu
05/09/2022, 6:46 PMRohil Chodankar
05/09/2022, 6:50 PMDoris Liu
05/09/2022, 7:11 PMBryan Herbst
05/10/2022, 2:05 PMRobolectricIdlingStrategy.runUntilIdle()
is not finishing in our assertExists()