How do you press the Editor Action key on Android softkey using Espresso? I tried:
onView(withId(R.id.edToNumber)).perform(typeText("MDO158"),ViewActions.pressKey(KeyEvent.ACTION_UP), closeSoftKeyboard())

To click the ActionDone button from the keyboard of a Specific EditText, you could done by using this code:
onView(withId(R.id.edToNumber)).perform(typeText("MDO158");
onView(withId(R.id.edToNumber)).perform(pressImeActionButton());
Note:
pressImeActionButton() not specifically used for click the ActionDone button from the keyboard, it click whatever ActionButton that the keyboard consist such as ActionDone, ActionSearch, ActionNext, etc.
Optionally, you can close the keyboard of a Specific EditText without click the ActionDone button by using this code:
onView(withId(R.id.edToNumber)).perform(typeText("MDO158");
onView(withId(R.id.edToNumber)).perform(closeSoftKeyboard());
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