The Developer Preview for Android 11 is now available; test it out and share your feedback.

SemanticsNodeInteraction

class SemanticsNodeInteraction
kotlin.Any
   ↳ androidx.ui.test.SemanticsNodeInteraction

Represents a component with which one can interact with the hierarchy. Examples of interactions include findByTag, isToggleable, assertIsOn, doClick

Example usage: findByTag("myCheckbox") .doClick() .assertIsOn()

Summary

Public methods

Unit

Asserts that no item was found or that the item is no longer in the hierarchy.

Unit

Asserts that the component was found and is part of the component tree.

Extension functions

From androidx.ui.test
SemanticsNodeInteraction

Asserts that the current component has a click action.

SemanticsNodeInteraction

Asserts that the current component doesn't have a click action.

SemanticsNodeInteraction

Asserts that the current component is displayed.

SemanticsNodeInteraction

Asserts that current component is hidden.

SemanticsNodeInteraction

Asserts the component is in a mutually exclusive group.

SemanticsNodeInteraction

Asserts that the current component is not displayed.

SemanticsNodeInteraction

Asserts that the current component is unchecked.

SemanticsNodeInteraction

Asserts that the current component is checked.

SemanticsNodeInteraction

Asserts that the current component is selectable.

SemanticsNodeInteraction

Asserts that the current component is selected.

SemanticsNodeInteraction

Asserts that the current component is toggleable.

SemanticsNodeInteraction

Asserts that the current component is unselected.

SemanticsNodeInteraction

Asserts that current component is visible.

SemanticsNodeInteraction

Asserts the component's label equals the given String.

SemanticsNodeInteraction

Asserts that the semantics of the component are the same as the given semantics.

SemanticsNodeInteraction

Asserts the component's value equals the given value.

Bitmap

Captures the underlying component's surface into bitmap.

SemanticsNodeInteraction

Performs a click action on the given component.

SemanticsNodeInteraction

Executes the gestures specified in the given block.

SemanticsNodeInteraction

Scrolls to a component using SemanticsActions.

Unit

SemanticsNodeInteraction

Verifies that the provided condition is true.

Unit

Verifies that the provided condition is true on all parent semantics nodes.

Inherited extension functions

From androidx.compose
operator T

IMPORTANT: This global operator is TEMPORARY, and should be removed whenever an answer for contextual composers is reached.

Properties

SemanticsNode

Returns the semantics node captured by this object.

Public methods

assertDoesNotExist

fun assertDoesNotExist(): Unit

Asserts that no item was found or that the item is no longer in the hierarchy.

Exceptions
AssertionError if the assert fails.

assertExists

fun assertExists(): Unit

Asserts that the component was found and is part of the component tree.

Exceptions
AssertionError if the assert fails.

Properties

semanticsNode

val semanticsNode: SemanticsNode

Returns the semantics node captured by this object.

Note: Accessing this object involves synchronization with UI. This means that when using this object the UI should be stable. If you are accessing this multiple times in one atomic operation, it is better to cache the result instead of calling this API multiple times.

Exceptions
AssertionError if 0 or multiple nodes found.