takahirom / roborazzi

Make JVM Android integration test visible 🤖📸
https://takahirom.github.io/roborazzi/
Apache License 2.0
729 stars 35 forks source link

LinearProgressIndicator stalls Roborazzi @Preview tests #550

Open as6o opened 3 days ago

as6o commented 3 days ago

When Roborazzi processes a @Preview (using the Compose Preview support) containing an indeterminate LinearProgressIndicator (during recordRoborazziDebug, verifyRoborazziDebug, etc.) it stalls for a good 4 minutes or more (whereas all other @Preview-based tests are quick). We assume that the delay has to do with the ProgressIndicator animation so we are skipping those @Previews using a custom ComposePreviewTester for now. However, is there a strategy for dealing with such tests that contain animations?

takahirom commented 3 days ago

Thanks. One thing I can recommend is adding the DelayedPreview annotation. With this annotation, you can set mainClock.autoAdvance = false and then use mainClock.advanceTimeBy(delay). This should help the test finish quickly. The information is in Japanese, but you can refer to the code.

https://github.com/DeNA/android-modern-architecture-test-handson/blob/main/docs/handson/VisualRegressionTest_Preview_ComposablePreviewScanner.md#composepreviewtester%E3%81%AE%E5%AE%9F%E8%A3%85