Skip to content

Commit

Permalink
fix: specify supported non-standard commands in newMethodMap
Browse files Browse the repository at this point in the history
  • Loading branch information
jlipps committed Jan 12, 2023
1 parent f8e10b4 commit 578ef7c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { EspressoRunner, TEST_APK_PKG } from './espresso-runner';
import { fs, tempDir, zip } from 'appium/support';
import commands from './commands';
import { DEFAULT_ADB_PORT } from 'appium-adb';
import { androidHelpers, androidCommands, SETTINGS_HELPER_PKG_ID } from 'appium-android-driver';
import { androidHelpers, androidCommands, SETTINGS_HELPER_PKG_ID, } from 'appium-android-driver';
import desiredCapConstraints from './desired-caps';
import { findAPortNotInUse } from 'portscanner';
import { retryInterval } from 'asyncbox';
import { qualifyActivityName, getPackageInfo } from './utils';
import { newMethodMap } from './method-map';


// TODO merge our own helpers onto this later
Expand Down Expand Up @@ -125,6 +126,9 @@ const AAB_EXT = '.aab';
const SUPPORTED_EXTENSIONS = [APK_EXT, AAB_EXT];

class EspressoDriver extends BaseDriver {

static newMethodMap = newMethodMap;

constructor (opts = {}, shouldValidateCaps = true) {
// `shell` overwrites adb.shell, so remove
delete opts.shell;
Expand Down
11 changes: 11 additions & 0 deletions lib/method-map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { AndroidDriver } from 'appium-android-driver';

export const newMethodMap = /** @type {const} */ ({
...AndroidDriver.newMethodMap,
'/session/:sessionId/appium/device/get_clipboard': {
POST: {
command: 'getClipboard',
payloadParams: { optional: ['contentType'] }
}
}
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"dependencies": {
"@babel/runtime": "^7.4.3",
"appium-adb": "^9.10.2",
"appium-android-driver": "^5.6.0",
"appium-android-driver": "^5.8.7",
"asyncbox": "^2.3.1",
"bluebird": "^3.5.0",
"lodash": "^4.17.11",
Expand Down

0 comments on commit 578ef7c

Please sign in to comment.