Skip to content

Commit

Permalink
feat: Expose keyboard extensions (#870)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Apr 18, 2023
1 parent 3e8b531 commit 3a91658
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ List of fully qualified class names of currently registered idling resources or

### mobile: waitForUIThread

- Wait for the UI thread to become idle, in other words, wait for the APP to become idle(https://developer.android.com/reference/androidx/test/espresso/UiController#loopMainThreadUntilIdle()).
- Wait for the UI thread to become idle, in other words, wait for the APP to become [idle](https://developer.android.com/reference/androidx/test/espresso/UiController#loopMainThreadUntilIdle()).
- Use case: On compose and native combination screens, it's possible for the Espresso API to block the UI thread, which can cause the app to freeze. To resolve this issue, it's recommended to explicitly call the `mobile:waitForUIThread` API, which can help to unfreeze the UI thread.


Expand Down Expand Up @@ -1187,6 +1187,23 @@ formFields | Map<string, string> or Array<Pair> | no | Additional fo

Base64-encoded content of the recorded media file if `remotePath` argument is falsy or an empty string.

### mobile: hideKeyboard

Tries to hide the on-screen keyboard. Throws an exception if the keyboard cannot be hidden.
Does nothing if the keyboard is already hidden.

#### Returned Result

`true` if the keyboard was successfully hidden or `false` if it was already invisible.

### mobile: isKeyboardShown

Checks if the system on-screen keyboard is visible.

#### Returned Result

`true` if the keyboard is visible


## Backdoor Extension Usage

Expand Down
3 changes: 3 additions & 0 deletions lib/commands/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ extensions.executeMobile = async function executeMobile (mobileCommand, opts = {
startMediaProjectionRecording: 'mobileStartMediaProjectionRecording',
isMediaProjectionRecordingRunning: 'mobileIsMediaProjectionRecordingRunning',
stopMediaProjectionRecording: 'mobileStopMediaProjectionRecording',

hideKeyboard: 'mobileHideKeyboard',
isKeyboardShown: 'isKeyboardShown',
};

if (!_.has(mobileCommandsMapping, mobileCommand)) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"dependencies": {
"@babel/runtime": "^7.4.3",
"appium-adb": "^9.10.2",
"appium-android-driver": "^5.8.7",
"appium-android-driver": "^5.10.0",
"asyncbox": "^2.3.1",
"bluebird": "^3.5.0",
"lodash": "^4.17.11",
Expand Down

0 comments on commit 3a91658

Please sign in to comment.