Issue
With Espresso is it possible to simplify those two statements ?
onView(withText(expectedErrorTitle))
.check(matches(isDisplayed()));
onView(withText(expectedErrorMessage))
.check(matches(isDisplayed()));
I tried with this one but it doesn't work :
onView(allOf(
withText(expectedErrorTitle),
withText(expectedErrorMessage)
)).check(matches(isDisplayed()));
Solution
Why simplify more? But you could check on a parent view to have children with expected text.
onView(R.id.parentLayout)
.check(matches(allOf(
isDisplayed(),
withChild(withText("A")),
withChild(withText("B"))
)));
Checking that the parent is displayed could be enough or you do more crazy stuff like
onView(R.id.parentLayout)
.check(matches(allOf(
withChild(allOf(withText("A"), isDisplayed())),
withChild(allOf(withText("B"), isDisplayed())),
)));
Answered By - nenick
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.