appium-android-driver 5.14.0-alpha.0 → 5.14.0-alpha2

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 (88) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/index.d.ts +282 -0
  3. package/build/index.d.ts.map +1 -0
  4. package/build/index.js +34 -20
  5. package/build/index.js.map +1 -0
  6. package/build/lib/android-helpers.d.ts +136 -0
  7. package/build/lib/android-helpers.d.ts.map +1 -0
  8. package/build/lib/android-helpers.js +855 -0
  9. package/build/lib/android-helpers.js.map +1 -0
  10. package/build/lib/bootstrap.d.ts +2 -2
  11. package/build/lib/commands/actions.d.ts.map +1 -1
  12. package/build/lib/commands/actions.js +4 -0
  13. package/build/lib/commands/actions.js.map +1 -1
  14. package/build/lib/commands/context.js +1 -1
  15. package/build/lib/commands/context.js.map +1 -1
  16. package/build/lib/commands/coverage.d.ts +5 -0
  17. package/build/lib/commands/coverage.d.ts.map +1 -0
  18. package/build/lib/commands/coverage.js +19 -0
  19. package/build/lib/commands/coverage.js.map +1 -0
  20. package/build/lib/commands/execute.d.ts.map +1 -1
  21. package/build/lib/commands/execute.js +4 -3
  22. package/build/lib/commands/execute.js.map +1 -1
  23. package/build/lib/commands/find.d.ts +4 -1
  24. package/build/lib/commands/find.d.ts.map +1 -1
  25. package/build/lib/commands/find.js +1 -0
  26. package/build/lib/commands/find.js.map +1 -1
  27. package/build/lib/commands/index.d.ts +27 -47
  28. package/build/lib/commands/index.d.ts.map +1 -1
  29. package/build/lib/commands/index.js.map +1 -1
  30. package/build/lib/commands/log.d.ts.map +1 -1
  31. package/build/lib/commands/log.js +2 -2
  32. package/build/lib/commands/log.js.map +1 -1
  33. package/build/lib/commands/mixins.d.ts +11 -6
  34. package/build/lib/commands/mixins.d.ts.map +1 -1
  35. package/build/lib/commands/mixins.js.map +1 -1
  36. package/build/lib/commands/performance.d.ts +4 -4
  37. package/build/lib/commands/performance.d.ts.map +1 -1
  38. package/build/lib/commands/types.d.ts +8 -1
  39. package/build/lib/commands/types.d.ts.map +1 -1
  40. package/build/lib/constraints.d.ts +289 -384
  41. package/build/lib/constraints.d.ts.map +1 -1
  42. package/build/lib/constraints.js +2 -9
  43. package/build/lib/constraints.js.map +1 -1
  44. package/build/lib/desired-caps.d.ts +353 -0
  45. package/build/lib/desired-caps.d.ts.map +1 -0
  46. package/build/lib/desired-caps.js +299 -0
  47. package/build/lib/desired-caps.js.map +1 -0
  48. package/build/lib/driver.d.ts +50 -403
  49. package/build/lib/driver.d.ts.map +1 -1
  50. package/build/lib/driver.js +67 -127
  51. package/build/lib/driver.js.map +1 -1
  52. package/build/lib/helpers/android.d.ts +11 -11
  53. package/build/lib/helpers/android.d.ts.map +1 -1
  54. package/build/lib/helpers/android.js.map +1 -1
  55. package/build/lib/helpers/unlock.d.ts +2 -1
  56. package/build/lib/helpers/unlock.d.ts.map +1 -1
  57. package/build/lib/helpers/unlock.js.map +1 -1
  58. package/build/lib/index.d.ts +9 -0
  59. package/build/lib/index.d.ts.map +1 -0
  60. package/build/lib/index.js +37 -0
  61. package/build/lib/index.js.map +1 -0
  62. package/build/lib/uiautomator.d.ts +6 -6
  63. package/build/lib/unlock-helpers.d.ts +38 -0
  64. package/build/lib/unlock-helpers.d.ts.map +1 -0
  65. package/build/lib/unlock-helpers.js +266 -0
  66. package/build/lib/unlock-helpers.js.map +1 -0
  67. package/build/lib/webview-helpers.d.ts +223 -0
  68. package/build/lib/webview-helpers.d.ts.map +1 -0
  69. package/build/lib/webview-helpers.js +530 -0
  70. package/build/lib/webview-helpers.js.map +1 -0
  71. package/lib/commands/actions.js +5 -0
  72. package/lib/commands/context.js +1 -1
  73. package/lib/commands/execute.js +7 -3
  74. package/lib/commands/find.ts +2 -0
  75. package/lib/commands/{index.js → index.ts} +2 -0
  76. package/lib/commands/log.js +6 -4
  77. package/lib/commands/mixins.ts +11 -7
  78. package/lib/commands/types.ts +9 -1
  79. package/lib/{constraints.js → constraints.ts} +6 -9
  80. package/lib/{driver.js → driver.ts} +143 -183
  81. package/lib/helpers/android.ts +31 -14
  82. package/lib/helpers/unlock.ts +2 -1
  83. package/lib/index.ts +18 -0
  84. package/package.json +14 -14
  85. package/build/lib/commands/mixin.d.ts +0 -3
  86. package/build/lib/commands/mixin.d.ts.map +0 -1
  87. package/build/lib/commands/mixin.js +0 -6
  88. package/build/lib/commands/mixin.js.map +0 -1
