From 722011f1b360c6cd9f0c59fd27ebd38435ca2af4 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 8 Feb 2024 00:00:06 -0800 Subject: [PATCH 1/2] feat: add checkVersion option for mobile:installApp --- README.md | 3 +++ lib/execute-method-map.ts | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a1074f273..127251199 100644 --- a/README.md +++ b/README.md @@ -773,6 +773,8 @@ The call is ignored if the app is not installed. Name | Type | Required | Description | Example --- | --- | --- | --- | --- appId | string | yes | The identifier of the application package to be removed | `my.app.id` +timeout | number | no | The count of milliseconds to wait until the app is terminated. 20000ms by default. | 1500, 0 +keepData | boolean | no | Set to true in order to keep the application data and cache folders after uninstall. | true #### Returned Result @@ -812,6 +814,7 @@ allowTestPackages | boolean | no | Set to true in order to allow test packages i useSdcard | boolean | no | Set to true to install the app on sdcard instead of the device memory. false by default | true grantPermissions | boolean | no | Set to true in order to grant all the permissions requested in the application's manifest automatically after the installation is completed under Android 6+. The targetSdkVersion in the application manifest must be greater or equal to 23 and the Android version on the device under test must be greater or equal to Android 6 (API level 23) to grant permissions. Applications whose targetSdkVersion is lower than or equal to 22 must be reisntalled to grant permissions for Android 6+ devices. false by default | true replace | boolean | no | Set it to false if you don't want the application to be upgraded/reinstalled if it is already present on the device, but throw an error instead. true by default | false +checkVersion | boolean | no | Set to true, in order to skip the application installation if the device under test has greater or equal to the application version. | true ### mobile: clearApp diff --git a/lib/execute-method-map.ts b/lib/execute-method-map.ts index 5c8dc9f63..f618a960a 100644 --- a/lib/execute-method-map.ts +++ b/lib/execute-method-map.ts @@ -278,7 +278,7 @@ export const executeMethodMap = { command: 'mobileInstallApp', params: { required: ['appPath'], - optional: ['timeout', 'keepData'], + optional: ['timeout', 'allowTestPackages', 'useSdcard', 'grantPermissions', 'replace', 'checkVersion'], }, }, 'mobile: clearApp': { diff --git a/package.json b/package.json index 9a2314ae8..f01a07a4c 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ }, "dependencies": { "appium-adb": "^12.0.0", - "appium-android-driver": "^8.2.0", + "appium-android-driver": "^8.4.0", "appium-chromedriver": "^5.6.28", "appium-uiautomator2-server": "^6.0.7", "asyncbox": "^3.0.0", From aa7a269e24e67e84d0df0bc3cab542e975988475 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Thu, 8 Feb 2024 09:30:28 -0800 Subject: [PATCH 2/2] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 127251199..84b5375e3 100644 --- a/README.md +++ b/README.md @@ -803,6 +803,7 @@ True if the app has been successfully terminated. ### mobile: installApp Installs the given application package to the device under test. +It might raise the `INSTALL_FAILED_VERSION_DOWNGRADE` error if the installation was a version downgrade. #### Arguments @@ -814,7 +815,7 @@ allowTestPackages | boolean | no | Set to true in order to allow test packages i useSdcard | boolean | no | Set to true to install the app on sdcard instead of the device memory. false by default | true grantPermissions | boolean | no | Set to true in order to grant all the permissions requested in the application's manifest automatically after the installation is completed under Android 6+. The targetSdkVersion in the application manifest must be greater or equal to 23 and the Android version on the device under test must be greater or equal to Android 6 (API level 23) to grant permissions. Applications whose targetSdkVersion is lower than or equal to 22 must be reisntalled to grant permissions for Android 6+ devices. false by default | true replace | boolean | no | Set it to false if you don't want the application to be upgraded/reinstalled if it is already present on the device, but throw an error instead. true by default | false -checkVersion | boolean | no | Set to true, in order to skip the application installation if the device under test has greater or equal to the application version. | true +checkVersion | boolean | no | Set to true, in order to skip the application installation if the device under test has a greater or equal to the application version. It may help to avoid `INSTALL_FAILED_VERSION_DOWNGRADE` error and unnecessary installation. | true ### mobile: clearApp