waitUntilDisplayed

fun ComposeUiTest.waitUntilDisplayed(matcher: SemanticsMatcher, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false): SemanticsNodeInteraction(source)

Waits until a node matching matcher is displayed and returns it.

Unlike waitUntilAtLeastOneExists, this requires the node to be visible on screen, not just present in the semantics tree. When several nodes match, the first displayed one is returned.

Return

The displayed node.

Parameters

matcher

Selects the node.

timeout

The nonnegative wait budget.

useUnmergedTree

Whether to search the unmerged semantics tree.

Throws

when no node is displayed in time.

fun ComposeTestRule.waitUntilDisplayed(matcher: SemanticsMatcher, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false): SemanticsNodeInteraction(source)

Waits until a node matching matcher is displayed and returns it.

The JUnit 4 rule counterpart of androidx.compose.ui.test.ComposeUiTest.waitUntilDisplayed.

Return

The displayed node.

Parameters

matcher

Selects the node.

timeout

The nonnegative wait budget.

useUnmergedTree

Whether to search the unmerged semantics tree.