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
@@ -21,6 +21,7 @@ import Unlocker, {
21
21
  PIN_UNLOCK,
22
22
  PIN_UNLOCK_KEY_EVENT,
23
23
  } from './unlock';
24
+ import {AndroidDriverConstraints} from '../constraints';
24
25
 
25
26
  const MOCK_APP_IDS_STORE = '/data/local/tmp/mock_apps.json';
26
27
  const PACKAGE_INSTALL_TIMEOUT_MS = 90000;
@@ -131,24 +132,33 @@ interface AndroidHelpers {
131
132
  */
132
133
  ensureDeviceLocale(adb: ADB, language?: string, country?: string, script?: string): Promise<void>;
133
134
 
134
- getDeviceInfoFromCaps(opts?: AndroidDriverOpts): Promise<ADBDeviceInfo>;
135
+ getDeviceInfoFromCaps<Opts extends AndroidDriverOpts>(opts?: Opts): Promise<ADBDeviceInfo>;
135
136
 
136
- createADB(opts?: AndroidDriverOpts): Promise<ADB>;
137
+ createADB<Opts extends AndroidDriverOpts>(opts?: Opts): Promise<ADB>;
137
138
 
138
- validatePackageActivityNames(opts: AndroidDriverOpts): void;
139
- getLaunchInfo(adb: ADB, opts: AndroidDriverOpts): Promise<ADBLaunchInfo | undefined>;
140
- resetApp(adb: ADB, opts: SetRequired<AndroidDriverOpts, 'appPackage'>): Promise<void>;
141
- installApk(adb: ADB, opts: SetRequired<AndroidDriverOpts, 'appPackage' | 'app'>): Promise<void>;
139
+ validatePackageActivityNames<Opts extends AndroidDriverOpts>(opts: Opts): void;
140
+ getLaunchInfo<Opts extends AndroidDriverOpts>(
141
+ adb: ADB,
142
+ opts: Opts
143
+ ): Promise<ADBLaunchInfo | undefined>;
144
+ resetApp<Opts extends AndroidDriverOpts>(
145
+ adb: ADB,
146
+ opts: SetRequired<Opts, 'appPackage' | 'app'>
147
+ ): Promise<void>;
148
+ installApk<Opts extends AndroidDriverOpts>(
149
+ adb: ADB,
150
+ opts: SetRequired<Opts, 'appPackage' | 'app'>
151
+ ): Promise<void>;
142
152
 
143
153
  /**
144
154
  * Installs an array of apks
145
155
  * @param adb Instance of Appium ADB object
146
156
  * @param opts Opts defined in driver.js
147
157
  */
148
- installOtherApks(
158
+ installOtherApks<Opts extends AndroidDriverOpts>(
149
159
  apks: string[],
150
160
  adb: ADB,
151
- opts: SetRequired<AndroidDriverOpts, 'appPackage' | 'app'>
161
+ opts: SetRequired<Opts, 'appPackage' | 'app'>
152
162
  ): Promise<void>;
153
163
 
154
164
  /**
@@ -204,14 +214,21 @@ interface AndroidHelpers {
204
214
  adb: ADB,
205
215
  opts: AndroidDriverOpts
206
216
  ): Promise<StringRecord>;
207
- unlock(driver: AndroidDriver, adb: ADB, capabilities: AndroidDriverCaps): Promise<void>;
217
+ unlock<D extends AndroidDriver, Caps extends AndroidDriverCaps>(
218
+ driver: D,
219
+ adb: ADB,
220
+ capabilities: Caps
221
+ ): Promise<void>;
208
222
  verifyUnlock(adb: ADB, timeoutMs?: number | null): Promise<void>;
209
- initDevice(adb: ADB, opts: AndroidDriverOpts): Promise<void>;
223
+ initDevice(adb: ADB, opts: AndroidDriverOpts): Promise<string | void>;
210
224
  removeNullProperties(obj: any): void;
211
225
  truncateDecimals(number: number, digits: number): number;
212
226
  isChromeBrowser(browser?: string): boolean;
213
227
  getChromePkg(browser: string): ValueOf<typeof CHROME_BROWSER_PACKAGE_ACTIVITY>;
214
- removeAllSessionWebSocketHandlers(server: AppiumServer, sessionId: string): Promise<void>;
228
+ removeAllSessionWebSocketHandlers(
229
+ server?: AppiumServer,
230
+ sessionId?: string | null
231
+ ): Promise<void>;
215
232
  parseArray(cap: string | string[]): string[];
216
233
 
217
234
  /**
@@ -233,7 +250,7 @@ interface AndroidHelpers {
233
250
  * appPackage/appActivity caps have already been provided.
234
251
  * @privateRemarks In practice, this fn is only ever provided a `AndroidDriverOpts` object
235
252
  */
236
- adjustBrowserSessionCaps<T extends AndroidDriverCaps>(caps: T): T;
253
+ adjustBrowserSessionCaps(caps: AndroidDriverCaps): AndroidDriverCaps;
237
254
 
238
255
  /**
239
256
  * Checks whether the current device under test is an emulator
@@ -847,7 +864,7 @@ const AndroidHelpers: AndroidHelpers = {
847
864
  // clean up remote string.json if present
848
865
  await adb.rimraf(remoteFile);
849
866
 
850
- let app;
867
+ let app: string;
851
868
  try {
852
869
  app = opts.app || (await adb.pullApk(opts.appPackage!, opts.tmpDir!));
853
870
  } catch (err) {
@@ -865,7 +882,7 @@ const AndroidHelpers: AndroidHelpers = {
865
882
 
866
883
  const stringsTmpDir = path.resolve(opts.tmpDir!, opts.appPackage!);
867
884
  try {
868
- logger.debug('Extracting strings from apk', app, language, stringsTmpDir);
885
+ logger.debug('Extracting strings from apk', app!, language, stringsTmpDir);
869
886
  const {apkStrings, localPath} = await adb.extractStringsFromApk(
870
887
  app!,
871
888
  language,
@@ -7,7 +7,8 @@ import {util} from '@appium/support';
7
7
  import type {Capabilities, Position, StringRecord} from '@appium/types';
8
8
  import {sleep} from 'asyncbox';
9
9
  import _ from 'lodash';
10
- import type {AndroidDriver, AndroidDriverConstraints} from '../driver';
10
+ import type {AndroidDriver} from '../driver';
11
+ import type {AndroidDriverConstraints} from '../constraints';
11
12
  import logger from '../logger';
12
13
  import type {FastUnlockOptions} from './types';
13
14
  import ADB from 'appium-adb';
package/lib/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ import {install} from 'source-map-support';
2
+ install();
3
+
4
+ import {AndroidDriver} from './driver';
5
+ export type * from './commands';
6
+ export {ANDROID_DRIVER_CONSTRAINTS as commonCapConstraints} from './constraints';
7
+ export * from './driver';
8
+ export {SETTINGS_HELPER_PKG_ID, default as androidHelpers} from './helpers/android';
9
+ export type * from './helpers/types';
10
+ export {
11
+ CHROMIUM_WIN,
12
+ NATIVE_WIN,
13
+ WEBVIEW_BASE,
14
+ WEBVIEW_WIN,
15
+ default as webviewHelpers,
16
+ } from './helpers/webview';
17
+
18
+ export default AndroidDriver;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appium-android-driver",
3
- "version": "5.14.0-alpha.0",
3
+ "version": "5.14.0-alpha2",
4
4
  "description": "Android UiAutomator and Chrome support for Appium",
5
5
  "keywords": [
6
6
  "appium",
@@ -19,18 +19,18 @@
19
19
  },
20
20
  "license": "Apache-2.0",
21
21
  "author": "Appium Contributors",
22
- "main": "./build/index.js",
22
+ "main": "./build/lib/index.js",
23
23
  "bin": {},
24
24
  "directories": {
25
25
  "lib": "lib"
26
26
  },
27
27
  "files": [
28
- "index.js",
29
28
  "lib",
30
- "build/index.js",
31
- "build/lib",
29
+ "build",
32
30
  "bootstrap/bin/AppiumBootstrap.jar",
33
- "CHANGELOG.md"
31
+ "CHANGELOG.md",
32
+ "!build/test",
33
+ "!build/tsconfig.tsbuildinfo"
34
34
  ],
35
35
  "scripts": {
36
36
  "build": "tsc -b",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "appium-adb": "^9.12.0",
61
- "appium-chromedriver": "^5.2.0",
61
+ "appium-chromedriver": "^5.5.1",
62
62
  "asyncbox": "^2.8.0",
63
63
  "axios": "^1.x",
64
64
  "bluebird": "^3.4.7",
@@ -77,12 +77,12 @@
77
77
  "ws": "^8.0.0"
78
78
  },
79
79
  "devDependencies": {
80
- "@appium/eslint-config-appium": "^8.0.3",
80
+ "@appium/eslint-config-appium": "^8.0.4",
81
81
  "@appium/eslint-config-appium-ts": "^0.3.1",
82
- "@appium/support": "^4.0.1",
83
- "@appium/test-support": "^3.0.0",
82
+ "@appium/support": "^4.1.2",
83
+ "@appium/test-support": "^3.0.20",
84
84
  "@appium/tsconfig": "^0.3.0",
85
- "@appium/types": "^0.13.0",
85
+ "@appium/types": "^0.13.2",
86
86
  "@commitlint/cli": "^17.6.3",
87
87
  "@commitlint/config-conventional": "^17.6.3",
88
88
  "@semantic-release/changelog": "^6.0.1",
@@ -103,7 +103,7 @@
103
103
  "@typescript-eslint/parser": "^5.59.5",
104
104
  "@xmldom/xmldom": "^0.x",
105
105
  "android-apidemos": "^4.1.0",
106
- "appium": "^2.0.0-rc.3",
106
+ "appium": "^2.0.0-rc.5",
107
107
  "chai": "^4.1.2",
108
108
  "chai-as-promised": "^7.1.1",
109
109
  "conventional-changelog-conventionalcommits": "^6.0.0",
@@ -121,7 +121,7 @@
121
121
  "semantic-release": "^20.0.2",
122
122
  "sinon": "^15.0.0",
123
123
  "ts-node": "^10.9.1",
124
- "typescript": "^5.1.3",
124
+ "typescript": "~5.0.4",
125
125
  "xpath": "^0.x"
126
126
  },
127
127
  "peerDependencies": {
@@ -131,5 +131,5 @@
131
131
  "node": ">=14",
132
132
  "npm": ">=8"
133
133
  },
134
- "types": "./build/index.d.ts"
134
+ "types": "./build/lib/index.d.ts"
135
135
  }
@@ -1,3 +0,0 @@
1
- import { mixin } from './mixins';
2
- export { mixin };
3
- //# sourceMappingURL=mixin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mixin.d.ts","sourceRoot":"","sources":["../../../lib/commands/mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mixin = void 0;
4
- const mixins_1 = require("./mixins");
5
- Object.defineProperty(exports, "mixin", { enumerable: true, get: function () { return mixins_1.mixin; } });
6
- //# sourceMappingURL=mixin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mixin.js","sourceRoot":"","sources":["../../../lib/commands/mixin.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAIxB,sFAJA,cAAK,OAIA"}