# ComposeUiTest

Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeUiTest.kt+class:androidx.compose.ui.test.ComposeUiTest) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface ComposeUiTest : SemanticsNodeInteractionsProvider
  ```
Known direct subclasses [AndroidComposeUiTest](https://developer.android.com/reference/kotlin/androidx/compose/ui/test/AndroidComposeUiTest)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/AndroidComposeUiTest` | Variant of `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest` for when you want to have access the current `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/AndroidComposeUiTest#activity()` of type `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/AndroidComposeUiTest`. |

*** ** * ** ***

A test environment that allows you to test and control composables, either in isolation or in applications. Most of the functionality in this interface provides some form of test synchronization: the test will block until the app or composable is idle, to ensure the tests are deterministic.

For example, if you would perform a click on the center of the screen while a button is animating from left to right over the screen, without synchronization the test would sometimes click when the button is in the middle of the screen (button is clicked), and sometimes when the button is past the middle of the screen (button is not clicked). With synchronization, the app would not be idle until the animation is over, so the test will always click when the button is past the middle of the screen (and not click it). If you actually do want to click the button when it's in the middle of the animation, you can do so by controlling the `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#mainClock()`. You'll have to disable `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/MainTestClock#autoAdvance()`, and manually advance the clock by the time necessary to position the button in the middle of the screen.

To test a composable in isolation, use `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#setContent(kotlin.Function0)` to set the composable in a host. On Android, the host is an Activity. When using `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#runComposeUiTest(kotlin.coroutines.CoroutineContext,kotlin.coroutines.CoroutineContext,kotlin.time.Duration,kotlin.coroutines.SuspendFunction1)` or any of its platform specific variants, the host will be started for you automatically, unless otherwise specified. To test an application, use the platform specific variant of `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#runComposeUiTest(kotlin.coroutines.CoroutineContext,kotlin.coroutines.CoroutineContext,kotlin.time.Duration,kotlin.coroutines.SuspendFunction1)` that launches the app.

An instance of `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest` can be obtained through `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#runComposeUiTest(kotlin.coroutines.CoroutineContext,kotlin.coroutines.CoroutineContext,kotlin.time.Duration,kotlin.coroutines.SuspendFunction1)` or any of its platform specific variants, the argument to which will have it as the receiver scope.

## Summary

| ### Public functions |
|---|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#awaitIdle()()` Suspends until the UI is idle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#hasPendingWork()()` Returns whether the Compose UI has any pending work. | Cmn |
| `T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnIdle(kotlin.Function0)(action: () -> T)` Executes the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnIdle(kotlin.Function0)` in the same way as `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnUiThread(kotlin.Function0)` but `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitForIdle()` until the app is idle before executing the action. | Cmn |
| `T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnUiThread(kotlin.Function0)(action: () -> T)` Runs the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnUiThread(kotlin.Function0)` on the UI thread. | Cmn |
| `T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runWithoutImplicitWait(kotlin.Function0)(block: () -> T)` Executes the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runWithoutImplicitWait(kotlin.Function0)` with implicit synchronization suppressed. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#setContent(kotlin.Function0)(composable: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Sets the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#setContent(kotlin.Function0)` as the content to be tested. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitForIdle()()` Waits for the UI to become idle. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)( conditionDescription: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, condition: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Blocks until the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` is satisfied. | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#density()` Current device screen's density. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/MainTestClock` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#mainClock()` Clock that drives frames and recompositions in compose tests. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).onRootWithViewInteraction(androidx.test.espresso.ViewInteraction)(interaction: https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewInteraction)` Scopes Compose interactions to the `https://developer.android.com/reference/android/view/View.html` hierarchy matched by an Espresso `https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewInteraction`. | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 34) https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).disableAccessibilityChecks()()` Disables accessibility checks. | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 34) https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).enableAccessibilityChecks(com.google.android.apps.common.testing.accessibility.framework.integrations.espresso.AccessibilityValidator)( accessibilityValidator: com.google.android.apps.common.testing.accessibility.framework.integrations.espresso.AccessibilityValidator )` Enables accessibility checks before actions that change the UI. | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).isIdlingResourceSupported()()` Capability query to determine if the current `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest` implementation supports registering an `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).registerIdlingResource(androidx.compose.ui.test.IdlingResource)(idlingResource: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource)` Attempts to register an `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` in this test. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).unregisterIdlingResource(androidx.compose.ui.test.IdlingResource)(idlingResource: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource)` Attempts to unregister an `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` in this test. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).waitUntilAtLeastOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)( matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher, timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Blocks until at least one node matches the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilAtLeastOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).waitUntilDoesNotExist(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)( matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher, timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Blocks until no nodes match the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilDoesNotExist(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).waitUntilExactlyOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)( matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher, timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Blocks until exactly one node matches the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilExactlyOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)( matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher, count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Blocks until the number of nodes matching the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)` is equal to the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)`. | Cmn |

