@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())));
}
I ran into a problem when testing Espresso with a view that included animation, I know that Espresso cannot deal with animation, so I did this below. - disable my test device. Window animation, transition animation, and animator animation duration are all set to OFF (this does not work) - then I tried to add a flag to my code, for example. espresso_testing = true. if true, my code skips the call to the startAnimation () function. ---> It works. However, there is a requirement that I cannot change the code in my application while writing an espresso test. The test case above is included.
Is there any other way to do this? Thanks in advance.