From 94db79260b6b764a7592ba486cc4055755af3600 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Mon, 18 Mar 2024 14:31:56 -0700 Subject: [PATCH] feat: add mobile:startLogsBroadcast and mobile:stopLogsBroadcast (#988) * feat: add mobile:startLogsBroadcast and mobile:stopLogsBroadcast * add description about startLogsBroadcast and stopLogsBroadcast --- README.md | 8 ++++++++ lib/commands/execute.js | 3 +++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index ea772292..f220d71f 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/lib/commands/execute.js b/lib/commands/execute.js index 82424c53..d6b80928 100644 --- a/lib/commands/execute.js +++ b/lib/commands/execute.js @@ -121,6 +121,9 @@ export async function executeMobile (mobileCommand, opts = {}) { setUiMode: 'mobileSetUiMode', getUiMode: 'mobileGetUiMode', + + startLogsBroadcast: 'mobileStartLogsBroadcast', + stopLogsBroadcast: 'mobileStopLogsBroadcast', }; if (!_.has(mobileCommandsMapping, mobileCommand)) {