### Inherited functions

From [androidx.compose.ui.test.SemanticsNodeInteractionsProvider](https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider) `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider#onAllNodes(androidx.compose.ui.test.SemanticsMatcher,kotlin.Boolean)(matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher, useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Finds all semantics nodes that match the given condition.
Cmn `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteraction` `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider#onNode(androidx.compose.ui.test.SemanticsMatcher,kotlin.Boolean)(matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher, useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Finds a semantics node that matches the given condition.
Cmn

## Public functions

### awaitIdle

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
suspend fun awaitIdle(): Unit
```

Suspends until the UI is idle. Quiescence is reached when there are no more pending changes (e.g. pending recompositions or a pending draw call) and all `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource`s are idle.

If `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/MainTestClock#autoAdvance()` is enabled on the `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#mainClock()`, this method will advance the clock to process any pending composition, invalidation and animation. If auto advancement is not enabled, the clock will not be advanced which means that the Compose UI appears to be frozen. This is ideal for testing animations in a deterministic way. This method will always wait for all `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource`s to become idle.

Note that some processes are driven by the host operating system and will therefore still execute when auto advancement is disabled. For example, Android's measure, layout and draw passes can still happen if required by the View system.

### hasPendingWork

Cmn

```
fun hasPendingWork(): Boolean
```

Returns whether the Compose UI has any pending work.

This performs a passive check of the `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#mainClock()`, snapshot state, and recomposer to determine if there is any pending work. Unlike `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitForIdle()`, calling this method does not advance the clock or drain the main message queue.

This is particularly useful when `autoAdvance` is disabled, allowing you to inspect the state of the UI while an animation or other work is still active. If `autoAdvance` is `true`, the testing framework continuously processes pending work. In that scenario, calling this method acts as a momentary snapshot and will generally return `false`. It may briefly return `true` if work is queued but the framework hasn't auto-advanced yet, making the result fleeting and unreliable for driving test logic.

```kotlin
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.v2.runComposeUiTest

runComposeUiTest {
    setContent { ExpandingCard() }

    mainClock.autoAdvance = false

    // Trigger the animation
    onNodeWithTag("ExpandButton").performClick()

    while (hasPendingWork()) {
        // Advance the clock by exactly one frame
        mainClock.advanceTimeByFrame()
        waitForIdle()
        runOnUiThread {
            runWithoutImplicitWait {
                // Make intermediate assertions (e.g., check bounds, alpha, or translation)
                val midAnimationBounds =
                    onNodeWithTag("CardContent").fetchSemanticsNode().boundsInRoot
                assertTrue(
                    "Card height should be greater than collapsed state",
                    midAnimationBounds.height > COLLAPSED_HEIGHT,
                )
                onNodeWithTag("ExpandedTextDetails").assertExists()
            }
        }
    }
    runOnIdle {
        // Assert the final state.
    }
}
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if there is pending work, false otherwise |

### runOnIdle

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
fun <T : Any?> runOnIdle(action: () -> T): T
```

Executes the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnIdle(kotlin.Function0)` in the same way as `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnUiThread(kotlin.Function0)` but `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitForIdle()` until the app is idle before executing the action. This is the recommended way of doing your assertions on shared variables.

This method blocks until the action is complete.

| Parameters |
|---|---|
| `action: () -> T` | action to execute after the UI is idle |

| Returns |
|---|---|
| `T` | result of `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnIdle(kotlin.Function0)` |

### runOnUiThread

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
fun <T : Any?> runOnUiThread(action: () -> T): T
```

Runs the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnUiThread(kotlin.Function0)` on the UI thread.

This method blocks until the action is complete.

| Parameters |
|---|---|
| `action: () -> T` | action to execute on the UI thread |

| Returns |
|---|---|
| `T` | result of `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnUiThread(kotlin.Function0)` |

### runWithoutImplicitWait

Cmn

```
fun <T : Any?> runWithoutImplicitWait(block: () -> T): T
```

Executes the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runWithoutImplicitWait(kotlin.Function0)` with implicit synchronization suppressed. `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runWithoutImplicitWait(kotlin.Function0)` should contain read-only assertions, and any actions that mutate state should be performed outside of this block.

