Request for further documentation
aiavci opened this issue · comments
Version
v0.2.0
Details
The documentation on this library has much room for improvement. I'm getting an error when using this library but I'm not even if I'm using it the way it was intended.
Bug Details
When I call:
onView(withChild(withTextViewDrawableLeft(R.drawable.example))) .check(matches(isDisplayed()))
I get:
java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable$ConstantState android.graphics.drawable.Drawable.getConstantState()' on a null object reference at com.vanniktech.espresso.core.utils.Utils.drawableMatches(Utils.java:46)
The image you're checking against has no drawable set. Are you missing javadoc?
To my understanding the correct approach is to validate against specific views instead of the method actually finding the drawable for you. This wasn't clear through the documentation.
i.e. Instead of calling:
onView(withId(R.id.example_view))
.check(matches(withTextViewDrawableLeft(R.drawable.example))))
I should have called:
onView(withId(R.id.example_view)).check(matches(withTextViewDrawableLeft(R.drawable.example)))
Oh okay got it. I'll do some more javadoc and also adjust the README.
I hope you like the improvements. Thanks for the suggestion.