appium-xcuitest-driver 10.16.1 → 10.16.2

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.
@@ -264,6 +264,7 @@ export class RealDevice {
264
264
  readonly udid: string;
265
265
  private readonly _log: AppiumLogger;
266
266
  readonly devicectl: Devicectl;
267
+ private platformVersion: string | undefined;
267
268
 
268
269
  constructor(udid: string, logger?: AppiumLogger) {
269
270
  this.udid = udid;
@@ -293,18 +294,20 @@ export class RealDevice {
293
294
  timeoutMs = IO_TIMEOUT_MS,
294
295
  } = opts;
295
296
  const timer = new timing.Timer().start();
296
- const afcService = await services.startAfcService(this.udid);
297
+ const platformVersion = await this.getPlatformVersion();
298
+ const useRemoteXPC = !!platformVersion && util.compareVersions(platformVersion, '>=', '18.0');
299
+ const afcClient = await AfcClient.createForDevice(this.udid, useRemoteXPC);
297
300
  try {
298
301
  let bundlePathOnPhone: string;
299
302
  if ((await fs.stat(appPath)).isFile()) {
300
303
  // https://github.com/doronz88/pymobiledevice3/blob/6ff5001f5776e03b610363254e82d7fbcad4ef5f/pymobiledevice3/services/installation_proxy.py#L75
301
304
  bundlePathOnPhone = `/${path.basename(appPath)}`;
302
- await pushFile(afcService, appPath, bundlePathOnPhone, {
305
+ await pushFile(afcClient, appPath, bundlePathOnPhone, {
303
306
  timeoutMs,
304
307
  });
305
308
  } else {
306
309
  bundlePathOnPhone = `${INSTALLATION_STAGING_DIR}/${bundleId}`;
307
- await pushFolder(afcService, appPath, bundlePathOnPhone, {
310
+ await pushFolder(afcClient, appPath, bundlePathOnPhone, {
308
311
  enableParallelPush: true,
309
312
  timeoutMs,
310
313
  });
@@ -325,7 +328,7 @@ export class RealDevice {
325
328
  errMessage += `. Original error: ${(err as Error).message}`;
326
329
  throw new Error(errMessage);
327
330
  } finally {
328
- afcService.close();
331
+ await afcClient.close();
329
332
  }
330
333
  this.log.info(
331
334
  `The installation of '${bundleId}' succeeded after ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`
@@ -513,7 +516,10 @@ export class RealDevice {
513
516
  }
514
517
 
515
518
  async getPlatformVersion(): Promise<string> {
516
- return await utilities.getOSVersion(this.udid);
519
+ if (!this.platformVersion) {
520
+ this.platformVersion = await utilities.getOSVersion(this.udid) as string;
521
+ }
522
+ return this.platformVersion;
517
523
  }
518
524
 
519
525
  async reset(opts: {bundleId?: string; fullReset?: boolean}): Promise<void> {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-xcuitest-driver",
3
- "version": "10.16.1",
3
+ "version": "10.16.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-xcuitest-driver",
9
- "version": "10.16.1",
9
+ "version": "10.16.2",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@appium/strongbox": "^1.0.0-rc.1",
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "xcuitest",
9
9
  "xctest"
10
10
  ],
11
- "version": "10.16.1",
11
+ "version": "10.16.2",
12
12
  "author": "Appium Contributors",
13
13
  "license": "Apache-2.0",
14
14
  "repository": {