I am kind of New to Android Espresso testing.
My question is that I have a View Interaction named SampleButton and when I click it, I would like to check whether the other View Interaction (TextResult) contains either "clean" or "infected" string. So the expected code is sth like this:
SampleButton.perform(click()); // SampleButton is View Interaction
ViewInteraction TextResult = onView(withId(R.id.inference_result)); // TextResult is also a View Interaction
TextResult.check(matches(withText("clean") or withText("infected"))) // THROWS AN ERROR
So the last line of code throws an error , meaning that it doesn't recognize "or" opertation.
EDIT:
So after a more precise search, it looks like this is the result:
TextResult.check(matches(withText(anyOf(is("infected") , is("clean")))));
by using anyOf and is, we can make "or opertaion"
Any help is highly appreciated! Thanks.