Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use APIs imported from the io.appium.settings package #966

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/commands/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ commands.reset = async function reset () {
commands.getClipboard = async function getClipboard () {
return (await this.adb.getApiLevel() < 29)
? (await this.espresso.jwproxy.command('/appium/device/get_clipboard', 'POST', {}))
: (await this.adb.getClipboard());
: (await this.settingsApp.getClipboard());
};

/**
Expand Down
13 changes: 7 additions & 6 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
import idlingResourcesCmds from './commands/idling-resources';
import { DEFAULT_ADB_PORT } from 'appium-adb';
import {
androidHelpers, SETTINGS_HELPER_PKG_ID, AndroidDriver
androidHelpers, AndroidDriver
} from 'appium-android-driver';
import { SETTINGS_HELPER_ID } from 'io.appium.settings';
import { ESPRESSO_CONSTRAINTS } from './constraints';
import { findAPortNotInUse } from 'portscanner';
import { retryInterval } from 'asyncbox';
Expand Down Expand Up @@ -469,11 +470,11 @@

if (shouldDisableAnimation) {
this.log.debug('Disabling window animation as "disableWindowAnimation" capability is set to true/fallback to default value "true"');
await this.adb.setAnimationState(false);
await this.settingsApp.setAnimationState(false);
this.wasAnimationEnabled = true;
} else if (shouldEnableAnimation) {
this.log.debug('Enabling window animation as "disableWindowAnimation" capability is set to false');
await this.adb.setAnimationState(true);
await this.settingsApp.setAnimationState(true);
this.wasAnimationEnabled = false;
} else {
this.log.debug(`Window animation is already ${isEnabled ? 'enabled' : 'disabled'}`);
Expand Down Expand Up @@ -540,7 +541,7 @@
await helpers.uninstallOtherPackages(
this.adb,
helpers.parseArray(this.opts.uninstallOtherPackages),
[SETTINGS_HELPER_PKG_ID, TEST_APK_PKG]
[SETTINGS_HELPER_ID, TEST_APK_PKG]
);
}

Expand All @@ -565,7 +566,7 @@
} else {
await this.espresso.installTestApk();
try {
await this.adb.addToDeviceIdleWhitelist(SETTINGS_HELPER_PKG_ID, TEST_APK_PKG);
await this.adb.addToDeviceIdleWhitelist(SETTINGS_HELPER_ID, TEST_APK_PKG);
} catch (e) {
this.log.warn(`Cannot add server packages to the Doze whitelist. Original error: ` +
(e.stderr || e.message));
Expand Down Expand Up @@ -611,7 +612,7 @@
}));
if (this.wasAnimationEnabled) {
try {
await this.adb.setAnimationState(true);
await this.settingsApp.setAnimationState(true);
} catch (err) {
this.log.warn(`Unable to reset animation: ${err.message}`);
}
Expand Down Expand Up @@ -654,19 +655,19 @@
}

// eslint-disable-next-line no-unused-vars
proxyActive (sessionId) {

Check warning on line 658 in lib/driver.js

View workflow job for this annotation

GitHub Actions / node_test (20)

'sessionId' is defined but never used

Check warning on line 658 in lib/driver.js

View workflow job for this annotation

GitHub Actions / node_test (18)

'sessionId' is defined but never used

Check warning on line 658 in lib/driver.js

View workflow job for this annotation

GitHub Actions / node_test (16)

'sessionId' is defined but never used
// we always have an active proxy to the espresso server
return true;
}

// eslint-disable-next-line no-unused-vars
canProxy (sessionId) {

Check warning on line 664 in lib/driver.js

View workflow job for this annotation

GitHub Actions / node_test (20)

'sessionId' is defined but never used

Check warning on line 664 in lib/driver.js

View workflow job for this annotation

GitHub Actions / node_test (18)

'sessionId' is defined but never used

Check warning on line 664 in lib/driver.js

View workflow job for this annotation

GitHub Actions / node_test (16)

'sessionId' is defined but never used
// we can always proxy to the espresso server
return true;
}

// eslint-disable-next-line no-unused-vars
getProxyAvoidList (sessionId) {

Check warning on line 670 in lib/driver.js

View workflow job for this annotation

GitHub Actions / node_test (20)

'sessionId' is defined but never used

Check warning on line 670 in lib/driver.js

View workflow job for this annotation

GitHub Actions / node_test (18)

'sessionId' is defined but never used

Check warning on line 670 in lib/driver.js

View workflow job for this annotation

GitHub Actions / node_test (16)

'sessionId' is defined but never used
// we are maintaining two sets of NO_PROXY lists, one for chromedriver(CHROME_NO_PROXY)
// and one for Espresso(NO_PROXY), based on current context will return related NO_PROXY list
this.jwpProxyAvoid = _.isNil(this.chromedriver) ? NO_PROXY : CHROME_NO_PROXY;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@
],
"dependencies": {
"appium-adb": "^11.0.1",
"appium-android-driver": "^7.6.1",
"appium-android-driver": "^7.8.0",
"asyncbox": "^3.0.0",
"bluebird": "^3.5.0",
"io.appium.settings": "^5.7.1",
"lodash": "^4.17.11",
"portscanner": "^2.1.1",
"source-map-support": "^0.x",
Expand Down
Loading