RunTimeException in Android espresso when selecting spinner in dialog
I had the same error when I tried to match an item inside a spinner inside a dialog-fragment. This helped:
onView(withText(value)).inRoot(isPlatformPopup()).perform(click());
Try this:
onData(allOf(is(instanceOf(String.class)), is(value)))
.inRoot(isPlatformPopup()).perform(click());