title: Espresso testing disable animation
body: <p><a href="https://i.stack.imgur.com/Ory46.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Ory46.png" alt="enter image description here"></a></p>
  
  <pre><code>@Test
      public void test3_PaySuccessful(){
          init();
  
      ViewInteraction amountEditText = onView(
              allOf(withId(R.id.et_amount), isDisplayed()));
      amountEditText.perform(replaceText("SGD 0.010"), closeSoftKeyboard());
  
      //, withText("Proceed")
      ViewInteraction appCompatButton = onView(
              allOf(withId(R.id.btn_confirm), isDisplayed()));
      appCompatButton.perform(click());
  
      //, withText("Pay")
      ViewInteraction appCompatButton2 = onView(
              allOf(withId(R.id.btn_confirm), isDisplayed()));
      appCompatButton2.perform(click());
  
      //dialog
      ViewInteraction appCompatButton3 = onView(
              allOf(withId(R.id.confirm_button), withText("Confirm"), isDisplayed()));
      appCompatButton3.perform(click());
  
      //have to disable animation in order to pass this.
      intended(CoreMatchers.allOf(hasComponent(PaymentSelectionActivity2.class.getName())));
  
  }
  </code></pre>
  
  <p>I encountered an issue on doing Espresso testing with a view involving animation, I know Espresso cannot deal with animation, so i did below.
  - disable my test device Window animation, transition animation and animator duration scale all set to OFF (this does not work)
  - then i tried to add a flag in my code eg. espresso_testing = true. if true, my code will skip calling all startAnimation() function call. ---> this is working. However, there is a requirement that I cannot change code on my app while writing espresso test case. Included a test case above. </p>
  
  <p>Is there any other way to do this?  Thanks in advance.</p>