From c1dd4460b35ee4d0a5325d4481e4b4394238531c Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Fri, 10 May 2024 22:23:17 +0200 Subject: [PATCH] feat: Add helpers to control bluetooth and nfc adapters --- README.md | 24 ++++++++++++++++++++++++ lib/execute-method-map.ts | 16 +++++++++++++++- package.json | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb9051bbb..e74ffceaf 100644 --- a/README.md +++ b/README.md @@ -1503,6 +1503,30 @@ Name | Type | Required | Description | Example --- | --- | --- | --- | --- payload | string | yes | A valid base64-encoded .PNG image payload. Other image formats are not supported. This image will be shown on the virtual scene foreground as soon as you open a camera client app. | iVBORw0KGgoAAAANSUh... +### mobile: bluetooth + +Allows to control the bluetooth adapter in the device under test. +An error is thrown if the device has no default bluetooth adapter. +Available since driver version 3.4.0 + +#### Arguments + +Name | Type | Required | Description | Example +--- | --- | --- | --- | --- +action | string | yes | The action to execute on the bluetooth adapter. The following actions are supported: `enable`, `disable`, `unpairAll`. Calling the same action more than once is a noop. | disable + +### mobile: nfc + +Allows to control the NFC adapter in the device under test. +An error is thrown if the device has no default NFC adapter. +Available since driver version 3.4.0 + +#### Arguments + +Name | Type | Required | Description | Example +--- | --- | --- | --- | --- +action | string | yes | The action to execute on the NFC adapter. The following actions are supported: `enable`, `disable`. Calling the same action more than once is a noop. | disable + ## Applications Management UiAutomator2 driver supports Appium endpoints for applications management: diff --git a/lib/execute-method-map.ts b/lib/execute-method-map.ts index 815d88e95..956093a1a 100644 --- a/lib/execute-method-map.ts +++ b/lib/execute-method-map.ts @@ -604,7 +604,21 @@ export const executeMethodMap = { params: { optional: ['opts'], } - } + }, + + 'mobile: bluetooth': { + command: 'mobileBluetooth', + params: { + optional: ['opts'], + } + }, + + 'mobile: nfc': { + command: 'mobileNfc', + params: { + optional: ['opts'], + } + }, } as const; export type Uiautomator2ExecuteMethodMap = typeof executeMethodMap; diff --git a/package.json b/package.json index f36d1c1de..769ecc00c 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ }, "dependencies": { "appium-adb": "^12.2.0", - "appium-android-driver": "^9.3.0", + "appium-android-driver": "^9.5.0", "appium-chromedriver": "^5.6.28", "appium-uiautomator2-server": "^7.0.1", "asyncbox": "^3.0.0",