appium-uiautomator2-driver 3.10.0 → 4.0.1

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 +19 -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 +41 -48
  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,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
- */