isDisplayed

Function

Common
fun SemanticsNodeInteraction.isDisplayed(): Boolean

Returns true if the matched node is displayed on screen.

Specifically, the node must be composed, placed and at least a portion of its bounds must be visible on screen after clipping is applied. If no matching node is found, returns false. If multiple nodes match, throws an AssertionError.

Code Examples

waitForDisplayed

fun waitForDisplayed() {
    val interaction = composeTestRule.onNodeWithTag("test")
    composeTestRule.waitUntil { interaction.isDisplayed() }
}