Skip to content

Commit 5dec6be

Browse files
authored
chore: set animation scale via settings for api level 26+ (#1007)
* chore: use --no-window-animation to disable animation for api level 26+ * simplified * fix lint * ignore only false * use settings command * rename * append description * bump the adb * Update driver.ts * Update README.md * remove adb.setanimationscale * Update README.md
1 parent caeecab commit 5dec6be

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ appium:chromeOptions | A mapping, that allows to customize chromedriver options.
188188
Capability Name | Description
189189
--- | ---
190190
appium:disableSuppressAccessibilityService | Being set to `true` tells the instrumentation process to not suppress accessibility services during the automated test. This might be useful if your automated test needs these services. `false` by default
191-
appium:disableWindowAnimation | To avoid flakiness google [recommends](https://developer.android.com/training/testing/espresso/setup#set-up-environment) to disable the window animation of the Android device under test when running espresso test. `true` by default
191+
appium:disableWindowAnimation | To avoid flakiness google [recommends](https://developer.android.com/training/testing/espresso/setup#set-up-environment) to disable the window animation of the Android device under test when running espresso test. Animation state is restored automatically after the session is stopped if it was enabled before it has started. The restore method may not work if the session ends unexpectedly. `true` by default
192192
appium:timeZone | Overrides the current device's time zone since the driver version 2.38.0. This change is preserved until the next override. The time zone identifier must be a valid name from the list of [available time zone identifiers](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), for example `Europe/Kyiv`
193193

194194

lib/driver.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,7 @@ export class EspressoDriver extends AndroidDriver implements ExternalDriver<
409409
}
410410
await this.initDevice();
411411

412-
// https://github.com/appium/appium-espresso-driver/issues/72
413-
// default state is window animation disabled
412+
// Default state is window animation disabled.
414413
await this.setWindowAnimationState(this.caps.disableWindowAnimation === false);
415414

416415
// set actual device name, udid
@@ -479,6 +478,13 @@ export class EspressoDriver extends AndroidDriver implements ExternalDriver<
479478
await this.addDeviceInfoToCaps();
480479
}
481480

481+
/**
482+
* Turn on or off animation scale.
483+
* '--no-window-animation' instrument argument for Espresso disables window animations,
484+
* but it does not bring the animation scale back to the pre-instrument process start state in Espresso
485+
* unlike Appium UIA2 driver case. We want to disable/enable the animation scale only in an appium espresso session as possible.
486+
* @param isEnabled
487+
*/
482488
async setWindowAnimationState(isEnabled: boolean): Promise<void> {
483489
const isAnimationOn = await this.adb.isAnimationOn();
484490
const shouldDisableAnimation = !isEnabled && isAnimationOn;

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
"npm-shrinkwrap.json"
7373
],
7474
"dependencies": {
75-
"appium-adb": "^12.2.0",
75+
"appium-adb": "^12.4.0",
7676
"appium-android-driver": "^9.6.0",
7777
"asyncbox": "^3.0.0",
7878
"bluebird": "^3.5.0",
79-
"io.appium.settings": "^5.7.2",
79+
"io.appium.settings": "^5.10.0",
8080
"lodash": "^4.17.11",
8181
"portscanner": "^2.1.1",
8282
"source-map-support": "^0.x",

0 commit comments

Comments
 (0)