Running tests on android devices with sdk 26
causes them to fail because of the new Autofill feature that hides the fields when espresso are trying to click them.
Im running my tests on firebase test lab so I cannot disable them manually on my tests devices.
Some images:
Espresso cant click now password field since the autofill dialog is hiding my field and fail
.
Using AutofillManager#disableAutofillServices()
only disabled the #2. dialog but #3. is still there.
How to disable Autofill on test devices?
Based on documentation, you can disable Autofill services using AutofillManager#disableAutofillServices()
API:
If the app calling this API has enabled autofill services they will be disabled.
Usage:
val autofillManager: AutofillManager = context.getSystemService(AutofillManager::class.java) autofillManager.disableAutofillServices()
You can do this in @Before
step of your test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With