@@ -18,14 +18,13 @@ import type {
18
18
  UninstallOptions,
19
19
  } from 'appium-adb';
20
20
  import type Chromedriver from 'appium-chromedriver';
21
- import type {Sharp} from 'sharp';
22
21
  import {AndroidDriverOpts, AndroidDriver} from '../driver';
23
22
  import type * as types from './types';
24
23
 
25
24
  export interface ActionsMixin {
26
25
  keyevent(keycode: string | number, metastate?: number): Promise<void>;
27
- pressKeyCode(keycode: string | number, metastate?: number): Promise<void>;
28
- longPressKeyCode(keycode: string | number, metastate?: number): Promise<void>;
26
+ pressKeyCode(keycode: string | number, metastate?: number, flags?: any): Promise<void>;
27
+ longPressKeyCode(keycode: string | number, metastate?: number, flags?: any): Promise<void>;
29
28
  getOrientation(): Promise<Orientation>;
30
29
  setOrientation(orientation: Orientation): Promise<void>;
31
30
  fakeFlick(xSpeed: number, ySpeed: number): Promise<void>;
@@ -84,7 +83,12 @@ export interface ActionsMixin {
84
83
  destElId?: string | number
85
84
  ): Promise<void>;
86
85
  doDrag(opts: types.DragOpts): Promise<void>;
87
- lock(seconds: number | string): Promise<void>;
86
+ lock(seconds?: number): Promise<void>;
87
+ /**
88
+ * Lock the device (and optionally unlock it after a certain amount of time).
89
+ * @throws {Error} if lock or unlock operation fails
90
+ */
91
+ mobileLock(opts: types.LockOpts): Promise<void>;
88
92
  unlock(): Promise<void>;
89
93
  isLocked(): Promise<boolean>;
90
94
  openNotifications(): Promise<void>;
@@ -408,8 +412,8 @@ export interface EmulatorConsoleMixin {
408
412
  }
409
413
 
410
414
  export interface ExecuteMixin {
411
- execute(script: string, args?: any): Promise<void>;
412
- executeMobile(mobileCommand: string, opts?: StringRecord): Promise<void>;
415
+ execute(script: string, args?: unknown[]): Promise<unknown>;
416
+ executeMobile(mobileCommand: string, opts?: StringRecord): Promise<unknown>;
413
417
  }
414
418
 
415
419
  export interface FileActionsMixin {
@@ -532,7 +536,7 @@ export interface GeneralMixin {
532
536
 
533
537
  background(seconds: number): Promise<string | true>;
534
538
 
535
- getStrings(language: string): Promise<StringRecord>;
539
+ getStrings(language?: string | null): Promise<StringRecord>;
536
540
 
537
541
  launchApp(): Promise<void>;
538
542
 
@@ -350,7 +350,7 @@ export interface ListSmsOpts {
350
350
  * Maximum count of recent SMS messages
351
351
  * @defaultValue 100
352
352
  */
353
- max: number;
353
+ max?: number;
354
354
  }
355
355
 
356
356
  export type UnlockType = 'pin' | 'pinWithKeyEvent' | 'password' | 'pattern';
@@ -1087,3 +1087,11 @@ export type SwipeAction = [
1087
1087
  ];
1088
1088
 
1089
1089
  export type TouchDragAction = [NonReleaseTouchAction, NonReleaseTouchAction, ReleaseTouchAction];
1090
+
1091
+ export interface LockOpts {
1092
+ /**
1093
+ * The number to keep the locked.
1094
+ * 0 or empty value will keep the device locked.
1095
+ */
1096
+ seconds?: number;
1097
+ }
@@ -1,18 +1,13 @@
1
- export const ANDROID_DRIVER_CONSTRAINTS = /** @type {const} */ ({
1
+ import {type Constraints} from '@appium/types';
2
+
3
+ export const ANDROID_DRIVER_CONSTRAINTS = {
2
4
  platformName: {
3
5
  isString: true,
4
6
  inclusionCaseInsensitive: ['Android'],
5
7
  presence: true,
6
8
  },
7
- /**
8
- * XXX: this overrides BaseDriver's constraint, since this driver seems to require the deviceName cap
9
- */
10
9
  deviceName: {
11
10
  isString: true,
12
- presence: true,
13
- },
14
- app: {
15
- isString: true,
16
11
  },
17
12
  appActivity: {
18
13
  isString: true,
@@ -301,6 +296,8 @@ export const ANDROID_DRIVER_CONSTRAINTS = /** @type {const} */ ({
301
296
  appWaitForLaunch: {
302
297
  isBoolean: true,
303
298
  },
304
- });
299
+ } as const satisfies Constraints;
305
300
 
306
301
  export default ANDROID_DRIVER_CONSTRAINTS;
302
+
303
+ export type AndroidDriverConstraints = typeof ANDROID_DRIVER_CONSTRAINTS;