If you get this error:
Caused by: androidx.test.espresso.InjectEventSecurityException: java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
Then,
In the ApplicationTest file:
Replace:
onView(withId(R.id.password)).perform(typeText("password"), closeSoftKeyboard())
with:
onView(withId(R.id.password)).perform(replaceText("password"), closeSoftKeyboard())
If you get this error: Caused by: androidx.test.espresso.InjectEventSecurityException: java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
Then, In the ApplicationTest file: Replace:
onView(withId(R.id.password)).perform(typeText("password"), closeSoftKeyboard())
with:onView(withId(R.id.password)).perform(replaceText("password"), closeSoftKeyboard())
(two places in the file)