appium-android-driver 5.14.7 → 6.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 (192) hide show
  1. package/build/index.d.ts +282 -0
  2. package/build/index.d.ts.map +1 -0
  3. package/build/index.js.map +1 -0
  4. package/build/lib/commands/actions.d.ts +6 -224
  5. package/build/lib/commands/actions.d.ts.map +1 -1
  6. package/build/lib/commands/actions.js +306 -405
  7. package/build/lib/commands/actions.js.map +1 -1
  8. package/build/lib/commands/alert.d.ts +7 -9
  9. package/build/lib/commands/alert.d.ts.map +1 -1
  10. package/build/lib/commands/alert.js +24 -18
  11. package/build/lib/commands/alert.js.map +1 -1
  12. package/build/lib/commands/app-management.d.ts +7 -313
  13. package/build/lib/commands/app-management.d.ts.map +1 -1
  14. package/build/lib/commands/app-management.js +135 -293
  15. package/build/lib/commands/app-management.js.map +1 -1
  16. package/build/lib/commands/context.d.ts +8 -92
  17. package/build/lib/commands/context.d.ts.map +1 -1
  18. package/build/lib/commands/context.js +381 -439
  19. package/build/lib/commands/context.js.map +1 -1
  20. package/build/lib/commands/element.d.ts +8 -35
  21. package/build/lib/commands/element.d.ts.map +1 -1
  22. package/build/lib/commands/element.js +153 -136
  23. package/build/lib/commands/element.js.map +1 -1
  24. package/build/lib/commands/emu-console.d.ts +6 -48
  25. package/build/lib/commands/emu-console.d.ts.map +1 -1
  26. package/build/lib/commands/emu-console.js +19 -34
  27. package/build/lib/commands/emu-console.js.map +1 -1
  28. package/build/lib/commands/execute.d.ts +6 -5
  29. package/build/lib/commands/execute.d.ts.map +1 -1
  30. package/build/lib/commands/execute.js +77 -66
  31. package/build/lib/commands/execute.js.map +1 -1
  32. package/build/lib/commands/file-actions.d.ts +7 -128
  33. package/build/lib/commands/file-actions.d.ts.map +1 -1
  34. package/build/lib/commands/file-actions.js +183 -219
  35. package/build/lib/commands/file-actions.js.map +1 -1
  36. package/build/lib/commands/find.d.ts +8 -12
  37. package/build/lib/commands/find.d.ts.map +1 -1
  38. package/build/lib/commands/find.js +19 -23
  39. package/build/lib/commands/find.js.map +1 -1
  40. package/build/lib/commands/general.d.ts +9 -132
  41. package/build/lib/commands/general.d.ts.map +1 -1
  42. package/build/lib/commands/general.js +281 -312
  43. package/build/lib/commands/general.js.map +1 -1
  44. package/build/lib/commands/ime.d.ts +7 -10
  45. package/build/lib/commands/ime.d.ts.map +1 -1
  46. package/build/lib/commands/ime.js +47 -35
  47. package/build/lib/commands/ime.js.map +1 -1
  48. package/build/lib/commands/index.d.ts +27 -2
  49. package/build/lib/commands/index.d.ts.map +1 -1
  50. package/build/lib/commands/index.js +41 -19
  51. package/build/lib/commands/index.js.map +1 -1
  52. package/build/lib/commands/intent.d.ts +7 -417
  53. package/build/lib/commands/intent.d.ts.map +1 -1
  54. package/build/lib/commands/intent.js +104 -216
  55. package/build/lib/commands/intent.js.map +1 -1
  56. package/build/lib/commands/keyboard.d.ts +6 -5
  57. package/build/lib/commands/keyboard.d.ts.map +1 -1
  58. package/build/lib/commands/keyboard.js +16 -8
  59. package/build/lib/commands/keyboard.js.map +1 -1
  60. package/build/lib/commands/log.d.ts +7 -44
  61. package/build/lib/commands/log.d.ts.map +1 -1
  62. package/build/lib/commands/log.js +146 -108
  63. package/build/lib/commands/log.js.map +1 -1
  64. package/build/lib/commands/media-projection.d.ts +7 -143
  65. package/build/lib/commands/media-projection.d.ts.map +1 -1
  66. package/build/lib/commands/media-projection.js +113 -140
  67. package/build/lib/commands/media-projection.js.map +1 -1
  68. package/build/lib/commands/mixins.d.ts +740 -0
  69. package/build/lib/commands/mixins.d.ts.map +1 -0
  70. package/build/lib/commands/mixins.js +19 -0
  71. package/build/lib/commands/mixins.js.map +1 -0
  72. package/build/lib/commands/network.d.ts +7 -138
  73. package/build/lib/commands/network.d.ts.map +1 -1
  74. package/build/lib/commands/network.js +212 -254
  75. package/build/lib/commands/network.js.map +1 -1
  76. package/build/lib/commands/performance.d.ts +24 -70
  77. package/build/lib/commands/performance.d.ts.map +1 -1
  78. package/build/lib/commands/performance.js +144 -100
  79. package/build/lib/commands/performance.js.map +1 -1
  80. package/build/lib/commands/permissions.d.ts +8 -92
  81. package/build/lib/commands/permissions.d.ts.map +1 -1
  82. package/build/lib/commands/permissions.js +75 -87
  83. package/build/lib/commands/permissions.js.map +1 -1
  84. package/build/lib/commands/recordscreen.d.ts +7 -193
  85. package/build/lib/commands/recordscreen.d.ts.map +1 -1
  86. package/build/lib/commands/recordscreen.js +151 -182
  87. package/build/lib/commands/recordscreen.js.map +1 -1
  88. package/build/lib/commands/shell.d.ts +7 -7
  89. package/build/lib/commands/shell.d.ts.map +1 -1
  90. package/build/lib/commands/shell.js +40 -33
  91. package/build/lib/commands/shell.js.map +1 -1
  92. package/build/lib/commands/streamscreen.d.ts +9 -103
  93. package/build/lib/commands/streamscreen.d.ts.map +1 -1
  94. package/build/lib/commands/streamscreen.js +261 -218
  95. package/build/lib/commands/streamscreen.js.map +1 -1
  96. package/build/lib/commands/system-bars.d.ts +22 -90
  97. package/build/lib/commands/system-bars.d.ts.map +1 -1
  98. package/build/lib/commands/system-bars.js +76 -74
  99. package/build/lib/commands/system-bars.js.map +1 -1
  100. package/build/lib/commands/touch.d.ts +10 -29
  101. package/build/lib/commands/touch.d.ts.map +1 -1
  102. package/build/lib/commands/touch.js +301 -285
  103. package/build/lib/commands/touch.js.map +1 -1
  104. package/build/lib/commands/types.d.ts +978 -0
  105. package/build/lib/commands/types.d.ts.map +1 -0
  106. package/build/lib/commands/types.js +3 -0
  107. package/build/lib/commands/types.js.map +1 -0
  108. package/build/lib/constraints.d.ts +291 -0
  109. package/build/lib/constraints.d.ts.map +1 -0
  110. package/build/lib/constraints.js +300 -0
  111. package/build/lib/constraints.js.map +1 -0
  112. package/build/lib/driver.d.ts +68 -37
  113. package/build/lib/driver.d.ts.map +1 -1
  114. package/build/lib/driver.js +123 -80
  115. package/build/lib/driver.js.map +1 -1
  116. package/build/lib/helpers/android.d.ts +164 -0
  117. package/build/lib/helpers/android.d.ts.map +1 -0
  118. package/build/lib/helpers/android.js +819 -0
  119. package/build/lib/helpers/android.js.map +1 -0
  120. package/build/lib/helpers/index.d.ts +7 -0
  121. package/build/lib/helpers/index.d.ts.map +1 -0
  122. package/build/lib/helpers/index.js +29 -0
  123. package/build/lib/helpers/index.js.map +1 -0
  124. package/build/lib/helpers/types.d.ts +121 -0
  125. package/build/lib/helpers/types.d.ts.map +1 -0
  126. package/build/lib/helpers/types.js +3 -0
  127. package/build/lib/helpers/types.js.map +1 -0
  128. package/build/lib/helpers/unlock.d.ts +32 -0
  129. package/build/lib/helpers/unlock.d.ts.map +1 -0
  130. package/build/lib/helpers/unlock.js +273 -0
  131. package/build/lib/helpers/unlock.js.map +1 -0
  132. package/build/lib/helpers/webview.d.ts +74 -0
  133. package/build/lib/helpers/webview.d.ts.map +1 -0
  134. package/build/lib/helpers/webview.js +421 -0
  135. package/build/lib/helpers/webview.js.map +1 -0
  136. package/build/lib/index.d.ts +9 -0
  137. package/build/lib/index.d.ts.map +1 -0
  138. package/build/lib/index.js +37 -0
  139. package/build/lib/index.js.map +1 -0
  140. package/build/lib/method-map.d.ts +0 -8
  141. package/build/lib/method-map.d.ts.map +1 -1
  142. package/build/lib/method-map.js +63 -74
  143. package/build/lib/method-map.js.map +1 -1
  144. package/build/lib/stubs.d.ts +0 -1
  145. package/build/lib/stubs.d.ts.map +1 -1
  146. package/build/lib/stubs.js +1 -0
  147. package/build/lib/stubs.js.map +1 -1
  148. package/build/lib/utils.d.ts +1 -1
  149. package/build/lib/utils.d.ts.map +1 -1
  150. package/lib/commands/actions.js +351 -464
  151. package/lib/commands/alert.js +27 -17
  152. package/lib/commands/app-management.js +156 -314
  153. package/lib/commands/context.js +457 -441
  154. package/lib/commands/element.js +201 -157
  155. package/lib/commands/emu-console.js +25 -45
  156. package/lib/commands/execute.js +106 -90
  157. package/lib/commands/file-actions.js +222 -240
  158. package/lib/commands/find.ts +103 -0
  159. package/lib/commands/general.js +327 -339
  160. package/lib/commands/ime.js +50 -34
  161. package/lib/commands/{index.js → index.ts} +20 -24
  162. package/lib/commands/intent.js +108 -249
  163. package/lib/commands/keyboard.js +20 -8
  164. package/lib/commands/log.js +172 -116
  165. package/lib/commands/media-projection.js +134 -161
  166. package/lib/commands/mixins.ts +966 -0
  167. package/lib/commands/network.js +252 -281
  168. package/lib/commands/performance.js +203 -132
  169. package/lib/commands/permissions.js +108 -109
  170. package/lib/commands/recordscreen.js +212 -209
  171. package/lib/commands/shell.js +51 -40
  172. package/lib/commands/streamscreen.js +355 -289
  173. package/lib/commands/system-bars.js +92 -83
  174. package/lib/commands/touch.js +357 -294
  175. package/lib/commands/types.ts +1097 -0
  176. package/lib/{desired-caps.js → constraints.ts} +106 -103
  177. package/lib/{driver.js → driver.ts} +278 -132
  178. package/lib/helpers/android.ts +1143 -0
  179. package/lib/helpers/index.ts +6 -0
  180. package/lib/helpers/types.ts +134 -0
  181. package/lib/helpers/unlock.ts +329 -0
  182. package/lib/helpers/webview.ts +582 -0
  183. package/lib/index.ts +18 -0
  184. package/lib/method-map.js +87 -98
  185. package/lib/stubs.ts +0 -1
  186. package/package.json +27 -20
  187. package/index.js +0 -24
  188. package/lib/android-helpers.js +0 -983
  189. package/lib/commands/coverage.js +0 -18
  190. package/lib/commands/find.js +0 -82
  191. package/lib/unlock-helpers.js +0 -278
  192. package/lib/webview-helpers.js +0 -602
