assertTextEquals
fun SemanticsNodeInteraction.assertTextEquals(
vararg values: String,
includeEditableText: Boolean = true,
): SemanticsNodeInteraction
Asserts that the node's list of text values contains exactly the given values and nothing else.
This will also search in SemanticsProperties.EditableText by default.
The Text property is represented as a list of strings. In the merged semantics tree (the default in Compose testing), this list often contains multiple text items merged from child nodes. This function evaluates the entire list.
The assertion will only pass if the node's list contains all the provided values, and contains no additional items. Note that the order of the elements does not matter.
Typically, accessibility tooling will decide based on its heuristics which ones to use.
Throws AssertionError if the node's text values don't contain all items from values, or if the text values contain extra items that are not in values.
Parameters
| values | List of values to match (the order does not matter). |
| includeEditableText | Whether to also assert against the editable text. Defaults to true. |