compose-ui-testing-patterns

Guide Jetpack Compose UI tests with semantics assertions and state-driven patterns.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill compose-ui-testing-patterns
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: compose-ui-testing-patterns
Source: https://github.com/soygabimoreno/Los-ANDROIDES/tree/main/.agents/skills/compose-ui-testing-patterns
Command: npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill compose-ui-testing-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you avoid flaky, shallow, and overly complex Jetpack Compose UI tests by teaching you how to test the real UI contract with deterministic patterns.

Core Features & Use Cases

  • Test the smallest UI contract by preferring plain state-driven Compose tests over full app integration when possible.
  • Use semantics-first assertions for behavior (enabled/disabled, presence/absence, selected/focused/toggled content) instead of brittle UI inspection.
  • Control interaction state deterministically by injecting a MutableInteractionSource and emitting hover/press/focus events rather than relying on pointer simulation.
  • Choose the right test type for text/callback wiring, screenshot-worthy visual layout, and state-holder vs wiring smoke coverage.

Quick Start

Use the compose-ui-testing-patterns skill to review your Compose UI tests and refactor them toward semantics-based, state-driven assertions with deterministic interaction handling.

Frequently Asked Questions about compose-ui-testing-patterns

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

FAQPage Schema
How do I fix flaky Jetpack Compose UI tests?▼

Fix flaky Jetpack Compose UI tests by using semantics-based assertions, injecting a MutableInteractionSource for interaction states, and faking images, network, and time to ensure deterministic snapshot updates.

What is the best way to test hover and focus interactions in Compose?▼

The best way to test hover and focus interactions in Compose is to inject a MutableInteractionSource and emit interaction events directly, rather than relying on brittle pointer simulation or waiting for idle states.

How do I write deterministic screenshot tests for Jetpack Compose?▼

Write deterministic screenshot tests for Jetpack Compose by faking external dependencies like images and network data, ensuring visual contracts remain stable and do not trigger flaky test failures during snapshot validation.

Why use semantics assertions instead of UI inspection in Compose testing?▼

Use semantics assertions in Compose testing to verify behavior like enabled or disabled states and focus toggles reliably, avoiding brittle UI inspection and ensuring high-signal state-driven test coverage.

When should I use runOnIdle or waitForIdle in Compose tests?▼

Use runOnIdle or waitForIdle in Compose tests when you need to ensure snapshot updates have propagated before asserting on interaction-dependent UI states or emitting new events through a MutableInteractionSource.