Reputation: 15113
I am trying use a function to check consistency of the activity graphic elements at any time. I found out that when the progressdialog is showing the espresso can't find any view bellow. Is there any way get the view bellow?
Upvotes: 3
Views: 746
Reputation: 158
onView(withText("Request Number")).inRoot(not(isDialog())).perform(click());
Worked for me!
Request Number is a 'text' on 'Button'
Upvotes: 0
Reputation: 10155
Yes, you use a RootMatcher. For example:
// Specifically target the main window view hierarchy
onView(withId(R.id.view_to_match))
.inRoot(withDecorView(is(getActivity().getWindow().getDecorView())))
.perform(click());
Or maybe:
// Specifically disregard the dialog window view hierarchy
onView(withId(R.id.view_to_match))
.inRoot(not(isDialog()))
.perform(click());
See the official documentation for an example.
Hope that helps!
Upvotes: 3