Hello is there any way to test with compose-ui-tes...
# compose
j
Hello is there any way to test with compose-ui-test that a Text has the text color that I expect? Or a Row/Column that has the background color that I expect?
m
Not directly. Remember you are not testing views, you are testing the semantic tree. Try putting this right after your setContent:
Copy code
println(composeTestRule.onRoot().printToString())
If it’s not in that symantic tree, you’re unlikely to be able to test it. You can, however always add your own semantic properties. For instance, my app has it’s own design system that’s not Material Design. We have a “tone” property that affects the colors, and based on the “tone”, we use different colors for filled buttons, etc…. So we created a semantic property to represent the tone of the button, and we test that, rather than directly trying to test colors.