To ensure stability of the UI tree while running assertions in this block, make sure to call this on the UI thread, such as with `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnUiThread(kotlin.Function0)`. If you run this block off the UI thread, state might change in the background and be reflected in the UI while the block is executing. This exposes your test to race conditions, flakiness, and may cause you to read stale or inconsistent state.

Standard node queries (like `onNodeWithTag` or `fetchSemanticsNode`) normally trigger a `waitForIdle()` under the hood. In animation tests that manually step through frames in a loop, these implicit waits impose a severe performance penalty.

This API acts as a performance optimization for motion tests that assert UI state across multiple frames. It is primarily designed for use when mainClock.autoAdvance is set to false and the UI is known to be in a stable state at the specific frame being tested (for example, by calling waitForIdle() before this block).

```kotlin
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.v2.runComposeUiTest

runComposeUiTest {
    mainClock.autoAdvance = false

    // Trigger an animation
    onNodeWithText("Start Animation").performClick()

    // Step through the animation frame-by-frame
    while (hasPendingWork()) {
        mainClock.advanceTimeByFrame()
        waitForIdle()
        runOnUiThread {
            // Suppress implicit synchronization inside this block to avoid redundant
            // waits on each node query, making the frame assertions execute much faster.
            runWithoutImplicitWait {
                val box1 = onNodeWithTag("Box1").fetchSemanticsNode()
                val box2 = onNodeWithTag("Box2").fetchSemanticsNode()
                val box3 = onNodeWithTag("Box3").fetchSemanticsNode()

                // Assert the exact intermediate state of all three properties for this frame
                assert(box1.boundsInRoot.right <= box2.boundsInRoot.left)
                assert(box2.boundsInRoot.right <= box3.boundsInRoot.left)
            }
        }
    }
}
```

| Parameters |
|---|---|
| `block: () -> T` | test body for assertions to run with implicit synchronization suppressed |

| Returns |
|---|---|
| `T` | result of `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runWithoutImplicitWait(kotlin.Function0)` |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#runOnUiThread(kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#hasPendingWork()` |   |

### setContent

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
fun setContent(composable: @Composable () -> Unit): Unit
```

Sets the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#setContent(kotlin.Function0)` as the content to be tested. This should be called exactly once per test.

| Parameters |
|---|---|
| `composable: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` content under test |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if called more than once per test, or if the implementation doesn't have access to a host to set content in. |

### waitForIdle

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
fun waitForIdle(): Unit
```

Waits for the UI to become idle. Quiescence is reached when there are no more pending changes (e.g. pending recompositions or a pending draw call) and all `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource`s are idle.

If `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/MainTestClock#autoAdvance()` is enabled on the `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#mainClock()`, this method will advance the clock to process any pending composition, invalidation and animation. If auto advancement is not enabled, the clock will not be advanced which means that the Compose UI appears to be frozen. This is ideal for testing animations in a deterministic way. This method will always wait for all `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource`s to become idle.

Note that some processes are driven by the host operating system and will therefore still execute when auto advancement is disabled. For example, Android's measure, layout and draw passes can still happen if required by the View system.

### waitUntil

Cmn

```
fun waitUntil(
    conditionDescription: String? = null,
    timeoutMillis: Long,
    condition: () -> Boolean
): Unit
```

Blocks until the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` is satisfied.

If `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/MainTestClock#autoAdvance()` is enabled on the `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#mainClock()`, this method will actively advance the clock to process any pending composition, invalidation and animation. If auto advancement is not enabled, the clock will not be advanced actively which means that the Compose UI appears to be frozen. It is still valid to use this method in this way, if the condition will be satisfied by something not driven by our clock.

Compared to `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/MainTestClock#advanceTimeUntil(kotlin.Long,kotlin.Function0)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` sleeps after every iteration to yield to other processes. This gives `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` a better integration with the host, but it is less preferred from a performance viewpoint. Therefore, we recommend that you try using `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/MainTestClock#advanceTimeUntil(kotlin.Long,kotlin.Function0)` before resorting to `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)`.

| Parameters |
|---|---|
| `conditionDescription: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? = null` | An optional human-readable description of `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` that will be included in the timeout exception if thrown. |
| `timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time after which this method throws an exception if the given condition is not satisfied. This observes wall clock time, not `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#mainClock()`. |
| `condition: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Condition that must be satisfied in order for this method to successfully finish. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeTimeoutException` | If the condition is not satisfied after `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` (in wall clock time). |

## Public properties

### density

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val density: Density
```

Current device screen's density. Note that it is technically possible for a Compose hierarchy to define a different density for a certain subtree. Try to use `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/LayoutInfo#density()` where possible, which can be obtained from `https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsNode#layoutInfo()`.

### mainClock

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0)

```
val mainClock: MainTestClock
```

Clock that drives frames and recompositions in compose tests.

## Extension functions

### ComposeUiTest.onRootWithViewInteraction

android Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeTestInteropExt.android.kt+function:onRootWithViewInteraction)

```
fun ComposeUiTest.onRootWithViewInteraction(interaction: ViewInteraction): SemanticsNodeInteractionsProvider
```

Scopes Compose interactions to the `https://developer.android.com/reference/android/view/View.html` hierarchy matched by an Espresso `https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewInteraction`.

Resolves the `https://developer.android.com/reference/android/view/View.html` from `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).onRootWithViewInteraction(androidx.test.espresso.ViewInteraction)`, locates all Compose roots within that hierarchy, and creates a scoped `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider`.

```kotlin
import androidx.compose.ui.test.junit4.onRootWithViewInteraction
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.performClick
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.matcher.ViewMatchers.withId

// Select the "Header" View container
val headerInteraction = onView(withId(header_id))

// Scope the Compose interaction to only the Header
composeTestRule
    .onRootWithViewInteraction(headerInteraction)
    .onNodeWithContentDescription("Settings")
    .performClick()
```

```kotlin
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.onRootWithViewInteraction
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText

// Select the specific View row containing "Item #5"
val specificRowInteraction =
    onView(allOf(withId(recycler_item_root_id), hasDescendant(withText("Item #5"))))

// Scope interaction to that specific row View
composeTestRule
    .onRootWithViewInteraction(specificRowInteraction)
    .onNodeWithTag("fav_icon")
    .assertIsDisplayed()
    .performClick()
```

```kotlin
import androidx.compose.ui.test.assertIsEnabled
import androidx.compose.ui.test.junit4.onRootWithViewInteraction
import androidx.compose.ui.test.onNodeWithText
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.matcher.ViewMatchers.withId

// Select the container for the Detail Fragment
val detailContainerInteraction = onView(withId(detail_fragment_container_id))

// Assert that the submit button exists/is enabled only in the detail fragment
composeTestRule
    .onRootWithViewInteraction(detailContainerInteraction)
    .onNodeWithText("Submit")
    .assertIsEnabled()
```

| Parameters |
|---|---|
| `interaction: https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewInteraction` | `https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewInteraction` matching the target `https://developer.android.com/reference/android/view/View.html` hierarchy |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider` | scoped `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider` for the matched `https://developer.android.com/reference/android/view/View.html` hierarchy |

### ComposeUiTest.disableAccessibilityChecks

android Artifact: [androidx.compose.ui:ui-test-accessibility](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/accessibility/ComposeUiTestExt.android.kt+function:disableAccessibilityChecks)

```
@RequiresApi(value = 34)
fun ComposeUiTest.disableAccessibilityChecks(): Unit
```

Disables accessibility checks.

```kotlin
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.accessibility.disableAccessibilityChecks
import androidx.compose.ui.test.accessibility.enableAccessibilityChecks
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollToIndex
import androidx.compose.ui.test.tryPerformAccessibilityChecks
import androidx.compose.ui.test.v2.runComposeUiTest
import androidx.test.espresso.accessibility.AccessibilityChecks

@Test
@OptIn(ExperimentalTestApi::class)
fun testWithAccessibilityChecks() = runComposeUiTest {
    // Enable accessibility checks with default configuration:
    enableAccessibilityChecks()

    // When enabled, accessibility checks run automatically when performing an action:
    onNodeWithText("Submit").performClick()

    // You can also manually run accessibility checks:
    onRoot().tryPerformAccessibilityChecks()

    // When disabling accessibility checks..
    disableAccessibilityChecks()

    // .. they no longer run when performing an action:
    onNodeWithTag("list").performScrollToIndex(15)
}
```

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/accessibility/package-summary#(androidx.compose.ui.test.ComposeUiTest).enableAccessibilityChecks(com.google.android.apps.common.testing.accessibility.framework.integrations.espresso.AccessibilityValidator)` |   |

