From 0e6c8fed60345125f8ca78d70bb8e934cd50a6bc Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Fri, 5 Jan 2024 21:53:19 +0100 Subject: [PATCH] feat: Add doctor checks (#711) --- .github/workflows/functional-test.yml | 1 + README.md | 5 +++++ lib/doctor/optional-checks.js | 5 +++++ lib/doctor/required-checks.js | 6 ++++++ package.json | 12 +++++++++--- 5 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 lib/doctor/optional-checks.js create mode 100644 lib/doctor/required-checks.js diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index fa8999341..97a49eab6 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -66,6 +66,7 @@ jobs: pushd "$cwd" cd ~ CHROMEDRIVER_VERSION="${{ matrix.chromedriverVersion }}" appium driver install --source=local "$cwd" + appium driver doctor uiautomator2 nohup appium server \ --port=$APPIUM_TEST_SERVER_PORT \ --address=$APPIUM_TEST_SERVER_HOST \ diff --git a/README.md b/README.md index 239265bcc..879a9217e 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,11 @@ On top of standard Appium requirements UiAutomator2 driver also expects the foll - Real Android devices must have [USB debugging enabled](https://developer.android.com/studio/debug/dev-options) and should be visible as `online` in `adb devices -l` output. - The minimum version of Android API must be 5.0 (API level 21) (6.0 is recommended as version 5 has some known compatibility issues). +### Doctor + +Since driver version 2.39.0 you can automate the validation for the most of the above +requirements as well as various optional ones needed by driver extensions by running the +`appium driver doctor uiatomator2` server command. ## Capabilities diff --git a/lib/doctor/optional-checks.js b/lib/doctor/optional-checks.js new file mode 100644 index 000000000..6011cba00 --- /dev/null +++ b/lib/doctor/optional-checks.js @@ -0,0 +1,5 @@ +import { doctor } from 'appium-android-driver'; + +export const optionalBundletoolCheck = doctor.optionalBundletoolCheck; +export const optionalGstreamerCheck = doctor.optionalGstreamerCheck; +export const optionalFfmpegCheck = doctor.optionalFfmpegCheck; diff --git a/lib/doctor/required-checks.js b/lib/doctor/required-checks.js new file mode 100644 index 000000000..21ed84462 --- /dev/null +++ b/lib/doctor/required-checks.js @@ -0,0 +1,6 @@ +import { doctor } from 'appium-android-driver'; + +export const androidHomeCheck = doctor.androidHomeCheck; +export const javaHomeCheck = doctor.javaHomeCheck; +export const javaHomeValueCheck = doctor.javaHomeValueCheck; +export const androidSdkCheck = doctor.androidSdkCheck; diff --git a/package.json b/package.json index 5611e8d3f..4d018938c 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ }, "dependencies": { "appium-adb": "^11.0.1", - "appium-android-driver": "^7.4.0", + "appium-android-driver": "^7.5.1", "appium-chromedriver": "^5.6.5", "appium-uiautomator2-server": "^6.0.0", "asyncbox": "^3.0.0", @@ -80,7 +80,7 @@ "@appium/docutils": "^1.0.1", "@appium/eslint-config-appium": "^8.0.3", "@appium/eslint-config-appium-ts": "^0.x", - "@appium/support": "^4.0.1", + "@appium/support": "^4.2.0", "@appium/test-support": "^3.0.0", "@appium/tsconfig": "^0.x", "@appium/types": "^0.x", @@ -132,7 +132,7 @@ "xpath": "^0.x" }, "peerDependencies": { - "appium": "^2.0.0" + "appium": "^2.4.1" }, "engines": { "node": ">=14", @@ -147,6 +147,12 @@ "mainClass": "AndroidUiautomator2Driver", "scripts": { "reset": "scripts/reset.js" + }, + "doctor": { + "checks": [ + "./build/lib/doctor/required-checks.js", + "./build/lib/doctor/optional-checks.js" + ] } }, "typedoc": {