There is a list to which I add names from another list, but at the moment the list is empty. I try using espresso tests to determine that the list does not contain a specific name:
ViewInteraction textView2 = onView(withId(R.id.persname)) .check(matches(hasDescendant(withText("Петя")))); textView2.check(matches(not(isDisplayed()))); Knocks an error:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.vm.sai: id / persname
I also tried this way:
ViewInteraction textView2 = onView( allOf(withId(R.id.persname), withText("Петя"), not(isDisplayed()))); textView2.check(matches(not(isDisplayed()))); And the error is as follows:
android.support.test.espresso.NoMatchingViewException: No matches in hierarchy found matching: (id: com.vm.sai: id / persname
But for example, in the list from which I add these names, checking if there is one, it shows what it is:
ViewInteraction textView = onView( allOf(withId(R.id.persname), withText("Петя"), isDisplayed())); textView.check(matches(withText("Петя")));