synchronizing-with-idle

Community

Stop Compose UI test flakiness with the right wait

Authorskydoves
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It eliminates flaky Jetpack Compose UI tests caused by waiting on the wrong synchronization primitive, using wall-clock time where deterministic test-clock progression is required, or reading/mutating Compose state from the wrong thread.

Core Features & Use Cases

  • Idle semantics and decision matrix: Defines what “idle” means in Compose tests (recompositions drained, draw ready, and all registered IdlingResources are idle) and helps you pick the correct API among waitForIdle/awaitIdle, waitUntil*, runOnIdle, runOnUiThread, runWhenIdle, awaitAndRunWhenIdle, and hasPendingWork.
  • Correct timeout sourcing: Explains the wall-clock vs test-clock split so you use waitUntil for non-Compose conditions and mainClock.advanceTimeUntil for Compose-state-observable conditions.
  • Thread-safety guardrails: Prevents stale reads by funneling test-thread state reads through runOnIdle (and correct mutation behavior through runOnUiThread under a paused clock).
  • External async synchronization: Shows when and how to register an Espresso/Compose-compatible IdlingResource so HTTP/DB-style work participates in waits reliably.

Quick Start

Use this skill to choose the exact ComposeTestRule/ComposeUiTest wait or idle API for your flaking UI test and fix the timeout source and thread access pattern based on what your condition depends on.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: synchronizing-with-idle
Download link: https://github.com/skydoves/android-testing-skills/archive/main.zip#synchronizing-with-idle

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.