Skip to content

Instantly share code, notes, and snippets.

@iRYO400
Last active January 29, 2019 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iRYO400/289b1232521305e9c89042123d437063 to your computer and use it in GitHub Desktop.
Save iRYO400/289b1232521305e9c89042123d437063 to your computer and use it in GitHub Desktop.
// Spinner. Click->Select->Check
YourObject expectedText = YourObject.PIECE; // for example, if it's ENUM
onData(allOf(is(instanceOf(YourObject.class)), is(expectedText))).perform(click());
onView(withId(R.id.spinner)).check(matches(withSpinnerText(containsString(expectedText.name()))));
// Spinner. Click on Spinner by id-> then Select exact what you need by specifying expectedText
onView(withId(R.id.spinner))
.perform(click());
Measure expectedText = Measure.PIECE;
onData(allOf(is(instanceOf(Measure.class)), is(expectedText))).perform(click());
// AutoCompleteTextView with suggestions, e.g. Spinner
// Click on AutoCompleteTextView, it will show a list of suggestions
onView(withId(R.id.supplier))
.perform(click());
// Then click on item by position
onData(anything())
.inRoot(RootMatchers.isPlatformPopup())
.atPosition(0)
.perform(click());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment