Returns the bounds of the first link matching the [predicate], or if that link spans multiple lines, returns the bounds of the first line of the link.
hoverFirstLinkInText
fun hoverFirstLinkInText() {
// Example of hovering over the first link in test
val firstLinkBounds =
composeTestRule.onNodeWithText("YOUR_TEXT_WITH_LINK").getFirstLinkBounds {
(it.item as? LinkAnnotation.Url)?.url == "YOUR_URL"
}
composeTestRule.onNodeWithText("YOUR_TEXT_WITH_LINK").performMouseInput {
moveTo(firstLinkBounds!!.center)
}
}