testing-animations-deterministically

Test Jetpack Compose animations deterministically by managing the main test clock.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/trancee/MeshLink-template --skill testing-animations-deterministically-trancee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-animations-deterministically
Source: https://github.com/trancee/MeshLink-template/tree/main/.agents/skills/android-testing-skills/compose/synchronization/testing-animations-deterministically
Command: npx skills add https://github.com/trancee/MeshLink-template --skill testing-animations-deterministically-trancee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill resolves non-deterministic test failures in Jetpack Compose caused by animation timing, preventing common issues like CancellationException and flaky UI assertions.

Core Features & Use Cases

  • Deterministic Clock Control: Provides the exact recipe to pause the main test clock, preventing the InfiniteAnimationPolicy from cancelling indeterminate animations.
  • Frame-by-Frame Validation: Enables precise stepping through animations using advanceTimeByFrame and advanceTimeBy to assert intermediate UI states.
  • Use Case: Use this skill when your Crossfade or indeterminate progress indicator tests pass locally but fail on CI due to timing races or animation cancellation.

Quick Start

Use the testing-animations-deterministically skill to configure your Compose test rule with autoAdvance set to false and manually step through the animation frames.

Frequently Asked Questions about testing-animations-deterministically

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why do my Jetpack Compose animation tests pass locally but fail on CI?

Jetpack Compose animation tests fail on CI due to timing races where the InfiniteAnimationPolicy cancels indeterminate animations. Configuring the main test clock with autoAdvance disabled prevents these non-deterministic CancellationException errors.

How do I test indeterminate progress indicators in Jetpack Compose without flaky failures?

Testing indeterminate progress indicators requires pausing the main test clock to prevent animation cancellation. Using ComposeContentTestRule with manual clock advancement ensures consistent frame-by-frame assertion results for indeterminate animations.

How do I step through Crossfade animations frame-by-frame in Compose UI testing?

Step through Crossfade animations by using the main test clock to manually advance frames. Applying advanceTimeByFrame and advanceTimeBy allows precise validation of intermediate UI states during complex state-driven transitions.

Do I need a specific test rule to test Compose animations deterministically?

Yes, deterministic Compose animation testing requires the ComposeContentTestRule. Configuring this rule with autoAdvance set to false allows manual clock advancement, which is necessary to validate indeterminate progress indicators and crossfades reliably.

What causes CancellationException in Jetpack Compose UI tests?

CancellationException in Compose UI tests is caused by the InfiniteAnimationPolicy cancelling indeterminate animations during timing races. Managing the main test clock and disabling autoAdvance prevents this policy from interrupting animation frames.

Can I validate intermediate UI states during state-driven transitions in Compose?

Yes, you can validate intermediate UI states during state-driven transitions by controlling the main test clock. Using advanceTimeBy to manually progress the animation frames ensures deterministic and precise assertion results for complex transitions.