Issue
I have a Spinner with various options. After clicking on any option, a fragment is loaded in a FrameLayout in the activity. Using Espresso I am selecting and clicking a Spinner item without any errors, but after that the view hierarchy contains only the spinner PopupViewContainer and I can't select any view in my activity.
My test code is the following:
onView(withId(R.id.pager)).perform(swipeLeft()).perform(swipeLeft());
onView(withId(R.id.fgs_cbx_scan_type)).perform(click());
onData(hasToString(startsWith(GreenScanType.ARRIVAL.getName()))).inAdapterView(withId(R.id.fgs_cbx_scan_type)).perform(click());
//So far so good with no errors. Then the following call fails
//because the view hierarchy does not contain the hierarchy
//of the activity anymore but just the popup of the spinner.
onView(withId(R.id.fgs_cbx_scan_type)).check(matches(withText(containsString(GreenScanType.ARRIVAL.getName()))));
Is there something I am missing or doing wrong?
Solution
Eventually I had to also call
onView(withText(GreenScanType.ARRIVAL.getName())).perform(click());
after onData
Answered By - alfoks
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.