ultron icon indicating copy to clipboard operation
ultron copied to clipboard

Add `assertStateDescriptionContains`

Open Darocs opened this issue 1 year ago • 3 comments

I think adding a assertStateDescriptionContains would not be unreasonable

Darocs avatar Jun 19 '24 08:06 Darocs

Could you extend the description and provide some samples.

alex-tiurin avatar Jun 19 '24 12:06 alex-tiurin

For example, in compose I have a validation for OutlinedTextField, and when the validation works through, it sets isError to either true or false. In the code, I would like to change the stateDescription depending on the isError received. For example stateDescription = if (isError) "invalid" else "valid" In the test, I find the text field via contentDescription and check its validity via assertStateDescriptionContains("valid") or assertStateDescriptionContains("invalid")

I'm new to Ultron, so I don't know if this is the right idea

Darocs avatar Jun 19 '24 13:06 Darocs

You can also see how I solved this Issue in my Validation_Etude repository at this path: app/src/androidTest/java/en/polescanner/validation_etude/ui/reusable/components/Assertions.kt

Darocs avatar Jun 20 '24 07:06 Darocs