I'm starting to play with Espresso, got my basic tests running. Now trying to figure out how to check that my edit text has a specific hint text? Thanks.
onView(withId(R.id.locationInput)).check(matches...?)
I'm starting to play with Espresso, got my basic tests running. Now trying to figure out how to check that my edit text has a specific hint text? Thanks.
onView(withId(R.id.locationInput)).check(matches...?)
Since Espresso 2.0 just use internal ViewMatcher withHint:
I've created a Matcher that supports passing a resourceId instead of a String
It's a replication of Espresso's withText matcher pointed by Valera Zakharov (withText(resourceId)
There is a slightly different way to do it. In my case you check that the String is not null, before pass it to matcher (as explained in Espresso examples). And also in code below you don't need the R.id of the EditText with this hint. You just check if hint with "hintText" is displayed:
Usage:
Looks like I figured it out. Basically, you need to create your own matcher:
Then you can use it: