Hello, We are using `Paparazzi` for snapshot test...
# compose
n
Hello, We are using
Paparazzi
for snapshot testing but components that use animation are captured as empty. We tried to use
InstantAnimationsRule
but it still doesn’t work. Is there any way to use Paparazzi with animated components?
Copy code
...
@get:Rule
val snapshotTesting = snapshotTestingRule()

@get:Rule
val instantAnimationsRule = InstantAnimationsRule()

protected fun snapshot(
    name: String? = null,
    content: @Composable () -> Unit
) {
    snapshotTesting.unsafeUpdateConfig(
        deviceConfig = TRDevices.Pixel5.copy(screenHeight = 1, softButtons = false)
    )
    snapshotTesting.snapshot(name = name) { ThemedContent { content() } }
...
a
I had same issue. We ended up turning them off using a composition local. But that requires all components knowing about it and handling it
n
Does it work for
animateContentSize
modifier, as well?
a
Yeah I just made a composable hook that checks ifAnimationsEnabled and you can pass a lambda with modifiers for animations
n
hmm sounds interesting. Is it possible to share a gist as I am very curious 😄
423 Views