Skip to content

Commit

Permalink
feat: add mobile:startLogsBroadcast and mobile:stopLogsBroadcast (#988)
Browse files Browse the repository at this point in the history
* feat: add mobile:startLogsBroadcast and mobile:stopLogsBroadcast

* add description about startLogsBroadcast and stopLogsBroadcast
  • Loading branch information
KazuCocoa authored Mar 18, 2024
1 parent ffbb4f2 commit 94db792
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,14 @@ Name | Type | Required | Description | Example
mode | string | yes | One of the supported UI mode names: `night` or `car`. | night


### mobile: startLogsBroadcast

Starts Android logcat broadcast websocket on the same host and port where Appium server is running at `/ws/session/:sessionId:/appium/logcat` endpoint. The method will return immediately if the web socket is already listening. Each connected webcoket listener will receive logcat log lines as soon as they are visible to Appium. 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: stopLogsBroadcast

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.

## Backdoor Extension Usage

Espresso driver allows to directly invoke a method from your application under test using `mobile: backdoor` extension. If `target` is set to `application` then methods will be invoked on the application class. If target is set to `activity` then methods will be invoked on the current application activity. If target is set to `element` then methods will be invoked on the selected view element. Only 'public' methods can be invoked ('open' modifier is necessary in Kotlin). The following primitive types are supported for method arguments: "int", "boolean", "byte", "short", "long", "float", "char". Object wrappers over primitive types with fully qualified names "java.lang.*" are also supported: "java.lang.CharSequence", "java.lang.String", "java.lang.Integer", "java.lang.Float", "java.lang.Double", "java.lang.Boolean", "java.lang.Long", "java.lang.Short", "java.lang.Character", etc.
Expand Down
3 changes: 3 additions & 0 deletions lib/commands/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ export async function executeMobile (mobileCommand, opts = {}) {

setUiMode: 'mobileSetUiMode',
getUiMode: 'mobileGetUiMode',

startLogsBroadcast: 'mobileStartLogsBroadcast',
stopLogsBroadcast: 'mobileStopLogsBroadcast',
};

if (!_.has(mobileCommandsMapping, mobileCommand)) {
Expand Down

0 comments on commit 94db792

Please sign in to comment.