### ComposeUiTest.enableAccessibilityChecks

android Artifact: [androidx.compose.ui:ui-test-accessibility](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/accessibility/ComposeUiTestExt.android.kt+function:enableAccessibilityChecks)

```
@RequiresApi(value = 34)
fun ComposeUiTest.enableAccessibilityChecks(
    accessibilityValidator: com.google.android.apps.common.testing.accessibility.framework.integrations.espresso.AccessibilityValidator = AccessibilityValidator().setRunChecksFromRootView(true)
): Unit
```

Enables accessibility checks before actions that change the UI.

Note: Requires API 34+ (Android U) and is not supported on Robolectric.

```kotlin
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.accessibility.disableAccessibilityChecks
import androidx.compose.ui.test.accessibility.enableAccessibilityChecks
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.onRoot
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollToIndex
import androidx.compose.ui.test.tryPerformAccessibilityChecks
import androidx.compose.ui.test.v2.runComposeUiTest
import androidx.test.espresso.accessibility.AccessibilityChecks

@Test
@OptIn(ExperimentalTestApi::class)
fun testWithAccessibilityChecks() = runComposeUiTest {
    // Enable accessibility checks with default configuration:
    enableAccessibilityChecks()

    // When enabled, accessibility checks run automatically when performing an action:
    onNodeWithText("Submit").performClick()

    // You can also manually run accessibility checks:
    onRoot().tryPerformAccessibilityChecks()

    // When disabling accessibility checks..
    disableAccessibilityChecks()

    // .. they no longer run when performing an action:
    onNodeWithTag("list").performScrollToIndex(15)
}
```

```kotlin
import androidx.activity.ComponentActivity
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.accessibility.enableAccessibilityChecks
import androidx.compose.ui.test.v2.runAndroidComposeUiTest
import androidx.test.espresso.accessibility.AccessibilityChecks

@Test
@OptIn(ExperimentalTestApi::class)
fun testWithAccessibilityChecks() =
    runAndroidComposeUiTest<ComponentActivity> {
        // Configure your own AccessibilityValidator
        val accessibilityValidator =
            AccessibilityValidator().also {
                it.setThrowExceptionFor(AccessibilityCheckResultType.ERROR)
            }

        // Enable accessibility checks with your own AccessibilityValidator:
        enableAccessibilityChecks(accessibilityValidator)
    }
```

If you have a hybrid application with both Compose and Views, and you use both Compose Test and Espresso, then you should set up accessibility checks in both frameworks and share the configuration in the following way:

```kotlin
import androidx.activity.ComponentActivity
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.accessibility.enableAccessibilityChecks
import androidx.compose.ui.test.v2.runAndroidComposeUiTest
import androidx.test.espresso.accessibility.AccessibilityChecks

@Test
@OptIn(ExperimentalTestApi::class)
fun testWithAccessibilityChecks() =
    runAndroidComposeUiTest<ComponentActivity> {
        // Enable accessibility checks in both Espresso and Compose, and share the configuration
        val accessibilityValidator = AccessibilityChecks.enable()
        enableAccessibilityChecks(accessibilityValidator)
    }
```

| Parameters |
|---|---|
| `accessibilityValidator: com.google.android.apps.common.testing.accessibility.framework.integrations.espresso.AccessibilityValidator = AccessibilityValidator().setRunChecksFromRootView(true)` | to run accessibility checks before UI actions |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/accessibility/package-summary#(androidx.compose.ui.test.ComposeUiTest).disableAccessibilityChecks()` |   |

### ComposeUiTest.isIdlingResourceSupported

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeUiTest.kt+function:isIdlingResourceSupported)

```
fun ComposeUiTest.isIdlingResourceSupported(): Boolean
```

Capability query to determine if the current `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest` implementation supports registering an `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource`.

