appium-uiautomator2-driver 2.44.1 → 2.44.3
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.
- package/CHANGELOG.md +14 -0
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +20 -11
- package/build/lib/driver.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/driver.ts +20 -13
- package/npm-shrinkwrap.json +128 -266
- package/package.json +1 -1
package/lib/driver.ts
CHANGED
|
@@ -372,9 +372,27 @@ class AndroidUiautomator2Driver
|
|
|
372
372
|
};
|
|
373
373
|
_.defaults(this.opts, defaultOpts);
|
|
374
374
|
|
|
375
|
+
this.opts.adbPort = this.opts.adbPort || DEFAULT_ADB_PORT;
|
|
376
|
+
// get device udid for this session
|
|
377
|
+
const {udid, emPort} = await this.getDeviceInfoFromCaps();
|
|
378
|
+
this.opts.udid = udid;
|
|
379
|
+
// @ts-expect-error do not put random stuff on opts
|
|
380
|
+
this.opts.emPort = emPort;
|
|
381
|
+
// now that we know our java version and device info, we can create our
|
|
382
|
+
// ADB instance
|
|
383
|
+
this.adb = await this.createADB();
|
|
384
|
+
|
|
375
385
|
if (this.isChromeSession) {
|
|
376
|
-
this.log.info(
|
|
377
|
-
const {pkg, activity} = utils.getChromePkg(this.opts.browserName!);
|
|
386
|
+
this.log.info(`We're going to run a Chrome-based session`);
|
|
387
|
+
const {pkg, activity: defaultActivity} = utils.getChromePkg(this.opts.browserName!);
|
|
388
|
+
let activity: string = defaultActivity;
|
|
389
|
+
if (await this.adb.getApiLevel() >= 24) {
|
|
390
|
+
try {
|
|
391
|
+
activity = await this.adb.resolveLaunchableActivity(pkg);
|
|
392
|
+
} catch (e) {
|
|
393
|
+
this.log.warn(`Using the default ${pkg} activity ${activity}. Original error: ${e.message}`);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
378
396
|
this.opts.appPackage = this.caps.appPackage = pkg;
|
|
379
397
|
this.opts.appActivity = this.caps.appActivity = activity;
|
|
380
398
|
this.log.info(`Chrome-type package and activity are ${pkg} and ${activity}`);
|
|
@@ -397,7 +415,6 @@ class AndroidUiautomator2Driver
|
|
|
397
415
|
'without the target application'
|
|
398
416
|
);
|
|
399
417
|
}
|
|
400
|
-
this.opts.adbPort = this.opts.adbPort || DEFAULT_ADB_PORT;
|
|
401
418
|
|
|
402
419
|
const result = await this.startUiAutomator2Session(startSessionOpts);
|
|
403
420
|
|
|
@@ -651,16 +668,6 @@ class AndroidUiautomator2Driver
|
|
|
651
668
|
async startUiAutomator2Session(
|
|
652
669
|
caps: Uiautomator2StartSessionOpts
|
|
653
670
|
): Promise<Uiautomator2SessionCaps> {
|
|
654
|
-
// get device udid for this session
|
|
655
|
-
const {udid, emPort} = await this.getDeviceInfoFromCaps();
|
|
656
|
-
this.opts.udid = udid;
|
|
657
|
-
// @ts-expect-error do not put random stuff on opts
|
|
658
|
-
this.opts.emPort = emPort;
|
|
659
|
-
|
|
660
|
-
// now that we know our java version and device info, we can create our
|
|
661
|
-
// ADB instance
|
|
662
|
-
this.adb = await this.createADB();
|
|
663
|
-
|
|
664
671
|
const appInfo = await this.performSessionPreExecSetup();
|
|
665
672
|
// set actual device name, udid, platform version, screen size, screen density, model and manufacturer details
|
|
666
673
|
const sessionInfo: Uiautomator2SessionInfo = {
|