---
title: "assertTextEquals"
description: "Asserts that the node's list of text values contains exactly the given values and nothing else."
type: "function"
lastmod: "2026-06-18T10:32:52.770951Z"
---
## API Reference

### assertTextEquals

> Source set: Common

```kotlin
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](/jetpack-compose/androidx.compose.ui/ui/properties/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. |

## Code Examples
### assertTextEqualsSample
```kotlin
fun assertTextEqualsSample() {
    composeTestRule.setContent {
        // Explicitly merging descendants to demonstrate list semantics
        Row(Modifier.semantics(mergeDescendants = true) { testTag = "textRow" }) {
            Text("Hello")
            Text("World")
        }
    }
    // The merged text list is: ["Hello", "World"]
    // We provide all items exactly as they appear in the merged list.
    // Order does not matter.
    composeTestRule.onNodeWithTag("textRow").assertTextEquals("World", "Hello")
}
```
