Issue
I am writing some tests with espresso. I want to click on checkbox and checked it with test. But I can't. I tried with ıd and contentdescription. Espresso found views but can't perform.
onView(withContentDescription("register check box 1"))
.check(matches(isNotChecked()))
.perform(click())
.check(matches(isChecked()));
I got that error.
android.support.test.espresso.PerformException: Error performing 'sıngle click' on view 'with content description: is "register check box 1"'.
at android.support.test.espresso.PerformException$Builder.build(PerformException.java:83)
at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:70)
at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:53)
at android.support.test.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:184)
at android.support.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:115)
at android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:87)
Solution
I found the solution. In my view xml checkbox has that line android:layout_marginLeft="-5dp". I remove it and works perfectly. But I can't understand the reason.
Answered By - Selim YILDIZ
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.