SemanticsNodeInteractionsProvider

Interface

Common
@JvmDefaultWithCompatibility
interface SemanticsNodeInteractionsProvider

Provides the main entry point into testing.

Typically implemented by a test rule.

Functions

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

Finds a semantics node that matches the given condition.

Any subsequent operation on its result will expect exactly one element found (unless SemanticsNodeInteraction.assertDoesNotExist is used) and will throw an AssertionError if none or more than one element is found.

For usage patterns and semantics concepts see SemanticsNodeInteraction

Parameters

matcherMatcher used for filtering
useUnmergedTreeIf true, searches the unmerged semantics tree instead of the merged semantics tree. This allows you to search for individual nodes that would otherwise be part of a larger semantic unit, for example a text and an image forming a Button together.
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

matcherMatcher used for filtering.
useUnmergedTreeIf true, searches the unmerged semantics tree instead of the merged semantics tree. This allows you to search for individual nodes that would otherwise be part of a larger semantic unit, for example a text and an image forming a Button together.