Skip to content

Commit

Permalink
feat: Add 'mobile: deviceidle' extension (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Oct 17, 2023
1 parent 65c62e5 commit 5c59c10
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,19 @@ Starts Android logcat broadcast websocket on the same host and port where Appium

Stops the previously started logcat broadcasting websocket server. This method will return immediately if no server is running. Read [Using Mobile Execution Commands to Continuously Stream Device Logs with Appium](https://appiumpro.com/editions/55-using-mobile-execution-commands-to-continuously-stream-device-logs-with-appium) for more details.

### mobile: deviceidle

This is a wrapper to 'adb shell dumpsys deviceidle' interface.
Read [Diving Into Android 'M' Doze](https://www.protechtraining.com/blog/post/diving-into-android-m-doze-875) for more details.
This API only exists since Android 6.

#### Arguments

Name | Type | Required | Description | Example
--- | --- | --- | --- | ---
action | whitelistAdd or whitelistRemove | yes | The name of the action to perform | whitelistAdd
packages | string or string[] | yes | One or more package names to perfom the above action on | 'com.mycompany'

### mobile: acceptAlert

Tries to accept an Android alert. This method might not always be reliable as there is no single standard for how Android alerts should look like within the Accessibility representation.
Expand Down
8 changes: 8 additions & 0 deletions lib/execute-method-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ export const executeMethodMap = {
command: 'mobileStopLogsBroadcast',
},

'mobile: deviceidle': {
command: 'mobileDeviceidle',
params: {
required: ['action'],
optional: ['packages'],
},
},

'mobile: acceptAlert': {
command: 'mobileAcceptAlert',
params: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
"dependencies": {
"appium-adb": "^9.14.12",
"appium-android-driver": "^7.0.1",
"appium-android-driver": "^7.1.0",
"appium-chromedriver": "^5.6.5",
"appium-uiautomator2-server": "^5.12.2",
"asyncbox": "^2.3.1",
Expand Down

0 comments on commit 5c59c10

Please sign in to comment.