@@ -1,93 +1,9 @@
1
- export default commands;
2
- export type ChangePermissionsOptions = {
3
- /**
4
- * If `target` is set to 'pm':
5
- * The full name of the permission to be changed
6
- * or a list of permissions. Check https://developer.android.com/reference/android/Manifest.permission
7
- * to get the full list of standard Android permssion names. Mandatory argument.
8
- * If 'all' magic string is passed then the chosen action is going to be applied to all
9
- * permisisons requested/granted by 'appPackage'.
10
- * If `target` is set to 'appops':
11
- * The full name of the appops permission to be changed
12
- * or a list of permissions. Check AppOpsManager.java sources to get the full list of
13
- * supported appops permission names for the given Android pklatform.
14
- * Examples: 'ACTIVITY_RECOGNITION', 'SMS_FINANCIAL_TRANSACTIONS', 'READ_SMS', 'ACCESS_NOTIFICATIONS'.
15
- * The 'all' magic string is unsupported.
16
- */
17
- permissions: string | Array<string>;
18
- /**
19
- * [this.opts.appPackage] The application package to set change
20
- * permissions on. Defaults to the package name under test.
21
- */
22
- appPackage: string;
23
- /**
24
- * [grant|allow] One of `PM_ACTION` values if `target` is set to 'pm',
25
- * otherwise one of `APPOPS_ACTION` values
26
- */
27
- action: string;
28
- /**
29
- * [pm] Either 'pm' or 'appops'. The 'appops' one requires
30
- * 'adb_shell' server security option to be enabled.
31
- */
32
- target: string;
33
- };
34
- export type GetPermissionsOptions = {
35
- /**
36
- * [requested] - One of possible permission types to get.
37
- * Can be any of `PERMISSIONS_TYPE` values.
38
- */
39
- type: string;
40
- /**
41
- * [this.opts.appPackage] - The application package to set change
42
- * permissions on. Defaults to the package name under test.
43
- */
44
- appPackage: string;
45
- };
46
- export namespace commands {
47
- /**
48
- * @typedef {Object} ChangePermissionsOptions
49
- * @property {!string|Array<string>} permissions
50
- * If `target` is set to 'pm':
51
- * The full name of the permission to be changed
52
- * or a list of permissions. Check https://developer.android.com/reference/android/Manifest.permission
53
- * to get the full list of standard Android permssion names. Mandatory argument.
54
- * If 'all' magic string is passed then the chosen action is going to be applied to all
55
- * permisisons requested/granted by 'appPackage'.
56
- * If `target` is set to 'appops':
57
- * The full name of the appops permission to be changed
58
- * or a list of permissions. Check AppOpsManager.java sources to get the full list of
59
- * supported appops permission names for the given Android pklatform.
60
- * Examples: 'ACTIVITY_RECOGNITION', 'SMS_FINANCIAL_TRANSACTIONS', 'READ_SMS', 'ACCESS_NOTIFICATIONS'.
61
- * The 'all' magic string is unsupported.
62
- * @property {string} appPackage [this.opts.appPackage] The application package to set change
63
- * permissions on. Defaults to the package name under test.
64
- * @property {string} action [grant|allow] One of `PM_ACTION` values if `target` is set to 'pm',
65
- * otherwise one of `APPOPS_ACTION` values
66
- * @property {string} target [pm] Either 'pm' or 'appops'. The 'appops' one requires
67
- * 'adb_shell' server security option to be enabled.
68
- */
69
- /**
70
- * Changes package permissions in runtime.
71
- *
72
- * @param {?ChangePermissionsOptions} opts - Available options mapping.
73
- * @throws {Error} if there was a failure while changing permissions
74
- */
75
- function mobileChangePermissions(opts?: ChangePermissionsOptions | null): Promise<any>;
76
- /**
77
- * @typedef {Object} GetPermissionsOptions
78
- * @property {string} type [requested] - One of possible permission types to get.
79
- * Can be any of `PERMISSIONS_TYPE` values.
80
- * @property {string} appPackage [this.opts.appPackage] - The application package to set change
81
- * permissions on. Defaults to the package name under test.
82
- */
83
- /**
84
- * Gets runtime permissions list for the given application package.
85
- *
86
- * @param {GetPermissionsOptions} opts - Available options mapping.
87
- * @returns {Array<string>} The list of retrieved permissions for the given type
88
- * (can also be empty).
89
- * @throws {Error} if there was an error while getting permissions.
90
- */
91
- function mobileGetPermissions(opts?: GetPermissionsOptions): string[];
92
- }
1
+ export default PermissionsMixin;
2
+ export type ADB = import('appium-adb').ADB;
3
+ export type AndroidDriver = import('../driver').AndroidDriver;
4
+ /**
5
+ * @type {import('./mixins').PermissionsMixin & ThisType<import('../driver').AndroidDriver>}
6
+ * @satisfies {import('@appium/types').ExternalDriver}
7
+ */
8
+ declare const PermissionsMixin: import('./mixins').PermissionsMixin & ThisType<import('../driver').AndroidDriver>;
93
9
  //# sourceMappingURL=permissions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../lib/commands/permissions.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;iBA2Ee,MAAM,GAAC,MAAM,MAAM,CAAC;;;;;gBAarB,MAAM;;;;;YAEN,MAAM;;;;;YAEN,MAAM;;;;;;;UAqCN,MAAM;;;;;gBAEN,MAAM;;;IA1DpB;;;;;;;;;;;;;;;;;;;;;OAqBG;IAEH;;;;;OAKG;IACH,uFAuBC;IAED;;;;;;OAMG;IAEH;;;;;;;OAOG;IACH,sEAsBC"}
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../lib/commands/permissions.js"],"names":[],"mappings":";kBAqKa,OAAO,YAAY,EAAE,GAAG;4BACxB,OAAO,WAAW,EAAE,aAAa;AAvE9C;;;GAGG;AACH,gCAHU,OAAO,UAAU,EAAE,gBAAgB,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CA8DzF"}
@@ -1,15 +1,14 @@
1
1
  "use strict";
