Just Eat Jun 5, 2025

Testing Lottie Animations in Jetpack Compose

Article Summary

Jordi Coll Marin from Just Eat Takeaway reveals a testing challenge most Android devs overlook: how do you verify a Lottie animation actually completes when it only runs for half a second?

Testing animations in Jetpack Compose isn't straightforward, especially when they're short-lived and run only once. Jordi breaks down three distinct approaches to testing Lottie animations in Compose, each with different tradeoffs for controlling animation state during UI tests.

Key Takeaways

Critical Insight

Three different testing strategies (MainTestClock, iterations control, and clipSpec manipulation) each solve the problem of verifying short-lived Lottie animations in Compose tests.

The article includes working code samples for all three approaches, plus a clever logging trick that reveals exactly how Lottie's progress state behaves during animation.

Recent from Just Eat

Related Articles