I am unable to perform my android espresso unit test and it has failed with:
// (kotlin syntax)
closeSoftKeyboard()
onView(withId(R.id.et_login_mobile_number)).perform(TypeTextAction(invalidMobileNo))
closeSoftKeyboard()
androidx.test.espresso.InjectEventSecurityException: java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission.
I finally learned that: ANY UNEXPECTED animation appeared on UI that is undergoing automated testing could interrupt the process.
So I suspect this is due to the Google Password Manager that suggesting the list of saved password keep popping up and it might be the one causing the interruption.
What I'm looking now is: THE WAY OF TURNING OFF GOOGLE PASSWORD MANAGER FROM SUGGESTING SAVED PASSWORD
All I keep found is
And there is no way to turn it off / disable it
After I ended up delete all the saved passwords from Google Password Manager and now it turned up suggest autofill text (Kindly compare both screenshot)
I have included attributes as followed, it still DOES NOT PREVENT autofill to device with Android 8 and above.
android:inputType="number|textNoSuggestions|textFilter"