While `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` is supported on Android and Desktop, currently it is not available on all targets (such as Web).

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the implementation supports `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` registration, false otherwise. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResourceOwner` |   |

### ComposeUiTest.registerIdlingResource

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeUiTest.kt+function:registerIdlingResource)

```
fun ComposeUiTest.registerIdlingResource(idlingResource: IdlingResource): Boolean
```

Attempts to register an `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` in this test.

This implementation checks `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).isIdlingResourceSupported()` before attempting to register the resource.

| Parameters |
|---|---|
| `idlingResource: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` to register in the test |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the idling resource was successfully registered, or false if the implementation does not support idling resources. |

### ComposeUiTest.unregisterIdlingResource

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeUiTest.kt+function:unregisterIdlingResource)

```
fun ComposeUiTest.unregisterIdlingResource(idlingResource: IdlingResource): Boolean
```

Attempts to unregister an `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` in this test.

This implementation checks `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).isIdlingResourceSupported()` before attempting to unregister the resource.

| Parameters |
|---|---|
| `idlingResource: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/IdlingResource` to unregister from the test |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if the idling resource was successfully unregistered, or false if the implementation does not support idling resources. |

### ComposeUiTest.waitUntilAtLeastOneExists

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeUiTest.kt+function:waitUntilAtLeastOneExists)

```
fun ComposeUiTest.waitUntilAtLeastOneExists(
    matcher: SemanticsMatcher,
    timeoutMillis: Long,
    useUnmergedTree: Boolean = false
): Unit
```

Blocks until at least one node matches the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilAtLeastOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)`.

| Parameters |
|---|---|
| `matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | The matcher that will be used to filter nodes. |
| `timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time after which this method throws an exception if no nodes match the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilAtLeastOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)`. This observes wall clock time, not frame time. |
| `useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | If true, searches the unmerged semantics tree instead of the merged semantics tree. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeTimeoutException` | If no nodes match the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilAtLeastOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)` after `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilAtLeastOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)` (in wall clock time). |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` |   |

### ComposeUiTest.waitUntilDoesNotExist

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeUiTest.kt+function:waitUntilDoesNotExist)

```
fun ComposeUiTest.waitUntilDoesNotExist(
    matcher: SemanticsMatcher,
    timeoutMillis: Long,
    useUnmergedTree: Boolean = false
): Unit
```

Blocks until no nodes match the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilDoesNotExist(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)`.

| Parameters |
|---|---|
| `matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | The matcher that will be used to filter nodes. |
| `timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time after which this method throws an exception if any nodes match the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilDoesNotExist(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)`. This observes wall clock time, not frame time. |
| `useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | If true, searches the unmerged semantics tree instead of the merged semantics tree. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeTimeoutException` | If any nodes match the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilDoesNotExist(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)` after `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilDoesNotExist(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)` (in wall clock time). |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` |   |

### ComposeUiTest.waitUntilExactlyOneExists

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeUiTest.kt+function:waitUntilExactlyOneExists)

```
fun ComposeUiTest.waitUntilExactlyOneExists(
    matcher: SemanticsMatcher,
    timeoutMillis: Long,
    useUnmergedTree: Boolean = false
): Unit
```

Blocks until exactly one node matches the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilExactlyOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)`.

| Parameters |
|---|---|
| `matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | The matcher that will be used to filter nodes. |
| `timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time after which this method throws an exception if exactly one node does not match the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilExactlyOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)`. This observes wall clock time, not frame time. |
| `useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | If true, searches the unmerged semantics tree instead of the merged semantics tree. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeTimeoutException` | If exactly one node does not match the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilExactlyOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)` after `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilExactlyOneExists(androidx.compose.ui.test.SemanticsMatcher,kotlin.Long,kotlin.Boolean)` (in wall clock time). |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` |   |

### ComposeUiTest.waitUntilNodeCount

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/ComposeUiTest.kt+function:waitUntilNodeCount)

```
fun ComposeUiTest.waitUntilNodeCount(
    matcher: SemanticsMatcher,
    count: Int,
    timeoutMillis: Long,
    useUnmergedTree: Boolean = false
): Unit
```

Blocks until the number of nodes matching the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)` is equal to the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)`.

| Parameters |
|---|---|
| `matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | The matcher that will be used to filter nodes. |
| `count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of nodes that are expected to be matched. |
| `timeoutMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The time after which this method throws an exception if the number of nodes that match the `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)` is not `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)`. This observes wall clock time, not frame time. |
| `useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | If true, searches the unmerged semantics tree instead of the merged semantics tree. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeTimeoutException` | If the number of nodes that match the `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)` is not `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)` after `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.ComposeUiTest).waitUntilNodeCount(androidx.compose.ui.test.SemanticsMatcher,kotlin.Int,kotlin.Long,kotlin.Boolean)` (in wall clock time). |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ComposeUiTest#waitUntil(kotlin.String,kotlin.Long,kotlin.Function0)` |   |