What problem does it solve?
This skill fixes flaky or uncompilable Jetpack Compose UI tests caused by incorrect class structure, incorrect rule/entry-point usage, and state being created inside setContent instead of being hoisted for the test to drive.
Core Features & Use Cases
- Canonical test class skeleton: Enforces the androidx-style structure (typically @MediumTest, @RunWith(AndroidJUnit4::class), and a single createComposeRule(StandardTestDispatcher()) rule).
- Correct state ownership and lifecycle: Keeps mutable state declared above setContent so the test can mutate and re-assert reliably using rule.runOnIdle.
- Prevents incompatible patterns: Avoids mixing @get:Rule with runComposeUiTest { } and avoids calling setContent in @Before.
- Custom Activity support: Uses createAndroidComposeRule<MyActivity>() when the screen-under-test is not a ComponentActivity-backed default.
Quick Start
Ask the AI: “Show me the androidx-canonical skeleton for a Compose UI test that hoists mutable state above setContent and mutates it via rule.runOnIdle, without mixing @get:Rule and runComposeUiTest.”