appium-uiautomator2-driver 3.9.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +1 -1
  3. package/build/lib/commands/actions.d.ts +13 -7
  4. package/build/lib/commands/actions.d.ts.map +1 -1
  5. package/build/lib/commands/actions.js +24 -10
  6. package/build/lib/commands/actions.js.map +1 -1
  7. package/build/lib/commands/alert.d.ts +8 -4
  8. package/build/lib/commands/alert.d.ts.map +1 -1
  9. package/build/lib/commands/alert.js +10 -6
  10. package/build/lib/commands/alert.js.map +1 -1
  11. package/build/lib/commands/app-management.d.ts +10 -6
  12. package/build/lib/commands/app-management.d.ts.map +1 -1
  13. package/build/lib/commands/app-management.js +13 -10
  14. package/build/lib/commands/app-management.js.map +1 -1
  15. package/build/lib/commands/clipboard.d.ts +0 -12
  16. package/build/lib/commands/clipboard.d.ts.map +1 -1
  17. package/build/lib/commands/clipboard.js +0 -18
  18. package/build/lib/commands/clipboard.js.map +1 -1
  19. package/build/lib/commands/element.d.ts +3 -2
  20. package/build/lib/commands/element.d.ts.map +1 -1
  21. package/build/lib/commands/element.js +3 -4
  22. package/build/lib/commands/element.js.map +1 -1
  23. package/build/lib/commands/gestures.d.ts +130 -22
  24. package/build/lib/commands/gestures.d.ts.map +1 -1
  25. package/build/lib/commands/gestures.js +130 -33
  26. package/build/lib/commands/gestures.js.map +1 -1
  27. package/build/lib/commands/keyboard.d.ts +11 -4
  28. package/build/lib/commands/keyboard.d.ts.map +1 -1
  29. package/build/lib/commands/keyboard.js +13 -7
  30. package/build/lib/commands/keyboard.js.map +1 -1
  31. package/build/lib/commands/navigation.d.ts +5 -2
  32. package/build/lib/commands/navigation.d.ts.map +1 -1
  33. package/build/lib/commands/navigation.js +5 -3
  34. package/build/lib/commands/navigation.js.map +1 -1
  35. package/build/lib/commands/screenshot.d.ts +4 -2
  36. package/build/lib/commands/screenshot.d.ts.map +1 -1
  37. package/build/lib/commands/screenshot.js +4 -3
  38. package/build/lib/commands/screenshot.js.map +1 -1
  39. package/build/lib/commands/types.d.ts +0 -387
  40. package/build/lib/commands/types.d.ts.map +1 -1
  41. package/build/lib/driver.d.ts +540 -8
  42. package/build/lib/driver.d.ts.map +1 -1
  43. package/build/lib/driver.js +2 -7
  44. package/build/lib/driver.js.map +1 -1
  45. package/build/lib/execute-method-map.d.ts +540 -0
  46. package/build/lib/execute-method-map.d.ts.map +1 -0
  47. package/build/lib/execute-method-map.js +257 -0
  48. package/build/lib/execute-method-map.js.map +1 -0
  49. package/build/tsconfig.tsbuildinfo +1 -1
  50. package/lib/commands/actions.js +32 -10
  51. package/lib/commands/alert.js +10 -6
  52. package/lib/commands/app-management.js +14 -11
  53. package/lib/commands/clipboard.js +0 -18
  54. package/lib/commands/element.js +3 -4
  55. package/lib/commands/gestures.js +184 -38
  56. package/lib/commands/keyboard.js +13 -8
  57. package/lib/commands/navigation.js +5 -3
  58. package/lib/commands/screenshot.js +4 -3
  59. package/lib/commands/types.ts +0 -406
  60. package/lib/driver.ts +2 -16
  61. package/lib/execute-method-map.ts +269 -0
  62. package/npm-shrinkwrap.json +55 -61
  63. package/package.json +3 -3
  64. package/build/lib/commands/app-strings.d.ts +0 -12
  65. package/build/lib/commands/app-strings.d.ts.map +0 -1
  66. package/build/lib/commands/app-strings.js +0 -19
  67. package/build/lib/commands/app-strings.js.map +0 -1
  68. package/build/lib/commands/execute.d.ts +0 -15
  69. package/build/lib/commands/execute.d.ts.map +0 -1
  70. package/build/lib/commands/execute.js +0 -83
  71. package/build/lib/commands/execute.js.map +0 -1
  72. package/lib/commands/app-strings.js +0 -16
  73. package/lib/commands/execute.js +0 -93
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.mobileCommandsMapping = mobileCommandsMapping;
7
- exports.executeMobile = executeMobile;
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const appium_android_driver_1 = require("appium-android-driver");
10
- /**
11
- * @this {AndroidUiautomator2Driver}
12
- * @returns {import('@appium/types').StringRecord<string>}
13
- */
14
- function mobileCommandsMapping() {
15
- const commonMapping = new appium_android_driver_1.AndroidDriver().mobileCommandsMapping.call(this);
16
- return {
17
- ...commonMapping,
18
- dragGesture: 'mobileDragGesture',
19
- flingGesture: 'mobileFlingGesture',
20
- doubleClickGesture: 'mobileDoubleClickGesture',
21
- clickGesture: 'mobileClickGesture',
22
- longClickGesture: 'mobileLongClickGesture',
23
- pinchCloseGesture: 'mobilePinchCloseGesture',
24
- pinchOpenGesture: 'mobilePinchOpenGesture',
25
- swipeGesture: 'mobileSwipeGesture',
26
- scrollGesture: 'mobileScrollGesture',
27
- scrollBackTo: 'mobileScrollBackTo',
28
- scroll: 'mobileScroll',
29
- viewportScreenshot: 'mobileViewportScreenshot',
30
- viewportRect: 'mobileViewPortRect',
31
- deepLink: 'mobileDeepLink',
32
- acceptAlert: 'mobileAcceptAlert',
33
- dismissAlert: 'mobileDismissAlert',
34
- batteryInfo: 'mobileGetBatteryInfo',
35
- deviceInfo: 'mobileGetDeviceInfo',
36
- openNotifications: 'openNotifications',
37
- type: 'mobileType',
38
- replaceElementValue: 'mobileReplaceElementValue',
39
- getAppStrings: 'mobileGetAppStrings',
40
- installMultipleApks: 'mobileInstallMultipleApks',
41
- backgroundApp: 'mobileBackgroundApp',
42
- pressKey: 'mobilePressKey',
43
- screenshots: 'mobileScreenshots',
44
- scheduleAction: 'mobileScheduleAction',
45
- getActionHistory: 'mobileGetActionHistory',
46
- unscheduleAction: 'mobileUnscheduleAction',
47
- setClipboard: 'mobileSetClipboard',
48
- getClipboard: 'mobileGetClipboard',
49
- };
50
- }
51
- /**
52
- * @override
53
- * @this {AndroidUiautomator2Driver}
54
- * @param {string} mobileCommand
55
- * @param {import('@appium/types').StringRecord} [opts={}]
56
- * @returns {Promise<any>}
57
- */
58
- async function executeMobile(mobileCommand, opts = {}) {
59
- return await new appium_android_driver_1.AndroidDriver().executeMobile.call(this, mobileCommand, preprocessOptions(opts));
60
- }
61
- // #region Internal Helpers
62
- /**
63
- * Renames the deprecated `element` key to `elementId`. Historically,
64
- * all of the pre-Execute-Method-Map execute methods accepted an `element` _or_ and `elementId` param.
65
- * This assigns the `element` value to `elementId` if `elementId` is not already present.
66
- *
67
- * @param {import('@appium/types').StringRecord} [opts={}]
68
- * @internal
69
- * @returns {import('@appium/types').StringRecord|undefined}
70
- */
71
- function preprocessOptions(opts = {}) {
72
- if (lodash_1.default.isPlainObject(opts) && !('elementId' in opts) && 'element' in opts) {
73
- opts.elementId = opts.element;
74
- delete opts.element;
75
- this.log.debug(`Replaced the obsolete 'element' key with 'elementId'`);
76
- }
77
- return opts;
78
- }
79
- // #endregion
80
- /**
81
- * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
82
- */
83
- //# sourceMappingURL=execute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../lib/commands/execute.js"],"names":[],"mappings":";;;;;AAOA,sDAgDC;AASD,sCAEC;AAlED,oDAAuB;AACvB,iEAAoD;AAEpD;;;GAGG;AACH,SAAgB,qBAAqB;IACnC,MAAM,aAAa,GAAG,IAAI,qCAAa,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3E,OAAO;QACL,GAAG,aAAa;QAChB,WAAW,EAAE,mBAAmB;QAChC,YAAY,EAAE,oBAAoB;QAClC,kBAAkB,EAAE,0BAA0B;QAC9C,YAAY,EAAE,oBAAoB;QAClC,gBAAgB,EAAE,wBAAwB;QAC1C,iBAAiB,EAAE,yBAAyB;QAC5C,gBAAgB,EAAE,wBAAwB;QAC1C,YAAY,EAAE,oBAAoB;QAClC,aAAa,EAAE,qBAAqB;QACpC,YAAY,EAAE,oBAAoB;Q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ED,aAAa;AAEb;;GAEG"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Retrives app strings from its resources for the given language
3
- * or the default device language.
4
- * @this {AndroidUiautomator2Driver}
5
- * @param {import('./types').GetAppStringsOptions} [opts={}]
6
- * @returns {Promise<StringRecord>}
7
- */
8
- export async function mobileGetAppStrings(opts) {
9
- return await this.getStrings(opts?.language);
10
- }
11
-
12
- /**
13
- * @typedef {import('appium-adb').ADB} ADB
14
- * @typedef {import('@appium/types').StringRecord} StringRecord
15
- * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
16
- */
@@ -1,93 +0,0 @@
1
- import _ from 'lodash';
2
- import {AndroidDriver} from 'appium-android-driver';
3
-
4
- /**
5
- * @this {AndroidUiautomator2Driver}
6
- * @returns {import('@appium/types').StringRecord<string>}
7
- */
8
- export function mobileCommandsMapping() {
9
- const commonMapping = new AndroidDriver().mobileCommandsMapping.call(this);
10
- return {
11
- ...commonMapping,
12
- dragGesture: 'mobileDragGesture',
13
- flingGesture: 'mobileFlingGesture',
14
- doubleClickGesture: 'mobileDoubleClickGesture',
15
- clickGesture: 'mobileClickGesture',
16
- longClickGesture: 'mobileLongClickGesture',
17
- pinchCloseGesture: 'mobilePinchCloseGesture',
18
- pinchOpenGesture: 'mobilePinchOpenGesture',
19
- swipeGesture: 'mobileSwipeGesture',
20
- scrollGesture: 'mobileScrollGesture',
21
- scrollBackTo: 'mobileScrollBackTo',
22
- scroll: 'mobileScroll',
23
- viewportScreenshot: 'mobileViewportScreenshot',
24
- viewportRect: 'mobileViewPortRect',
25
-
26
- deepLink: 'mobileDeepLink',
27
-
28
- acceptAlert: 'mobileAcceptAlert',
29
- dismissAlert: 'mobileDismissAlert',
30
-
31
- batteryInfo: 'mobileGetBatteryInfo',
32
-
33
- deviceInfo: 'mobileGetDeviceInfo',
34
-
35
- openNotifications: 'openNotifications',
36
-
37
- type: 'mobileType',
38
- replaceElementValue: 'mobileReplaceElementValue',
39
-
40
- getAppStrings: 'mobileGetAppStrings',
41
-
42
- installMultipleApks: 'mobileInstallMultipleApks',
43
- backgroundApp: 'mobileBackgroundApp',
44
-
45
- pressKey: 'mobilePressKey',
46
-
47
- screenshots: 'mobileScreenshots',
48
-
49
- scheduleAction: 'mobileScheduleAction',
50
- getActionHistory: 'mobileGetActionHistory',
51
- unscheduleAction: 'mobileUnscheduleAction',
52
-
53
- setClipboard: 'mobileSetClipboard',
54
- getClipboard: 'mobileGetClipboard',
55
- };
56
- }
57
-
58
- /**
59
- * @override
60
- * @this {AndroidUiautomator2Driver}
61
- * @param {string} mobileCommand
62
- * @param {import('@appium/types').StringRecord} [opts={}]
63
- * @returns {Promise<any>}
64
- */
65
- export async function executeMobile(mobileCommand, opts = {}) {
66
- return await new AndroidDriver().executeMobile.call(this, mobileCommand, preprocessOptions(opts));
67
- }
68
-
69
- // #region Internal Helpers
70
-
71
- /**
72
- * Renames the deprecated `element` key to `elementId`. Historically,
73
- * all of the pre-Execute-Method-Map execute methods accepted an `element` _or_ and `elementId` param.
74
- * This assigns the `element` value to `elementId` if `elementId` is not already present.
75
- *
76
- * @param {import('@appium/types').StringRecord} [opts={}]
77
- * @internal
78
- * @returns {import('@appium/types').StringRecord|undefined}
79
- */
80
- function preprocessOptions(opts = {}) {
81
- if (_.isPlainObject(opts) && !('elementId' in opts) && 'element' in opts) {
82
- opts.elementId = opts.element;
83
- delete opts.element;
84
- this.log.debug(`Replaced the obsolete 'element' key with 'elementId'`);
85
- }
86
- return opts;
87
- }
88
-
89
- // #endregion
90
-
91
- /**
92
- * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
93
- */