assertTextContains

Function

Common
fun SemanticsNodeInteraction.assertTextContains(
    value: String,
    substring: Boolean = false,
    ignoreCase: Boolean = false,
): SemanticsNodeInteraction

Asserts that the node's text contains the given value.

This will also search in SemanticsProperties.EditableText and SemanticsProperties.InputText.

Note that in merged semantics tree there can be a list of text items that got merged from the child nodes. Typically an accessibility tooling will decide based on its heuristics which ones to use.

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

Parameters

valueValue to match as one of the items in the list of text values.
substringWhether this can be satisfied as a substring match of an item in the list of text.
ignoreCaseWhether case should be ignored.