androidkotlinandroid-jetpackandroid-jetpack-compose

How to disable transition for testing Android Jetpack Compose?


According to the doc [Testing your Compose layout][1], we can disable transition as following:

@get:Rule
val composeTestRule = AndroidComposeTestRule<MyActivity>(disableTransitions = true)

However, there's no such parameter available in AndroidComposeTestRule. Testing with Snackbars is failing using SnackbarHost since it has animations. Is there a way to disable transitions?


Solution

  • According to review.googlesource.com, the parameter disableTransitions is not longer available in AndroidComposeTestRule. We can use DisableTransitionsTestRule to disable transitions.