Shubham Singh
05/28/2025, 9:31 PMAnnotatedString
clickable link Text composables.
Some guidance would be much appreciated.
Example inside the thread 🧵Shubham Singh
05/28/2025, 9:31 PM@Test
fun bottomSheet_resendEmailClick_updatesText() {
composeTestRule.setContent {
SHTheme {
LoginScreen()
}
}
composeTestRule
.onNodeWithText("name@email.com") // Placeholder
.performTextInput("test@example.com")
composeTestRule
.onNodeWithText("CONTINUE")
.performClick()
// Click on the "Resend Now" part of the text.
composeTestRule
.onNodeWithText("Resend Now", substring = true)
.performClick()
// Verify the text changes
composeTestRule
.onNodeWithText(
"Still not seeing your verification email?",
substring = true
)
.assertIsDisplayed()
composeTestRule
.onNodeWithText(
"Resend Again",
substring = true
)
.assertIsDisplayed()
}
And it's giving me an error like:
java.lang.AssertionError: Failed to inject touch input.
Reason: Expected exactly '1' node but could not find any node that satisfies: (Text + InputText + EditableText contains 'Resend Now' (ignoreCase: false) as substring)
at androidx.compose.ui.test.SemanticsNodeInteraction.fetchOneOrThrow(SemanticsNodeInteraction.kt:178)
at androidx.compose.ui.test.SemanticsNodeInteraction.fetchOneOrThrow$default(SemanticsNodeInteraction.kt:150)
at androidx.compose.ui.test.SemanticsNodeInteraction.fetchSemanticsNode(SemanticsNodeInteraction.kt:84)
at androidx.compose.ui.test.ActionsKt.performTouchInput(Actions.kt:384)
at androidx.compose.ui.test.AndroidActions.performClickImpl(Actions.android.kt:23)
at androidx.compose.ui.test.ActionsKt.performClick(Actions.kt:60)