testTagsAsResourceId

Property

Android
var SemanticsPropertyReceiver.testTagsAsResourceId

Configuration toggle to map testTags to resource-id.

This provides a way of filling in AccessibilityNodeInfo.viewIdResourceName, which in the View System is populated based on the resource string in the XML.

testTags are also provided in AccessibilityNodeInfo.extras under key "androidx.compose.ui.semantics.testTag". However, when using UIAutomator or on Android 7 and below, extras are not available, so a more backwards-compatible way of making testTags available to accessibility-tree-based integration tests is sometimes needed. resource-id was the most natural property to repurpose for this.

This property applies to a semantics subtree. For example, if it's set to true on the root semantics node of the app (and no child nodes set it back to false), then every testTag will be mapped.