AutomationId

class AutomationId(val namespace: String)(source)

Builds stable, cross-platform UI automation identifiers such as myapp.home.feed.video_card.intro%20clip.

Identifiers have the shape <namespace>.<screen>.<region>.<element>[.<key>]. Every segment except the key must be lowercase snake_case; the optional key, such as a content ID, is percent-encoded with only RFC 3986 unreserved characters left as-is, so iOS and Android produce identical strings. Keep an app's catalog of identifiers in the app and build each one with make; use them for test tags, not for spoken accessibility text.

val ids = AutomationId("myapp")
Modifier.testTag(ids.make("home", "feed", "video_card", key = video.id))

Constructors

Link copied to clipboard
constructor(namespace: String)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The app-wide first segment.

Functions

Link copied to clipboard
fun make(screen: String, region: String, element: String, key: String? = null): String

Returns the identifier for one element.