Skip to content

Instantly share code, notes, and snippets.

@mcatta
Created October 4, 2021 20:56
Show Gist options
  • Select an option

  • Save mcatta/1a721994fb20c9ee6f165dc4d8106caa to your computer and use it in GitHub Desktop.

Select an option

Save mcatta/1a721994fb20c9ee6f165dc4d8106caa to your computer and use it in GitHub Desktop.
Search node by semantics
// Search by contentDescription
composeTestRule.
onNodeWithContentDescription(label = "My fancy button").assertExists()
// Search by a text (for example a button label)
composeTestRule.onNode(hasText("My text label")).assertExists()
// Search by testTag
composeTestRule.onNode(hasTestTag("test_tag")).assertExists()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment