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
This helped me to resolve button visibility while running my tests
public static ViewAction handleConstraints(final ViewAction action, final Matcher constraints)
{
return new ViewAction()
{
@Override
public Matcher getConstraints()
{
return constraints;
}
@Override
public String getDescription()
{
return action.getDescription();
}
@Override
public void perform(UiController uiController, View view)
{
action.perform(uiController, view);
}
};
}
public void clickbutton()
{
onView(withId(r.id.button)).perform(handleConstraints(click(), isDisplayingAtLeast(65)));
}