How to click editor on Espresso
"pressKey" expects a KEY, not a FLAG. So pressing the key (KeyEvent.FLAG_EDITOR_ACTION) doesn't really make sense and definitely won't work.
But there is a ViewAction to press the editor action (IME), see static method: ViewActions # pressImeActionButton ()
You can see the implementation details for Espresso 1.x here:
source to share
To send a shared key press in espresso, use something like this:
onView(isRoot()).perform(pressKey(KeyEvent.KEYCODE_MENU));
This, for example, will dispatch a hardware menu button event to any view to open the overflow menu in the action / toolbar.
Note: To quickly add imports for these methods, place the blinking cursor on the unresolved method and then run Android Studio β Help β Find Action β Find "show intention action"
β click the result parameter β A popup will appear β click on "Import static method ..."
. You can also assign a keyboard shortcut for Show Intentional Actions. More details here . Another way is to enable it "Add unambiguous imports on the fly"
in the settings.
source to share