How do you press the Editor Action key on Android softkey using Espresso? I tried:
onView(withId(R.id.test_title)).perform(typeText("Sample Title"), pressKey(KeyEvent.FLAG_EDITOR_ACTION));
But it’s not working.. Any idea?
“pressKey” expects a KEYCODE, not a FLAG. So pressKey(KeyEvent.FLAG_EDITOR_ACTION) doesn’t really make sense and will definitely not work.
But there is a ViewAction for pressing the editor (IME) action, see the static method: ViewActions#pressImeActionButton()
You can view the Espresso 1.x implementation details here:
Answered By – yogurtearl