title: Click on not fully visible imageButton with Espresso
body: <p>I have a custom <code>ImageButton</code> that is not fully visible, by design, so when I perform a click action I get this error:</p>
  
  <pre><code>android.support.test.espresso.PerformException: Error performing 'single click' on view 'with id: test.com.myproject.app:id/navigationButtonProfile'.
  Caused by: java.lang.RuntimeException: Action will not be performed because the target view does not match one or more of the following constraints:
  at least 90 percent of the view's area is displayed to the user.
  at android.support.test.espresso.ViewInteraction$1.run(ViewInteraction.java:138)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  at android.os.Handler.handleCallback(Handler.java:733)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:157)
  at android.app.ActivityThread.main(ActivityThread.java:5356)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>A small part of the button is outside of the screen (i.e. it is cropped on the top), maybe 12% of the button is outside the screen. This is by design, and there is not possible to scroll or perform any view action to make it visible.
  Any one know how to get past this 90%-constraint?</p>
  
  <p><strong>Solution:</strong>
  I created my own click action as suggested, and it worked perfectly.
  I copied the class from <a href="https://android.googlesource.com/platform/frameworks/testing/+/android-support-test/espresso/core/src/main/java/android/support/test/espresso/action/GeneralClickAction.java">Google Espresso</a> and changed from 90 to 75 in this method:</p>
  
  <pre><code>    @Override
      @SuppressWarnings("unchecked")
      public Matcher&lt;View&gt; getConstraints() {
          Matcher&lt;View&gt; standardConstraint = isDisplayingAtLeast(75);
          if (rollbackAction.isPresent()) {
              return allOf(standardConstraint, rollbackAction.get().getConstraints());
          } else {
              return standardConstraint;
          }
      }
  </code></pre>