Composables UI is out: our new component library for Compose Multiplatform ->
Function

assertContentDescriptionContains

Asserts that the node's list of content descriptions contains the given value.

assertContentDescriptionContains

Source set: Common
fun SemanticsNodeInteraction.assertContentDescriptionContains(
    value: String,
    substring: Boolean = false,
    ignoreCase: Boolean = false,
): SemanticsNodeInteraction

Asserts that the node's list of content descriptions contains the given value.

The ContentDescription property is represented as a list of strings. In the merged semantics tree (the default in Compose testing), this list often contains multiple descriptions merged from child nodes. This function evaluates whether any individual item in that list matches the provided value.

By default, this requires an exact string match with at least one complete item in the list.

Typically, accessibility tooling will decide based on its heuristics which descriptions to announce.

Throws AssertionError if the node's value list does not contain value, or if the node has no value.

Parameters

value Value to match against the items in the list of content descriptions.
substring Whether this can be satisfied as a substring match of an item in the list of descriptions. Defaults to false.
ignoreCase Whether case should be ignored. Defaults to false.

Last updated: