Skip to content

Commit

Permalink
feat: Use APIs imported from the io.appium.settings package (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Jan 12, 2024
1 parent 19618c8 commit f55625a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/commands/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const GeneralMixin = {
'POST',
{}
)
: await this.adb.getClipboard()
: await this.settingsApp.getClipboard()
);
},

Expand Down Expand Up @@ -248,7 +248,7 @@ const GeneralMixin = {
this.log.errorAndThrow(`The 'text' argument is mandatory`);
throw new Error(); // unreachable
}
return await this.adb.typeUnicode(String(text));
return await this.settingsApp.typeUnicode(String(text));
},

/**
Expand Down
11 changes: 6 additions & 5 deletions lib/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import type {
StringRecord,
} from '@appium/types';
import {DEFAULT_ADB_PORT} from 'appium-adb';
import AndroidDriver, {SETTINGS_HELPER_PKG_ID, androidHelpers} from 'appium-android-driver';
import AndroidDriver, {androidHelpers} from 'appium-android-driver';
import {SETTINGS_HELPER_ID} from 'io.appium.settings';
import {BaseDriver, DeviceSettings} from 'appium/driver';
import {fs, mjpeg, util} from 'appium/support';
import {retryInterval} from 'asyncbox';
Expand Down Expand Up @@ -509,7 +510,7 @@ class AndroidUiautomator2Driver
// `--no-window-animation` works over Android 8 to disable all of animations
if (await this.adb.isAnimationOn()) {
this.log.info('Disabling animation via io.appium.settings');
await this.adb.setAnimationState(false);
await this.settingsApp.setAnimationState(false);
this._wasWindowAnimationDisabled = true;
} else {
this.log.info('Window animation is already disabled');
Expand Down Expand Up @@ -603,7 +604,7 @@ class AndroidUiautomator2Driver
await this.uiautomator2.installServerApk(this.opts.uiautomator2ServerInstallTimeout);
try {
await this.adb!.addToDeviceIdleWhitelist(
SETTINGS_HELPER_PKG_ID,
SETTINGS_HELPER_ID,
SERVER_PACKAGE_ID,
SERVER_TEST_PACKAGE_ID
);
Expand All @@ -625,7 +626,7 @@ class AndroidUiautomator2Driver
await helpers.uninstallOtherPackages(
this.adb!,
helpers.parseArray(this.opts.uninstallOtherPackages),
[SETTINGS_HELPER_PKG_ID, SERVER_PACKAGE_ID, SERVER_TEST_PACKAGE_ID]
[SETTINGS_HELPER_ID, SERVER_PACKAGE_ID, SERVER_TEST_PACKAGE_ID]
);
}

Expand Down Expand Up @@ -791,7 +792,7 @@ class AndroidUiautomator2Driver
// This value can be true if test target device is <= 26
if (this._wasWindowAnimationDisabled) {
this.log.info('Restoring window animation state');
await this.adb.setAnimationState(true);
await this.settingsApp.setAnimationState(true);
}
if (this._originalIme) {
try {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@
},
"dependencies": {
"appium-adb": "^11.0.1",
"appium-android-driver": "^7.7.0",
"appium-android-driver": "^7.8.0",
"appium-chromedriver": "^5.6.5",
"appium-uiautomator2-server": "^6.0.3",
"asyncbox": "^3.0.0",
"axios": "^1.x",
"bluebird": "^3.5.1",
"css-selector-parser": "^3.0.0",
"io.appium.settings": "^5.7.1",
"lodash": "^4.17.4",
"portscanner": "^2.2.0",
"source-map-support": "^0.x",
Expand Down

0 comments on commit f55625a

Please sign in to comment.