Sign in Get 3 free credits

Try a job or a niche: tiktok captions, study notes, excel formulas. Press Esc to close.

Compose and Espresso tests

Writes Android tests that mix Compose and Espresso on one screen, so hybrid screens get tested without hangs.

What we improved

Replaced the keyboard example, which depended on `KeyboardHelper` and `wrapContent`, two AndroidX internal test helpers that are not published. The new IME helper reads `WindowInsetsCompat` from the window's root View through Espresso and w

Improved by YourAISkill from the original by skydoves, under its Apache-2.0 licence. The download includes the author's licence and a CHANGES.md listing every change. Both Claude reviews read the improved version.

Claude's review

8/10 Specific fixes for mixed Compose and Espresso tests: threading rule, dialog roots, IME checks via insets, scoped finders, with wrong and right examples.

We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.

In detail

Use this skill to mix Compose finders and Espresso `onView` in the same test — for Android `Dialog` windows, IME (soft keyboard) state, `ComposeView` inside an Android View hierarchy, or focus interactions that cross the Compose/View boundary. Covers `createAndroidComposeRule<A>()` setup, the `EspressoLink` bridge that auto-registers Compose's `IdlingResource` with Espresso, the `onRootWithViewInteraction` API, and why `Espresso.onView(...)` MUST run from the test thread (not from `runOnIdle` / `runOnUiThread`). Use when the developer mentions "Espresso onView and Compose at the same time", "ComposeView inside a View", "soft keyboard test", "Dialog focus", "compose interop test", or shows a test that calls Espresso from inside `runOnIdle` and deadlocks.

How you use it

  1. Add it to your pack, then download your pack (1 credit).
  2. In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
  3. Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide

Safety check

Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.

An automated scan lowers risk but cannot promise zero risk. How we check skills

Preview

The first lines of SKILL.md
---
name: testing-with-espresso-interop
description: Write Android instrumented tests that use Compose test finders and Espresso `onView` in the same test, for hybrid screens. Covers View-based dialogs (`inRoot(isDialog())`), soft keyboard (IME) tests with public APIs, `AndroidView` inside Compose, `ComposeView` inside RecyclerViews or Fragments, `createAndroidComposeRule` setup, the built-in Compose and Espresso idling bridge, scoping Compose finders with `onRootWithViewInteraction`, and the threading rule that `Espresso.onView` must run on the test thread, never inside `runOnIdle`, `runOnUiThread` or `setContent`. Use when a test mixes Espresso and Compose, a test hangs or throws "cannot be run from the main thread", a keyboard test never sees the IME, or Compose finders cannot reach content inside a View hierarchy. Not for pure Compose screens or Compose `Dialog` composables, which Compose finders handle alone.
license: Apache-2.0
metadata:
  author: Jaewoong Eum (skydoves)
  keywords:
  - jetpack-compose
  - ui-testing
  - espresso
  - interop
  - createAndroidComposeRule
  - EspressoLink
  - IdlingResource
  - onRootWithViewInteraction
  - dialog-test
  - keyboard-test
---

<!-- Modified by YourAISkill (youraiskill.com) on 2 December 2026 from the original by skydoves. See CHANGES.md. -->

# Testing with Espresso Interop: One Activity, Two Test Frameworks, One Bridge

The Compose `ComposeTestRule` and Espresso's `onView` operate on the same `Activity` at the same time. Compose's synchronization (recomposer, snapshot, frame clock) is exposed to Espresso through a single internal `IdlingResource` named `"Compose-Espresso link"` (`EspressoLink` in `androidx.compose.ui.test`), so you register nothing by hand. The trap is threading: `Espresso.onView(...)` must run on the instrumentation (test) thread, never inside `rule.runOnIdle { }`, `rule.runOnUiThread { }` or `setContent { }`. The method below follows the interop tests in AndroidX's own `compose/foundation` text field tests, rewritten to use only public APIs.

## Which tool sees what

| Thing under test | Compose finders (`rule.onNode...`) | Espresso (`onView`) |
|---|---|---|
| Composables in the Activity, or in a `ComposeView` anywhere in the View tree | Yes (every attached Compose root is searched) | Only the host `ComposeView` itself |
| Compose `Dialog` or `Popup` composables | Yes (`isDialog()`, `isPopup()` matchers) | Not needed |
| Plain Views: `EditText`, `RecyclerView`, `AlertDialog` buttons, legacy layouts | No | Yes |
| Views hosted by `AndroidView { }` inside Compose | No (Compose sees only the `AndroidView` node) | Yes, by id or matcher |
| A separate window such as an `android.app.Dialog` or `AlertDialog` | Composables inside it, yes; its Views, no | Yes, with `inRoot(isDialog())` |
| Soft keyboard visibility | No direct API | Read window insets from the root View (below) |

Use this skill when a test needs both columns. If everything is in the first two rows, write a pure Compose test instead.

## Setup

...

From skydoves's repository, Apache-2.0 licence.

Related skills

  • Checked

    Compose UI test setup

    Sets up the right Gradle test dependencies for Jetpack Compose UI tests, so they launch instead of failing early.

    by skydoves 351
    8/101 credit
  • Checked

    Android Gradle Plugin upgrade

    Moves Kotlin Multiplatform projects to Android Gradle Plugin 9 and fixes the build failures it causes.

    by Kotlin 1.1k
    8/101 credit
  • Checked

    Android Edge-to-Edge Fix

    Makes Jetpack Compose apps draw edge to edge, so buttons, lists and text fields never hide behind system bars.

    by android 11k
    8/101 credit
  • Checked

    Offline Android LLM apps

    Builds an Android app that runs an open LLM on the phone with LiteRT, so it works without a server.

    by android 11k
    7/101 credit
  • Checked

    Android TV Compose Migration

    Moves an Android TV app from old Leanback screens to Compose for TV, with remote control focus that works.

    by android 11k
    7/101 credit
  • Checked

    CometChat Android Chat Setup

    Adds working CometChat chat screens to your Android app in Kotlin or Jetpack Compose, set up in the right order.

    by cometchat 182
    7/101 credit

Secure checkout

Credits

AUD

  1. 1Choose
  2. 2Pay on Square
  3. 3Credits added