Package-level declarations

Types

Link copied to clipboard
class ThemedComposeRule(theme: (content: () -> Unit) -> Unit, delegate: ComposeContentTestRule = createComposeRule()) : ComposeContentTestRule

A compose rule that wraps every setContent in the app's theme, replacing per-test setContent { AppTheme { ... } } boilerplate.

Properties

Link copied to clipboard

The default wait budget for UI helpers.

Link copied to clipboard

A longer wait budget for network-backed screens or cold starts.

Link copied to clipboard

The minimum touch target from the Material accessibility guidelines.

Functions

Link copied to clipboard

Stops automatic advancing and steps the clock by count frames, so a test can observe an animation or effect frame by frame.

Link copied to clipboard

Asserts that this node lies within container, allowing tolerance pixels for rounding.

Link copied to clipboard

Asserts the node is at least minSize wide and tall.

Link copied to clipboard

Asserts that two nodes have usable bounds and do not overlap; touching edges are allowed.

Link copied to clipboard
fun assertReadingOrder(first: SemanticsNodeInteraction, second: SemanticsNodeInteraction, direction: ReadingDirection, rowTolerance: Float = ReadingOrder.DEFAULT_ROW_TOLERANCE)

Asserts that second is read after first on the same row in direction.

Link copied to clipboard

Captures the node's pixels as PNG bytes, for attaching to a failure or comparing with a reference outside a snapshot library.

Captures the node's pixels as PNG bytes, for attaching to a failure or comparing with a reference outside a snapshot library.

Link copied to clipboard
fun deviceConfiguration(locales: LocaleList? = null, layoutDirection: LayoutDirection? = null, fontScale: Float? = null, darkMode: Boolean? = null, size: DpSize? = null): DeviceConfigurationOverride

Combines the device settings a UI test most often varies into one override; null leaves a setting unchanged.

Link copied to clipboard

Returns the node's bounds in the root's pixel coordinates as a Frame.

Link copied to clipboard

Matches nodes whose test tag starts with prefix, such as every keyed row built from one automation identifier.

Link copied to clipboard

Finds the node whose content description is exactly label, case-sensitively.

Link copied to clipboard

Replaces the node's text and asserts the field now holds exactly text.

Link copied to clipboard
fun SemanticsNodeInteractionsProvider.scrollByViewport(vertical: Boolean = true, forward: Boolean = true, fraction: Float = 0.8f)

Scrolls the main container by fraction of the root's size on the given axis.

Link copied to clipboard

Returns the largest scrollable node on the given axis.

Link copied to clipboard

Scrolls a container until a node matching target is composed, and returns the target.

Link copied to clipboard
fun ComposeUiTest.waitForAnyTag(vararg tags: String, timeout: Duration = DefaultUiTimeout): String

Waits until a node with any of tags exists in the unmerged tree, and returns the first tag found in argument order. Use it when a screen can land in one of several states.

fun ComposeTestRule.waitForAnyTag(vararg tags: String, timeout: Duration = DefaultUiTimeout): String

Waits until a node with any of tags exists, and returns the first tag found in argument order.

Link copied to clipboard
fun ComposeUiTest.waitForContentDescription(description: String, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false): SemanticsNodeInteraction

Waits until a node with content description description is displayed and returns it.

fun ComposeTestRule.waitForContentDescription(description: String, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false): SemanticsNodeInteraction

Waits until a node with content description description is displayed and returns it.

Link copied to clipboard
fun ComposeUiTest.waitForTag(tag: String, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false): SemanticsNodeInteraction

Waits until a node with tag is displayed and returns it.

fun ComposeTestRule.waitForTag(tag: String, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false): SemanticsNodeInteraction

Waits until a node with tag is displayed and returns it.

Link copied to clipboard
fun ComposeUiTest.waitForText(text: String, substring: Boolean = false, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false): SemanticsNodeInteraction

Waits until a node showing text is displayed and returns it.

fun ComposeTestRule.waitForText(text: String, substring: Boolean = false, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false): SemanticsNodeInteraction

Waits until a node showing text is displayed and returns it.

Link copied to clipboard
fun ComposeUiTest.waitUntilDisplayed(matcher: SemanticsMatcher, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false): SemanticsNodeInteraction

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

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

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

Link copied to clipboard
fun ComposeUiTest.waitUntilGone(matcher: SemanticsMatcher, timeout: Duration = DefaultUiTimeout, useUnmergedTree: Boolean = false)

Waits until no node matching matcher is displayed; nodes that exist off screen count as gone.

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

Waits until no node matching matcher is displayed.