Zach Klippenstein (he/him) [MOD]
06/10/2021, 6:10 AMuseUnmergedTree=true to the node matcher, which seems unintuitive.Zach Klippenstein (he/him) [MOD]
06/10/2021, 7:54 PMIconButton(Modifier.testTag("button") {
Icon(…, contentDescription = "the button icon")
}
Since IconButton uses clickable it merges its semantic descendents. So it would seem intuitive to write a test like this for it:
onNodeWithTag("button").assertContentDescriptionEquals("the button icon")
However that test fails, because the content description property is nowhere to be found in the merged tree.
That seems intuitive to me because it works for text. Given:
Button(Modifier.testTag("button")) { Text("text") }
This test passes:
onNodeWithTag("button").assertTextEquals("text")
because the merged semantics node identified by the tag “button” actually has its own Text property, merged in from the child.
Content description does not work this way – seems like a bug to me, but I could be thinking of “content description” in the wrong way.Zach Klippenstein (he/him) [MOD]
06/10/2021, 7:55 PM