---
title: "assertContentDescriptionContains"
description: "Asserts that the node's list of content descriptions contains the given value."
type: "function"
lastmod: "2026-06-18T10:32:52.738267Z"
---
## API Reference

### assertContentDescriptionContains

> Source set: Common

```kotlin
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. |

## Code Examples
### assertContentDescriptionContainsSample
```kotlin
fun assertContentDescriptionContainsSample() {
    composeTestRule.setContent {
        // Explicitly merging descendants to demonstrate list semantics
        Row(Modifier.semantics(mergeDescendants = true) { testTag = "iconRow" }) {
            Icon(ColorPainter(Color.Red), contentDescription = "Navigate Up")
            Icon(ColorPainter(Color.Yellow), contentDescription = "Go Home")
        }
    }
    // The merged content description list is: ["Navigate Up", "Go Home"]
    // "Navigate Up" is an exact match for one of the items in the list.
    composeTestRule.onNodeWithTag("iconRow").assertContentDescriptionContains("Navigate Up")
    // "Navigate" is a substring of an item in the list, and we explicitly enable substring
    // matching.
    composeTestRule
        .onNodeWithTag("iconRow")
        .assertContentDescriptionContains("Navigate", substring = true)
}
```
