Android 12 Developer Preview is here! Try it out, and give us your feedback!

SemanticsNodeInteractionsProvider

interface SemanticsNodeInteractionsProvider
androidx.compose.ui.test.SemanticsNodeInteractionsProvider

Provides the main entry point into testing.

Typically implemented by a test rule.

Summary

Public methods
abstract SemanticsNodeInteractionCollection
onAllNodes(matcher: SemanticsMatcher, useUnmergedTree: Boolean = false)

Finds all semantics nodes that match the given condition.

abstract SemanticsNodeInteraction
onNode(matcher: SemanticsMatcher, useUnmergedTree: Boolean = false)

Finds a semantics node that matches the given condition.

Extension functions
From androidx.compose.ui.test
SemanticsNodeInteractionCollection
SemanticsNodeInteractionsProvider.onAllNodesWithContentDescription(label: String, substring: Boolean = false, ignoreCase: Boolean = false, useUnmergedTree: Boolean = false)

Finds all semantics nodes with the given label as ContentDescription.

SemanticsNodeInteractionCollection
SemanticsNodeInteractionsProvider.onAllNodesWithTag(testTag: String, useUnmergedTree: Boolean = false)

Finds all semantics nodes identified by the given tag.

SemanticsNodeInteractionCollection
SemanticsNodeInteractionsProvider.onAllNodesWithText(text: String, substring: Boolean = false, ignoreCase: Boolean = false, useUnmergedTree: Boolean = false)

Finds all semantics nodes with the given text.

SemanticsNodeInteraction
SemanticsNodeInteractionsProvider.onNodeWithContentDescription(label: String, substring: Boolean = false, ignoreCase: Boolean = false, useUnmergedTree: Boolean = false)

Finds a semantics node with the given contentDescription.

SemanticsNodeInteraction
SemanticsNodeInteractionsProvider.onNodeWithTag(testTag: String, useUnmergedTree: Boolean = false)

Finds a semantics node identified by the given tag.

SemanticsNodeInteraction
SemanticsNodeInteractionsProvider.onNodeWithText(text: String, substring: Boolean = false, ignoreCase: Boolean = false, useUnmergedTree: Boolean = false)

Finds a semantincs node with the given text.

SemanticsNodeInteraction
SemanticsNodeInteractionsProvider.onRoot(useUnmergedTree: Boolean = false)

Finds the root semantics node of the Compose tree.

Public methods

onAllNodes

abstract fun onAllNodes(
    matcher: SemanticsMatcher,
    useUnmergedTree: Boolean = false
): SemanticsNodeInteractionCollection

Finds all semantics nodes that match the given condition.

If you are working with elements that are not supposed to occur multiple times use onNode instead.

For usage patterns and semantics concepts see SemanticsNodeInteraction

Parameters
useUnmergedTree: Boolean = false