I have a custom ImageButton
that is not fully visible, by design, so when I perform a click action I get this error:
android.support.test.espresso.P
Create your own ViewAction class without view visibility constraints:
public static ViewAction myClick() {
return new ViewAction() {
@Override
public Matcher getConstraints() {
return ViewMatchers.isEnabled(); // no constraints, they are checked above
}
@Override
public String getDescription() {
return null;
}
@Override
public void perform(UiController uiController, View view) {
view.performClick();
}
};
}
Then to use it:
onView(withId(R.id.your_view_id)).perform(myClick());