2
+ // @ts-check
2
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
5
  };
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.commands = void 0;
7
- const lodash_1 = __importDefault(require("lodash"));
8
7
  const driver_1 = require("appium/driver");
9
8
  const bluebird_1 = __importDefault(require("bluebird"));
9
+ const lodash_1 = __importDefault(require("lodash"));
10
10
  const utils_1 = require("../utils");
11
- const commands = {};
12
- exports.commands = commands;
11
+ const mixins_1 = require("./mixins");
13
12
  const ALL_PERMISSIONS_MAGIC = 'all';
14
13
  const PM_ACTION = Object.freeze({
15
14
  GRANT: 'grant',
@@ -30,17 +29,25 @@ const PERMISSIONS_TYPE = Object.freeze({
30
29
  GRANTED: 'granted',
31
30
  REQUESTED: 'requested',
32
31
  });
32
+ /**
33
+ * @this {AndroidDriver}
34
+ * @param {*} permissions
35
+ * @param {*} appPackage
36
+ * @param {*} action
37
+ * @todo FIXME: type this
38
+ */
33
39
  async function changePermissionsViaPm(permissions, appPackage, action) {
34
40
  if (!lodash_1.default.values(PM_ACTION).includes(action)) {
35
41
  throw new driver_1.errors.InvalidArgumentError(`Unknown action '${action}'. ` +
36
42
  `Only ${JSON.stringify(lodash_1.default.values(PM_ACTION))} actions are supported`);
37
43
  }
44
+ const adb = /** @type {ADB} */ (this.adb);
38
45
  let affectedPermissions = lodash_1.default.isArray(permissions) ? permissions : [permissions];
39
46
  if (lodash_1.default.toLower(permissions) === ALL_PERMISSIONS_MAGIC) {
40
- const dumpsys = await this.adb.shell(['dumpsys', 'package', appPackage]);
41
- const grantedPermissions = await this.adb.getGrantedPermissions(appPackage, dumpsys);
47
+ const dumpsys = await adb.shell(['dumpsys', 'package', appPackage]);
48
+ const grantedPermissions = await adb.getGrantedPermissions(appPackage, dumpsys);
42
49
  if (action === PM_ACTION.GRANT) {
43
- const reqPermissons = await this.adb.getReqPermissions(appPackage, dumpsys);
50
+ const reqPermissons = await adb.getReqPermissions(appPackage, dumpsys);
44
51
  affectedPermissions = lodash_1.default.difference(reqPermissons, grantedPermissions);
45
52
  }
46
53
  else {
@@ -52,12 +59,19 @@ async function changePermissionsViaPm(permissions, appPackage, action) {
52
59
  }
53
60
  }
54
61
  if (action === PM_ACTION.GRANT) {
55
- await this.adb.grantPermissions(appPackage, affectedPermissions);
62
+ await adb.grantPermissions(appPackage, affectedPermissions);
56
63
  }
57
64
  else {
58
- await bluebird_1.default.all(affectedPermissions.map((name) => this.adb.revokePermission(appPackage, name)));
65
+ await bluebird_1.default.all(affectedPermissions.map((name) => adb.revokePermission(appPackage, name)));
59
66
  }
60
67
  }
68
+ /**
69
+ * @this {AndroidDriver}
70
+ * @param {*} permissions
71
+ * @param {*} appPackage
72
+ * @param {*} action
73
+ * @todo FIXME: type this
74
+ */
61
75
  async function changePermissionsViaAppops(permissions, appPackage, action) {
62
76
  if (!lodash_1.default.values(APPOPS_ACTION).includes(action)) {
63
77
  throw new driver_1.errors.InvalidArgumentError(`Unknown action '${action}'. ` +
@@ -68,89 +82,63 @@ async function changePermissionsViaAppops(permissions, appPackage, action) {
68
82
  `'${PERMISSION_TARGET.PM}' target. ` +
69
83
  `Check AppOpsManager.java from Android platform sources to get the full list of supported AppOps permissions`);
70
84
  }
71
- const promises = (lodash_1.default.isArray(permissions) ? permissions : [permissions])
72
- .map((permission) => this.adb.shell(['appops', 'set', appPackage, permission, action]));
85
+ const promises = (lodash_1.default.isArray(permissions) ? permissions : [permissions]).map((permission) =>
86
+ /** @type {ADB} */ (this.adb).shell(['appops', 'set', appPackage, permission, action]));
73
87
  await bluebird_1.default.all(promises);
74
88
  }
75
89
  /**
76
- * @typedef {Object} ChangePermissionsOptions
77
- * @property {!string|Array<string>} permissions
78
- * If `target` is set to 'pm':
79
- * The full name of the permission to be changed
80
- * or a list of permissions. Check https://developer.android.com/reference/android/Manifest.permission
81
- * to get the full list of standard Android permssion names. Mandatory argument.
82
- * If 'all' magic string is passed then the chosen action is going to be applied to all
83
- * permisisons requested/granted by 'appPackage'.
84
- * If `target` is set to 'appops':
85
- * The full name of the appops permission to be changed
86
- * or a list of permissions. Check AppOpsManager.java sources to get the full list of
87
- * supported appops permission names for the given Android pklatform.
88
- * Examples: 'ACTIVITY_RECOGNITION', 'SMS_FINANCIAL_TRANSACTIONS', 'READ_SMS', 'ACCESS_NOTIFICATIONS'.
89
- * The 'all' magic string is unsupported.
90
- * @property {string} appPackage [this.opts.appPackage] The application package to set change
91
- * permissions on. Defaults to the package name under test.
92
- * @property {string} action [grant|allow] One of `PM_ACTION` values if `target` is set to 'pm',
93
- * otherwise one of `APPOPS_ACTION` values
94
- * @property {string} target [pm] Either 'pm' or 'appops'. The 'appops' one requires
95
- * 'adb_shell' server security option to be enabled.
96
- */
97
- /**
98
- * Changes package permissions in runtime.
99
- *
100
- * @param {?ChangePermissionsOptions} opts - Available options mapping.
101
- * @throws {Error} if there was a failure while changing permissions
90
+ * @type {import('./mixins').PermissionsMixin & ThisType<import('../driver').AndroidDriver>}
91
+ * @satisfies {import('@appium/types').ExternalDriver}
102
92
  */
103
- commands.mobileChangePermissions = async function mobileChangePermissions(opts = {}) {
104
- const { permissions, appPackage = this.opts.appPackage, action = lodash_1.default.toLower(opts.target) === PERMISSION_TARGET.APPOPS ? APPOPS_ACTION.ALLOW : PM_ACTION.GRANT, target = PERMISSION_TARGET.PM, } = opts;
105
- if (lodash_1.default.isNil(permissions)) {
106
- throw new driver_1.errors.InvalidArgumentError(`'permissions' argument is required`);
107
- }
108
- if (lodash_1.default.isEmpty(permissions)) {
109
- throw new driver_1.errors.InvalidArgumentError(`'permissions' argument must not be empty`);
110
- }
111
- switch (lodash_1.default.toLower(target)) {
112
- case PERMISSION_TARGET.PM:
113
- return await changePermissionsViaPm.bind(this)(permissions, appPackage, lodash_1.default.toLower(action));
114
- case PERMISSION_TARGET.APPOPS:
115
- this.ensureFeatureEnabled(utils_1.ADB_SHELL_FEATURE);
116
- return await changePermissionsViaAppops.bind(this)(permissions, appPackage, lodash_1.default.toLower(action));
117
- default:
118
- throw new driver_1.errors.InvalidArgumentError(`'target' argument must be one of: ${lodash_1.default.values(PERMISSION_TARGET)}`);
119
- }
93
+ const PermissionsMixin = {
94
+ async mobileChangePermissions(opts) {
95
+ const { permissions, appPackage = this.opts.appPackage, action = lodash_1.default.toLower(opts.target) === PERMISSION_TARGET.APPOPS
96
+ ? APPOPS_ACTION.ALLOW
97
+ : PM_ACTION.GRANT, target = PERMISSION_TARGET.PM, } = opts;
98
+ if (lodash_1.default.isNil(permissions)) {
99
+ throw new driver_1.errors.InvalidArgumentError(`'permissions' argument is required`);
100
+ }
101
+ if (lodash_1.default.isEmpty(permissions)) {
102
+ throw new driver_1.errors.InvalidArgumentError(`'permissions' argument must not be empty`);
103
+ }
104
+ switch (lodash_1.default.toLower(target)) {
105
+ case PERMISSION_TARGET.PM:
106
+ return await changePermissionsViaPm.bind(this)(permissions, appPackage, lodash_1.default.toLower(action));
107
+ case PERMISSION_TARGET.APPOPS:
108
+ this.ensureFeatureEnabled(utils_1.ADB_SHELL_FEATURE);
109
+ return await changePermissionsViaAppops.bind(this)(permissions, appPackage, lodash_1.default.toLower(action));
110
+ default:
111
+ throw new driver_1.errors.InvalidArgumentError(`'target' argument must be one of: ${lodash_1.default.values(PERMISSION_TARGET)}`);
112
+ }
113
+ },
114
+ async mobileGetPermissions(opts = {}) {
115
+ const { type = PERMISSIONS_TYPE.REQUESTED, appPackage = this.opts.appPackage } = opts;
116
+ const adb = /** @type {ADB} */ (this.adb);
117
+ /**
118
+ * @type {(pkg: string) => Promise<string[]>}
119
+ */
120
+ let actionFunc;
121
+ switch (lodash_1.default.toLower(type)) {
122
+ case PERMISSIONS_TYPE.REQUESTED:
123
+ actionFunc = (pkg) => adb.getReqPermissions(pkg);
124
+ break;
125
+ case PERMISSIONS_TYPE.GRANTED:
126
+ actionFunc = (pkg) => adb.getGrantedPermissions(pkg);
127
+ break;
128
+ case PERMISSIONS_TYPE.DENIED:
129
+ actionFunc = (pkg) => adb.getDeniedPermissions(pkg);
130
+ break;
131
+ default:
132
+ throw new driver_1.errors.InvalidArgumentError(`Unknown permissions type '${type}'. ` +
133
+ `Only ${JSON.stringify(lodash_1.default.values(PERMISSIONS_TYPE))} types are supported`);
134
+ }
135
+ return await actionFunc(/** @type {string} */ (appPackage));
136
+ },
120
137
  };
138
+ (0, mixins_1.mixin)(PermissionsMixin);
139
+ exports.default = PermissionsMixin;
121
140
  /**
122
- * @typedef {Object} GetPermissionsOptions
123
- * @property {string} type [requested] - One of possible permission types to get.
124
- * Can be any of `PERMISSIONS_TYPE` values.
125
- * @property {string} appPackage [this.opts.appPackage] - The application package to set change
126
- * permissions on. Defaults to the package name under test.
141
+ * @typedef {import('appium-adb').ADB} ADB
142
+ * @typedef {import('../driver').AndroidDriver} AndroidDriver
127
143
  */
128
- /**
129
- * Gets runtime permissions list for the given application package.
130
- *
131
- * @param {GetPermissionsOptions} opts - Available options mapping.
132
- * @returns {Array<string>} The list of retrieved permissions for the given type
133
- * (can also be empty).
134
- * @throws {Error} if there was an error while getting permissions.
135
- */
136
- commands.mobileGetPermissions = async function mobileGetPermissions(opts = {}) {
137
- const { type = PERMISSIONS_TYPE.REQUESTED, appPackage = this.opts.appPackage, } = opts;
138
- let actionFunc;
139
- switch (lodash_1.default.toLower(type)) {
140
- case PERMISSIONS_TYPE.REQUESTED:
141
- actionFunc = (pkg) => this.adb.getReqPermissions(pkg);
142
- break;
143
- case PERMISSIONS_TYPE.GRANTED:
144
- actionFunc = (pkg) => this.adb.getGrantedPermissions(pkg);
145
- break;
146
- case PERMISSIONS_TYPE.DENIED:
147
- actionFunc = (pkg) => this.adb.getDeniedPermissions(pkg);
148
- break;
149
- default:
150
- throw new driver_1.errors.InvalidArgumentError(`Unknown permissions type '${type}'. ` +
151
- `Only ${JSON.stringify(lodash_1.default.values(PERMISSIONS_TYPE))} types are supported`);
152
- }
153
- return await actionFunc(appPackage);
154
- };
155
- exports.default = commands;
156
144
  //# sourceMappingURL=permissions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../lib/commands/permissions.js"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AACvB,0CAAuC;AACvC,wDAAyB;AACzB,oCAA6C;AAE7C,MAAM,QAAQ,GAAG,EAAE,CAAC;AAkKX,4BAAQ;AAhKjB,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AACH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACnB,CAAC,CAAC;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AACH,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;CACvB,CAAC,CAAC;AAEH,KAAK,UAAU,sBAAsB,CAAE,WAAW,EAAE,UAAU,EAAE,MAAM;IACpE,IAAI,CAAC,gBAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACzC,MAAM,IAAI,e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,KAAK;oBACpC,QAAQ,IAAI,CAAC,SAAS,CAAC,gBAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,sBAAsB,CAC3E,CAAC;SACL;QACD,OAAO,MAAM,UAAU,CAAC,qBAAqB,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF,CAAC;AAEF,IAAA,cAAK,EAAC,gBAAgB,CAAC,CAAC;AAExB,kBAAe,gBAAgB,CAAC;AAEhC;;;GAGG"}
@@ -1,194 +1,8 @@
1
- export default commands;
2
- export type StartRecordingOptions = {
3
- /**
4
- * - The path to the remote location, where the captured video should be uploaded.
5
- * The following protocols are supported: http/https, ftp.
6
- * Null or empty string value (the default setting) means the content of resulting
7
- * file should be encoded as Base64 and passed as the endpount response value.
8
- * An exception will be thrown if the generated media file is too big to
9
- * fit into the available process memory.
10
- * This option only has an effect if there is screen recording process in progreess
11
- * and `forceRestart` parameter is not set to `true`.
12
- */
13
- remotePath: string | null;
14
- /**
15
- * - The name of the user for the remote authentication. Only works if `remotePath` is provided.
16
- */
17
- user: string | null;
18
- /**
19
- * - The password for the remote authentication. Only works if `remotePath` is provided.
20
- */
21
- pass: string | null;
22
- /**
23
- * [PUT] - The http multipart upload method name. Only works if `remotePath` is provided.
24
- */
25
- method: string | null;
26
- /**
27
- * - Additional headers mapping for multipart http(s) uploads
28
- */
29
- headers: any | null;
30
- /**
31
- * [file] - The name of the form field, where the file content BLOB should be stored for
32
- * http(s) uploads
33
- */
34
- fileFieldName: string | null;
35
- /**
36
- * - Additional form fields for multipart http(s) uploads
37
- */
38
- formFields: (any | Array<Pair>) | null;
39
- /**
40
- * - The format is widthxheight.
41
- * The default value is the device's native display resolution (if supported),
42
- * 1280x720 if not. For best results,
43
- * use a size supported by your device's Advanced Video Coding (AVC) encoder.
44
- * For example, "1280x720"
45
- */
46
- videoSize: string | null;
47
- /**
48
- * - Set it to `true` in order to display additional information on the video overlay,
49
- * such as a timestamp, that is helpful in videos captured to illustrate bugs.
50
- * This option is only supported since API level 27 (Android P).
51
- */
52
- bugReport: boolean | null;
53
- /**
54
- * - The maximum recording time, in seconds. The default value is 180 (3 minutes).
55
- * The maximum value is 1800 (30 minutes). If the passed value is greater than 180 then
56
- * the algorithm will try to schedule multiple screen recording chunks and merge the
57
- * resulting videos into a single media file using `ffmpeg` utility.
58
- * If the utility is not available in PATH then the most recent screen recording chunk is
59
- * going to be returned.
60
- */
61
- timeLimit: (string | number) | null;
62
- /**
63
- * - The video bit rate for the video, in bits per second.
64
- * The default value is 4000000 (4 Mbit/s). You can increase the bit rate to improve video quality,
65
- * but doing so results in larger movie files.
66
- */
67
- bitRate: (string | number) | null;
68
- /**
69
- * - Whether to try to catch and upload/return the currently running screen recording
70
- * (`false`, the default setting) or ignore the result of it and start a new recording
71
- * immediately (`true`).
72
- */
73
- forceRestart: boolean | null;
74
- };
75
- export type StopRecordingOptions = {
76
- /**
77
- * - The path to the remote location, where the resulting video should be uploaded.
78
- * The following protocols are supported: http/https, ftp.
79
- * Null or empty string value (the default setting) means the content of resulting
80
- * file should be encoded as Base64 and passed as the endpount response value.
81
- * An exception will be thrown if the generated media file is too big to
82
- * fit into the available process memory.
83
- */
84
- remotePath: string | null;
85
- /**
86
- * - The name of the user for the remote authentication.
87
- */
88
- user: string | null;
89
- /**
90
- * - The password for the remote authentication.
91
- */
92
- pass: string | null;
93
- /**
94
- * - The http multipart upload method name. The 'PUT' one is used by default.
95
- */
96
- method: string | null;
97
- /**
98
- * - Additional headers mapping for multipart http(s) uploads
99
- */
100
- headers: any | null;
101
- /**
102
- * [file] - The name of the form field, where the file content BLOB should be stored for
103
- * http(s) uploads
104
- */
105
- fileFieldName: string | null;
106
- /**
107
- * - Additional form fields for multipart http(s) uploads
108
- */
109
- formFields: (any | Array<Pair>) | null;
110
- };
111
- export namespace commands {
112
- /**
113
- * @typedef {Object} StartRecordingOptions
114
- *
115
- * @property {?string} remotePath - The path to the remote location, where the captured video should be uploaded.
116
- * The following protocols are supported: http/https, ftp.
117
- * Null or empty string value (the default setting) means the content of resulting
118
- * file should be encoded as Base64 and passed as the endpount response value.
119
- * An exception will be thrown if the generated media file is too big to
120
- * fit into the available process memory.
121
- * This option only has an effect if there is screen recording process in progreess
122
- * and `forceRestart` parameter is not set to `true`.
123
- * @property {?string} user - The name of the user for the remote authentication. Only works if `remotePath` is provided.
124
- * @property {?string} pass - The password for the remote authentication. Only works if `remotePath` is provided.
125
- * @property {?string} method [PUT] - The http multipart upload method name. Only works if `remotePath` is provided.
126
- * @property {?Object} headers - Additional headers mapping for multipart http(s) uploads
127
- * @property {?string} fileFieldName [file] - The name of the form field, where the file content BLOB should be stored for
128
- * http(s) uploads
129
- * @property {?Object|Array<Pair>} formFields - Additional form fields for multipart http(s) uploads
130
- * @property {?string} videoSize - The format is widthxheight.
131
- * The default value is the device's native display resolution (if supported),
132
- * 1280x720 if not. For best results,
133
- * use a size supported by your device's Advanced Video Coding (AVC) encoder.
134
- * For example, "1280x720"
135
- * @property {?boolean} bugReport - Set it to `true` in order to display additional information on the video overlay,
136
- * such as a timestamp, that is helpful in videos captured to illustrate bugs.
137
- * This option is only supported since API level 27 (Android P).
138
- * @property {?string|number} timeLimit - The maximum recording time, in seconds. The default value is 180 (3 minutes).
139
- * The maximum value is 1800 (30 minutes). If the passed value is greater than 180 then
140
- * the algorithm will try to schedule multiple screen recording chunks and merge the
141
- * resulting videos into a single media file using `ffmpeg` utility.
142
- * If the utility is not available in PATH then the most recent screen recording chunk is
143
- * going to be returned.
144
- * @property {?string|number} bitRate - The video bit rate for the video, in bits per second.
145
- * The default value is 4000000 (4 Mbit/s). You can increase the bit rate to improve video quality,
146
- * but doing so results in larger movie files.
147
- * @property {?boolean} forceRestart - Whether to try to catch and upload/return the currently running screen recording
148
- * (`false`, the default setting) or ignore the result of it and start a new recording
149
- * immediately (`true`).
150
- */
151
- /**
152
- * Record the display of a real devices running Android 4.4 (API level 19) and higher.
153
- * Emulators are supported since API level 27 (Android P).
154
- * It records screen activity to an MPEG-4 file. Audio is not recorded with the video file.
155
- * If screen recording has been already started then the command will stop it forcefully and start a new one.
156
- * The previously recorded video file will be deleted.
157
- *
158
- * @param {?StartRecordingOptions} options - The available options.
159
- * @returns {string} Base64-encoded content of the recorded media file if
160
- * any screen recording is currently running or an empty string.
161
- * @throws {Error} If screen recording has failed to start or is not supported on the device under test.
162
- */
163
- function startRecordingScreen(options?: StartRecordingOptions | null): string;
164
- /**
165
- * @typedef {Object} StopRecordingOptions
166
- *
167
- * @property {?string} remotePath - The path to the remote location, where the resulting video should be uploaded.
168
- * The following protocols are supported: http/https, ftp.
169
- * Null or empty string value (the default setting) means the content of resulting
170
- * file should be encoded as Base64 and passed as the endpount response value.
171
- * An exception will be thrown if the generated media file is too big to
172
- * fit into the available process memory.
173
- * @property {?string} user - The name of the user for the remote authentication.
174
- * @property {?string} pass - The password for the remote authentication.
175
- * @property {?string} method - The http multipart upload method name. The 'PUT' one is used by default.
176
- * @property {?Object} headers - Additional headers mapping for multipart http(s) uploads
177
- * @property {?string} fileFieldName [file] - The name of the form field, where the file content BLOB should be stored for
178
- * http(s) uploads
179
- * @property {?Object|Array<Pair>} formFields - Additional form fields for multipart http(s) uploads
180
- */
181
- /**
182
- * Stop recording the screen.
183
- * If no screen recording has been started before then the method returns an empty string.
184
- *
185
- * @param {?StopRecordingOptions} options - The available options.
186
- * @returns {string} Base64-encoded content of the recorded media file if 'remotePath'
187
- * parameter is falsy or an empty string.
188
- * @throws {Error} If there was an error while getting the name of a media file
189
- * or the file content cannot be uploaded to the remote location
190
- * or screen recording is not supported on the device under test.
191
- */
192
- function stopRecordingScreen(options?: StopRecordingOptions | null): string;
193
- }
1
+ export default RecordScreenMixin;
2
+ export type ADB = import('appium-adb').ADB;
3
+ /**
4
+ * @type {import('./mixins').RecordScreenMixin & ThisType<import('../driver').AndroidDriver>}
5
+ * @satisfies {import('@appium/types').ExternalDriver}
6
+ */
7
+ declare const RecordScreenMixin: import('./mixins').RecordScreenMixin & ThisType<import('../driver').AndroidDriver>;
194
8
  //# sourceMappingURL=recordscreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"recordscreen.d.ts","sourceRoot":"","sources":["../../../lib/commands/recordscreen.js"],"names":[],"mappings":";;;;;;;;;;;;gBAgKe,MAAM;;;;UAQN,MAAM;;;;UACN,MAAM;;;;YACN,MAAM;;;;;;;;;mBAEN,MAAM;;;;iBAEN,MAAO,WAAW;;;;;;;;eAClB,MAAM;;;;;;eAKN,OAAO;;;;;;;;;gBAGP,MAAM,GAAC,MAAM;;;;;;cAMb,MAAM,GAAC,MAAM;;;;;;kBAGb,OAAO;;;;;;;;;;;gBA+DP,MAAM;;;;UAMN,MAAM;;;;UACN,MAAM;;;;YACN,MAAM;;;;;;;;;mBAEN,MAAM;;;;iBAEN,MAAO,WAAW;;;IA9GjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IAEH;;;;;;;;;;;OAWG;IACH,8EAyCC;IAED;;;;;;;;;;;;;;;;OAgBG;IAEH;;;;;;;;;;OAUG;IACH,4EA8DC"}
1
+ {"version":3,"file":"recordscreen.d.ts","sourceRoot":"","sources":["../../../lib/commands/recordscreen.js"],"names":[],"mappings":";kBA6Va,OAAO,YAAY,EAAE,GAAG;AApJrC;;;GAGG;AACH,iCAHU,OAAO,UAAU,EAAE,iBAAiB,GAAG,SAAS,OAAO,WAAW,EAAE,aAAa,CAAC,CA4I1F"}