Reputation: 539
I am new to Espresso and I have this problem: How can I check if some checkBox is checked? I create a matcher from checkbox and I click on it by espresso.
I read some tutorial about use getInstrumentation() but I only can use InstrumentationRegistry.getInstrumentation() and it doesnt work.
In general, how can I create real widget such as Button, CheckBox etc. from Matcher object?
Thanks for help.
Upvotes: 12
Views: 4850
Reputation: 437
After click you can check that checkbox is checked with such expression:
onView(withId(R.id.checkbox)).check(matches(isChecked()));
Upvotes: 15