Issue
I have a simple linear layout with two textviews inside it. The linear layout has an unique id but the textviews don't have. How do I verify one of the texts is from those textviews?
I tried the following code:
onView(allOf(NavigationDrawerComponent.topSectionWrapper,
hasSibling(withClassName(Matchers.equalTo(TextView.class.getSimpleName())))))
.check(matches(withText(Data.fullUserName)));
Unfortunately,its not working for me.I am getting the following error:
android.support.test.espresso.NoMatchingViewException: No views in
hierarchy found matching
Solution
Use hasDescendant()
onView(withId(R.id.recycler_view)).check(matches(atPosition(0, hasDescendant(withText("Available")))));
Answered By - Prabin Timsina
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.