How can I make a espresso test with the color of the text? Currently use hasTextColor():
onView(withId(R.id.editText)).check(matches(hasTextColor(Color.BLACK)));
But the error occurs:
android.content.res.Resources$NotFoundException: Resource ID #0xff000000 at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:195)
...
Details:
<EditText
android:id="@+id/editText"
android:textColor="#ff000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="48dp"/>
To start recording a test with Espresso Test Recorder, proceed as follows: Click Run > Record Espresso Test. In the Select Deployment Target window, choose the device on which you want to record the test. If necessary, create a new Android Virtual Device.
Espresso is a UI test framework (part of the Android Testing Support Library) that allows you to create automated UI tests for your Android app.
A matcher that allows for a quick creation of a matcher that applies to a given type but only processes items of a specific subtype of that matcher. BoundedMatcher. Some matcher sugar that lets you create a matcher for a given type but only process items of a specific subtype of that matcher.
You need to check against a color defined in the resources like hasTextColor(R.color.red)
It's also written in the documentation link you provided:
colorResId : int
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With