I start my login activity and I use in Espresso test:
onView(withId(R.id.username)).perform(typeText("USERNAME"));
I expect the text in the field to be "USERNAME", but sometimes I get "SERNAME", others "UERNAME".
Most of the times it works but sometimes it fails, specially after rebooting the phone.
Here is the sample code to reproduce the bug: https://github.com/neoranga55/CleanGUITestArchitecture
You can also try replaceText()
. It should not be affected by the slow IME:
onView(withId(R.id.username)).perform(replaceText("USERNAME"));
The test phone uses Swift keyboard with double language typing enabled. Apparently this causes the first appearance of the keyboard after phone boot to be slow but also auto-correct in a weird way the first letters of a word typed by Espresso.
Solution: always use default system keyboard on testing device/emulator and make sure a software keyboard is enabled to avoid this other issue.
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