assertContains

suspend fun assertContains(tag: String, substring: String)

Asserts that the UI element matching string tag contains the substring.

Includes built-in waiting for the text substring to appear.

Example Usage

assertContains("result_summary", "3 items found")

Parameters

tag

The testTag string or visible text of the element.

substring

The expected substring contained within the element's text.

See also

Throws

If the element text does not contain substring within the timeout.


suspend fun assertContains(selector: Selector, substring: String)

Asserts that the UI element matching selector contains the substring.

Advanced variant using explicit selectors. Includes built-in waiting.

Example Usage

assertContains(tag("description_box"), "Compose Multiplatform")

Parameters

selector

Explicit selector targeting the UI element.

substring

The expected substring contained within the element's text.

Throws

If the element text does not contain substring within the timeout.