appium-xcuitest-driver 11.3.1 → 11.4.1

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 CHANGED
@@ -1,3 +1,15 @@
1
+ ## [11.4.1](https://github.com/appium/appium-xcuitest-driver/compare/v11.4.0...v11.4.1) (2026-05-15)
2
+
3
+ ### Bug Fixes
4
+
5
+ * prevent ECONNRESET by removing redundant RSD connections in AfcClient ([#2840](https://github.com/appium/appium-xcuitest-driver/issues/2840)) ([9ce708b](https://github.com/appium/appium-xcuitest-driver/commit/9ce708b768d1a2d88fec930ac01755637590e7a2))
6
+
7
+ ## [11.4.0](https://github.com/appium/appium-xcuitest-driver/compare/v11.3.1...v11.4.0) (2026-05-13)
8
+
9
+ ### Features
10
+
11
+ * add resign task ([#2836](https://github.com/appium/appium-xcuitest-driver/issues/2836)) ([7dfca62](https://github.com/appium/appium-xcuitest-driver/commit/7dfca6298a0dd17b016d71793e465425bb04e59a))
12
+
1
13
  ## [11.3.1](https://github.com/appium/appium-xcuitest-driver/compare/v11.3.0...v11.3.1) (2026-05-12)
2
14
 
3
15
  ### Miscellaneous Chores
@@ -23,7 +23,7 @@ export interface CreateForAppOptions {
23
23
  */
24
24
  export declare class AfcClient {
25
25
  private readonly service;
26
- private readonly remoteXPCConnection?;
26
+ private readonly _isRemoteXPC;
27
27
  private constructor();
28
28
  /**
29
29
  * Check if this client is using RemoteXPC
@@ -55,12 +55,6 @@ export declare class AfcClient {
55
55
  * @returns AFC client instance
56
56
  */
57
57
  static createForApp(udid: string, bundleId: string, useRemoteXPC: boolean, options?: CreateForAppOptions): Promise<AfcClient>;
58
- /**
59
- * Helper to safely execute remoteXPC operations with connection cleanup
60
- * @param operation - Async operation that returns an AfcClient
61
- * @returns AfcClient on success, null on failure
62
- */
63
- private static withRemoteXpcConnection;
64
58
  /**
65
59
  * Check if a path is a directory
66
60
  */
@@ -99,7 +93,7 @@ export declare class AfcClient {
99
93
  */
100
94
  pull(remotePath: string, localPath: string, options?: AfcPullOptions): Promise<void>;
101
95
  /**
102
- * Close the AFC service connection and remoteXPC connection if present
96
+ * Close the AFC service connection
103
97
  */
104
98
  close(): Promise<void>;
105
99
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"afc-client.d.ts","sourceRoot":"","sources":["../../../lib/device/afc-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAa1C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1F;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAcD;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4C;IACpE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAsB;IAE3D,OAAO;IAQP;;OAEG;IACH,OAAO,KAAK,WAAW,GAEtB;IAED;;OAEG;IACH,OAAO,KAAK,mBAAmB,GAE9B;IAED;;OAEG;IACH,OAAO,KAAK,mBAAmB,GAE9B;IAED;;;;;;OAMG;WACU,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;IAoBrF;;;;;;;;OAQG;WACU,YAAY,CACvB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,OAAO,EACrB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,SAAS,CAAC;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G;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQlD;;OAEG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBpD;;OAEG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhE;;OAEG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BpE;;;;;;;OAOG;IACG,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc9F;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;YACW,gBAAgB;IAW9B;;;OAGG;YACW,eAAe;IAuD7B,wEAAwE;YAC1D,qBAAqB;IAkBnC,6EAA6E;YAC/D,4BAA4B;IAkB1C;;;OAGG;IACH,OAAO,CAAC,2BAA2B;YAerB,uBAAuB;IAsCrC;;;OAGG;YACW,+BAA+B;IAqC7C;;;;;;OAMG;YACW,cAAc;IAM5B;;;;;;OAMG;YACW,cAAc;IAS5B;;OAEG;YACW,gBAAgB;CAQ/B"}
@@ -22,16 +22,16 @@ const utils_1 = require("../utils");
22
22
  */
23
23
  class AfcClient {
24
24
  service;
25
- remoteXPCConnection;
26
- constructor(service, remoteXPCConnection) {
25
+ _isRemoteXPC;
26
+ constructor(service, isRemoteXPC = false) {
27
27
  this.service = service;
28
- this.remoteXPCConnection = remoteXPCConnection;
28
+ this._isRemoteXPC = isRemoteXPC;
29
29
  }
30
30
  /**
31
31
  * Check if this client is using RemoteXPC
32
32
  */
33
33
  get isRemoteXPC() {
34
- return !!this.remoteXPCConnection;
34
+ return this._isRemoteXPC;
35
35
  }
36
36
  /**
37
37
  * Get service as RemoteXPC AFC service
@@ -54,17 +54,20 @@ class AfcClient {
54
54
  */
55
55
  static async createForDevice(udid, useRemoteXPC) {
56
56
  if (useRemoteXPC) {
57
- const client = await AfcClient.withRemoteXpcConnection(async () => {
57
+ // Best-practice pattern (matches go-ios `defer rsd.Close()` and
58
+ // pymobiledevice3 single-RSD-per-session): perform exactly one RSD
59
+ // probe via `startAfcService`, which discovers the AFC port, closes
60
+ // its discovery RSD eagerly, and returns a self-contained AfcService
61
+ // bound to its own per-service TCP socket. Opening an extra RSD here
62
+ // would only race with the one inside `startAfcService` and trigger
63
+ // an ECONNRESET from the on-device `remoted` daemon.
64
+ try {
58
65
  const Services = await (0, remotexpc_utils_1.getRemoteXPCServices)();
59
- const connectionResult = await Services.createRemoteXPCConnection(udid);
60
66
  const afcService = await Services.startAfcService(udid);
61
- return {
62
- service: afcService,
63
- connection: connectionResult.remoteXPC,
64
- };
65
- });
66
- if (client) {
67
- return client;
67
+ return new AfcClient(afcService, true);
68
+ }
69
+ catch (err) {
70
+ logger_1.log.error(`Failed to create AFC client via RemoteXPC: ${err.message}, falling back to appium-ios-device`);
68
71
  }
69
72
  }
70
73
  const afcService = await appium_ios_device_1.services.startAfcService(udid);
@@ -83,22 +86,34 @@ class AfcClient {
83
86
  const { containerType = null, skipDocumentsCheck = false } = options ?? {};
84
87
  const isDocuments = !skipDocumentsCheck && containerType?.toLowerCase() === 'documents';
85
88
  if (useRemoteXPC) {
86
- const client = await AfcClient.withRemoteXpcConnection(async () => {
89
+ // Best-practice pattern (matches go-ios `defer rsd.Close()`): one RSD
90
+ // probe via `startHouseArrestService`, vend the AFC service, then
91
+ // release the discovery RSD eagerly. The vended AfcService has its
92
+ // own dedicated socket so it does not need the discovery RSD to
93
+ // remain open. Avoids the prior pattern of overlapping RSD probes
94
+ // that triggered ECONNRESETs from the on-device `remoted` daemon.
95
+ let houseArrestRemoteXPC;
96
+ try {
87
97
  const Services = await (0, remotexpc_utils_1.getRemoteXPCServices)();
88
- const connectionResult = await Services.createRemoteXPCConnection(udid);
89
- const { houseArrestService, remoteXPC: houseArrestRemoteXPC } = await Services.startHouseArrestService(udid);
98
+ const result = await Services.startHouseArrestService(udid);
99
+ houseArrestRemoteXPC = result.remoteXPC;
90
100
  const afcService = isDocuments
91
- ? await houseArrestService.vendDocuments(bundleId)
92
- : await houseArrestService.vendContainer(bundleId);
93
- // Use the remoteXPC from house arrest service if available, otherwise use the one from connection
94
- const connection = houseArrestRemoteXPC ?? connectionResult.remoteXPC;
95
- return {
96
- service: afcService,
97
- connection,
98
- };
99
- });
100
- if (client) {
101
- return client;
101
+ ? await result.houseArrestService.vendDocuments(bundleId)
102
+ : await result.houseArrestService.vendContainer(bundleId);
103
+ return new AfcClient(afcService, true);
104
+ }
105
+ catch (err) {
106
+ logger_1.log.error(`Failed to create AFC client via RemoteXPC: ${err.message}, falling back to appium-ios-device`);
107
+ }
108
+ finally {
109
+ if (houseArrestRemoteXPC) {
110
+ try {
111
+ await houseArrestRemoteXPC.close();
112
+ }
113
+ catch {
114
+ // ignore cleanup errors
115
+ }
116
+ }
102
117
  }
103
118
  }
104
119
  const houseArrestService = await appium_ios_device_1.services.startHouseArrestService(udid);
@@ -107,37 +122,6 @@ class AfcClient {
107
122
  : await houseArrestService.vendContainer(bundleId);
108
123
  return new AfcClient(afcService);
109
124
  }
110
- /**
111
- * Helper to safely execute remoteXPC operations with connection cleanup
112
- * @param operation - Async operation that returns an AfcClient
113
- * @returns AfcClient on success, null on failure
114
- */
115
- static async withRemoteXpcConnection(operation) {
116
- let remoteXPCConnection;
117
- let succeeded = false;
118
- try {
119
- const { service, connection } = await operation();
120
- remoteXPCConnection = connection;
121
- const client = new AfcClient(service, remoteXPCConnection);
122
- succeeded = true;
123
- return client;
124
- }
125
- catch (err) {
126
- logger_1.log.error(`Failed to create AFC client via RemoteXPC: ${err.message}, falling back to appium-ios-device`);
127
- return null;
128
- }
129
- finally {
130
- // Only close connection if we failed (if succeeded, the client owns it)
131
- if (remoteXPCConnection && !succeeded) {
132
- try {
133
- await remoteXPCConnection.close();
134
- }
135
- catch {
136
- // Ignore cleanup errors
137
- }
138
- }
139
- }
140
- }
141
125
  /**
142
126
  * Check if a path is a directory
143
127
  */
@@ -259,16 +243,10 @@ class AfcClient {
259
243
  }
260
244
  }
261
245
  /**
262
- * Close the AFC service connection and remoteXPC connection if present
246
+ * Close the AFC service connection
263
247
  */
264
248
  async close() {
265
249
  this.service.close();
266
- if (this.remoteXPCConnection) {
267
- try {
268
- await this.remoteXPCConnection.close();
269
- }
270
- catch { }
271
- }
272
250
  }
273
251
  /**
274
252
  * Create a read stream for a file (internal use only).
@@ -1 +1 @@
1
- {"version":3,"file":"afc-client.js","sourceRoot":"","sources":["../../../lib/device/afc-client.ts"],"names":[],"mappings":";;;;;;AACA,6CAAuD;AACvD,mDAA8C;AAC9C,0DAA6B;AAC7B,4CAAwC;AACxC,yDAA2C;AAE3C,uDAAuD;AACvD,sCAA8B;AAE9B,qEAA0E;AAC1E,oCAAqC;AA+BrC;;;;;;GAMG;AACH,MAAa,SAAS;IACH,OAAO,CAA4C;IACnD,mBAAmB,CAAuB;IAE3D,YACE,OAAkD,EAClD,mBAAyC;QAEzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,IAAY,WAAW;QACrB,OAAO,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,IAAY,mBAAmB;QAC7B,OAAO,IAAI,CAAC,OAA8B,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,IAAY,mBAAmB;QAC7B,OAAO,IAAI,CAAC,OAA8B,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAY,EAAE,YAAqB;QAC9D,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,MAAM,GAAG,MAAM,SA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AAC;YACvC,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAjhBD,8BAihBC;AAED;;;;GAIG;AACH,KAAK,UAAU,uBAAuB,CAAC,CAAgB,EAAE,CAAS;IAChE,IAAI,CAAC;QACH,MAAM,CAAC,CAAC;IACV,CAAC;IAAC,MAAM,CAAC;QACP,mFAAmF;IACrF,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
1
+ {"version":3,"file":"afc-client.js","sourceRoot":"","sources":["../../../lib/device/afc-client.ts"],"names":[],"mappings":";;;;;;AACA,6CAAuD;AACvD,mDAA8C;AAC9C,0DAA6B;AAC7B,4CAAwC;AACxC,yDAA2C;AAE3C,uDAAuD;AACvD,sCAA8B;AAE9B,qEAA0E;AAC1E,oCAAqC;AA+BrC;;;;;;GAMG;AACH,MAAa,SAAS;IACH,OAAO,CAA4C;IACnD,YAAY,CAAU;IAEvC,YACE,OAAkD,EAClD,cAAuB,KAAK;QAE5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAY,mBAAmB;QAC7B,OAAO,IAAI,CAAC,OAA8B,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,IAAY,mBAAmB;QAC7B,OAAO,IAAI,CAAC,OAA8B,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAY,EAAE,YAAqB;QAC9D,IAAI,YAAY,EAAE,CAAC;YACjB,gEAAgE;YAChE,mEAAmE;YACnE,oEAAoE;YACpE,qEAAqE;YACrE,qEAAqE;YACrE,oEAAoE;YACpE,qDAAqD;YACrD,IAAI,C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W,EAAE,IAAI;SAClB,CAAC,CAAC;QACH,MAAM,WAAW,GAAG,YAAE,CAAC,iBAAiB,CAAC,SAAS,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;QAEvE,MAAM,IAAA,mBAAQ,EAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,gBAAgB,CAAC,SAAiB;QAC9C,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,YAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACvC,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAzfD,8BAyfC;AAED;;;;GAIG;AACH,KAAK,UAAU,uBAAuB,CAAC,CAAgB,EAAE,CAAS;IAChE,IAAI,CAAC;QACH,MAAM,CAAC,CAAC;IACV,CAAC;IAAC,MAAM,CAAC;QACP,mFAAmF;IACrF,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -49,21 +49,21 @@ interface WalkDirPullWalkContext {
49
49
  */
50
50
  export class AfcClient {
51
51
  private readonly service: RemoteXPCAfcService | IOSDeviceAfcService;
52
- private readonly remoteXPCConnection?: RemoteXpcConnection;
52
+ private readonly _isRemoteXPC: boolean;
53
53
 
54
54
  private constructor(
55
55
  service: RemoteXPCAfcService | IOSDeviceAfcService,
56
- remoteXPCConnection?: RemoteXpcConnection,
56
+ isRemoteXPC: boolean = false,
57
57
  ) {
58
58
  this.service = service;
59
- this.remoteXPCConnection = remoteXPCConnection;
59
+ this._isRemoteXPC = isRemoteXPC;
60
60
  }
61
61
 
62
62
  /**
63
63
  * Check if this client is using RemoteXPC
64
64
  */
65
65
  private get isRemoteXPC(): boolean {
66
- return !!this.remoteXPCConnection;
66
+ return this._isRemoteXPC;
67
67
  }
68
68
 
69
69
  /**
@@ -89,17 +89,21 @@ export class AfcClient {
89
89
  */
90
90
  static async createForDevice(udid: string, useRemoteXPC: boolean): Promise<AfcClient> {
91
91
  if (useRemoteXPC) {
92
- const client = await AfcClient.withRemoteXpcConnection(async () => {
92
+ // Best-practice pattern (matches go-ios `defer rsd.Close()` and
93
+ // pymobiledevice3 single-RSD-per-session): perform exactly one RSD
94
+ // probe via `startAfcService`, which discovers the AFC port, closes
95
+ // its discovery RSD eagerly, and returns a self-contained AfcService
96
+ // bound to its own per-service TCP socket. Opening an extra RSD here
97
+ // would only race with the one inside `startAfcService` and trigger
98
+ // an ECONNRESET from the on-device `remoted` daemon.
99
+ try {
93
100
  const Services = await getRemoteXPCServices();
94
- const connectionResult = await Services.createRemoteXPCConnection(udid);
95
101
  const afcService = await Services.startAfcService(udid);
96
- return {
97
- service: afcService,
98
- connection: connectionResult.remoteXPC,
99
- };
100
- });
101
- if (client) {
102
- return client;
102
+ return new AfcClient(afcService, true);
103
+ } catch (err: any) {
104
+ log.error(
105
+ `Failed to create AFC client via RemoteXPC: ${err.message}, falling back to appium-ios-device`,
106
+ );
103
107
  }
104
108
  }
105
109
 
@@ -126,23 +130,33 @@ export class AfcClient {
126
130
  const isDocuments = !skipDocumentsCheck && containerType?.toLowerCase() === 'documents';
127
131
 
128
132
  if (useRemoteXPC) {
129
- const client = await AfcClient.withRemoteXpcConnection(async () => {
133
+ // Best-practice pattern (matches go-ios `defer rsd.Close()`): one RSD
134
+ // probe via `startHouseArrestService`, vend the AFC service, then
135
+ // release the discovery RSD eagerly. The vended AfcService has its
136
+ // own dedicated socket so it does not need the discovery RSD to
137
+ // remain open. Avoids the prior pattern of overlapping RSD probes
138
+ // that triggered ECONNRESETs from the on-device `remoted` daemon.
139
+ let houseArrestRemoteXPC: RemoteXpcConnection | undefined;
140
+ try {
130
141
  const Services = await getRemoteXPCServices();
131
- const connectionResult = await Services.createRemoteXPCConnection(udid);
132
- const {houseArrestService, remoteXPC: houseArrestRemoteXPC} =
133
- await Services.startHouseArrestService(udid);
142
+ const result = await Services.startHouseArrestService(udid);
143
+ houseArrestRemoteXPC = result.remoteXPC;
134
144
  const afcService = isDocuments
135
- ? await houseArrestService.vendDocuments(bundleId)
136
- : await houseArrestService.vendContainer(bundleId);
137
- // Use the remoteXPC from house arrest service if available, otherwise use the one from connection
138
- const connection = houseArrestRemoteXPC ?? connectionResult.remoteXPC;
139
- return {
140
- service: afcService,
141
- connection,
142
- };
143
- });
144
- if (client) {
145
- return client;
145
+ ? await result.houseArrestService.vendDocuments(bundleId)
146
+ : await result.houseArrestService.vendContainer(bundleId);
147
+ return new AfcClient(afcService, true);
148
+ } catch (err: any) {
149
+ log.error(
150
+ `Failed to create AFC client via RemoteXPC: ${err.message}, falling back to appium-ios-device`,
151
+ );
152
+ } finally {
153
+ if (houseArrestRemoteXPC) {
154
+ try {
155
+ await houseArrestRemoteXPC.close();
156
+ } catch {
157
+ // ignore cleanup errors
158
+ }
159
+ }
146
160
  }
147
161
  }
148
162
 
@@ -153,39 +167,6 @@ export class AfcClient {
153
167
  return new AfcClient(afcService);
154
168
  }
155
169
 
156
- /**
157
- * Helper to safely execute remoteXPC operations with connection cleanup
158
- * @param operation - Async operation that returns an AfcClient
159
- * @returns AfcClient on success, null on failure
160
- */
161
- private static async withRemoteXpcConnection<T extends RemoteXPCAfcService | IOSDeviceAfcService>(
162
- operation: () => Promise<{service: T; connection: RemoteXpcConnection}>,
163
- ): Promise<AfcClient | null> {
164
- let remoteXPCConnection: RemoteXpcConnection | undefined;
165
- let succeeded = false;
166
- try {
167
- const {service, connection} = await operation();
168
- remoteXPCConnection = connection;
169
- const client = new AfcClient(service, remoteXPCConnection);
170
- succeeded = true;
171
- return client;
172
- } catch (err: any) {
173
- log.error(
174
- `Failed to create AFC client via RemoteXPC: ${err.message}, falling back to appium-ios-device`,
175
- );
176
- return null;
177
- } finally {
178
- // Only close connection if we failed (if succeeded, the client owns it)
179
- if (remoteXPCConnection && !succeeded) {
180
- try {
181
- await remoteXPCConnection.close();
182
- } catch {
183
- // Ignore cleanup errors
184
- }
185
- }
186
- }
187
- }
188
-
189
170
  /**
190
171
  * Check if a path is a directory
191
172
  */
@@ -316,15 +297,10 @@ export class AfcClient {
316
297
  }
317
298
 
318
299
  /**
319
- * Close the AFC service connection and remoteXPC connection if present
300
+ * Close the AFC service connection
320
301
  */
321
302
  async close(): Promise<void> {
322
303
  this.service.close();
323
- if (this.remoteXPCConnection) {
324
- try {
325
- await this.remoteXPCConnection.close();
326
- } catch {}
327
- }
328
304
  }
329
305
 
330
306
  /**
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-xcuitest-driver",
3
- "version": "11.3.1",
3
+ "version": "11.4.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-xcuitest-driver",
9
- "version": "11.3.1",
9
+ "version": "11.4.1",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@appium/strongbox": "^1.0.0-rc.1",
@@ -65,7 +65,7 @@
65
65
  "npm": ">=10"
66
66
  },
67
67
  "optionalDependencies": {
68
- "appium-ios-remotexpc": "^1.1.8"
68
+ "appium-ios-remotexpc": "^1.1.10"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "appium": "^3.0.0-rc.2"
@@ -117,6 +117,17 @@
117
117
  "npm": ">=10"
118
118
  }
119
119
  },
120
+ "node_modules/@appium/base-driver/node_modules/axios": {
121
+ "version": "1.16.0",
122
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.0.tgz",
123
+ "integrity": "sha512-6hp5CwvTPlN2A31g5dxnwAX0orzM7pmCRDLnZSX772mv8WDqICwFjowHuPs04Mc8deIld1+ejhtaMn5vp6b+1w==",
124
+ "license": "MIT",
125
+ "dependencies": {
126
+ "follow-redirects": "^1.16.0",
127
+ "form-data": "^4.0.5",
128
+ "proxy-from-env": "^2.1.0"
129
+ }
130
+ },
120
131
  "node_modules/@appium/base-driver/node_modules/lru-cache": {
121
132
  "version": "11.3.5",
122
133
  "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.3.5.tgz",
@@ -266,6 +277,17 @@
266
277
  "npm": ">=10"
267
278
  }
268
279
  },
280
+ "node_modules/@appium/support/node_modules/axios": {
281
+ "version": "1.16.0",
282
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.0.tgz",
283
+ "integrity": "sha512-6hp5CwvTPlN2A31g5dxnwAX0orzM7pmCRDLnZSX772mv8WDqICwFjowHuPs04Mc8deIld1+ejhtaMn5vp6b+1w==",
284
+ "license": "MIT",
285
+ "dependencies": {
286
+ "follow-redirects": "^1.16.0",
287
+ "form-data": "^4.0.5",
288
+ "proxy-from-env": "^2.1.0"
289
+ }
290
+ },
269
291
  "node_modules/@appium/support/node_modules/semver": {
270
292
  "version": "7.7.4",
271
293
  "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
@@ -564,6 +586,18 @@
564
586
  "node": ">= 0.6"
565
587
  }
566
588
  },
589
+ "node_modules/agent-base": {
590
+ "version": "6.0.2",
591
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
592
+ "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
593
+ "license": "MIT",
594
+ "dependencies": {
595
+ "debug": "4"
596
+ },
597
+ "engines": {
598
+ "node": ">= 6.0.0"
599
+ }
600
+ },
567
601
  "node_modules/ansi-regex": {
568
602
  "version": "6.2.2",
569
603
  "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
@@ -608,9 +642,9 @@
608
642
  }
609
643
  },
610
644
  "node_modules/appium-ios-remotexpc": {
611
- "version": "1.1.8",
612
- "resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-1.1.8.tgz",
613
- "integrity": "sha512-62j5AqfjgPtZ+7H893z0X/6+LroncahjqvfJsFXafCzy5VLVIqL5OsrMWc1L8babedIuFFX42zHzLkPyiGt4uA==",
645
+ "version": "1.1.10",
646
+ "resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-1.1.10.tgz",
647
+ "integrity": "sha512-qkfJoVTsBkMfGg+yaGfZDj11nhg6pF4MORf9+FvBvs63l7DsFseRYLGk2Jp1pZevb8vBaKeeePsh7RuF23NaXg==",
614
648
  "license": "Apache-2.0",
615
649
  "optional": true,
616
650
  "dependencies": {
@@ -652,9 +686,9 @@
652
686
  }
653
687
  },
654
688
  "node_modules/appium-ios-tuntap": {
655
- "version": "0.2.2",
656
- "resolved": "https://registry.npmjs.org/appium-ios-tuntap/-/appium-ios-tuntap-0.2.2.tgz",
657
- "integrity": "sha512-AObU1ttH/WCW9wBCpMlyN1SbKqDMFwQkdks5rDN9N2yIn7MCoyN9il9WYa7QIJA5bE6OI1px+pv8QKs9SDTrHA==",
689
+ "version": "0.2.5",
690
+ "resolved": "https://registry.npmjs.org/appium-ios-tuntap/-/appium-ios-tuntap-0.2.5.tgz",
691
+ "integrity": "sha512-rWk2fGKlc4CWBgB/MjSiU2Ily2gj1NJ6WLUcelp0irzwGrkoebOqTD9lmxuUCCpXhYBJMGR9CPtmlJvo+zTfRQ==",
658
692
  "hasInstallScript": true,
659
693
  "license": "Apache-2.0",
660
694
  "optional": true,
@@ -876,13 +910,14 @@
876
910
  "license": "MIT"
877
911
  },
878
912
  "node_modules/axios": {
879
- "version": "1.16.0",
880
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.0.tgz",
881
- "integrity": "sha512-6hp5CwvTPlN2A31g5dxnwAX0orzM7pmCRDLnZSX772mv8WDqICwFjowHuPs04Mc8deIld1+ejhtaMn5vp6b+1w==",
913
+ "version": "1.16.1",
914
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.1.tgz",
915
+ "integrity": "sha512-caYkukvroVPO8KrzuJEb50Hm07KwfBZPEC3VeFHTsqWHvKTsy54hjJz9BS/cdaypROE2rH6xvm9mHX4fgWkr3A==",
882
916
  "license": "MIT",
883
917
  "dependencies": {
884
918
  "follow-redirects": "^1.16.0",
885
919
  "form-data": "^4.0.5",
920
+ "https-proxy-agent": "^5.0.1",
886
921
  "proxy-from-env": "^2.1.0"
887
922
  }
888
923
  },
@@ -910,9 +945,9 @@
910
945
  }
911
946
  },
912
947
  "node_modules/bare-events": {
913
- "version": "2.8.2",
914
- "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz",
915
- "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==",
948
+ "version": "2.8.3",
949
+ "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.3.tgz",
950
+ "integrity": "sha512-HdUm8EMQBLaJvGUdidNNbqpA1kYkwNcb+MYxkxCLAPJGQzlv9J0C24h8V65Z4c5GLd/JEALDvpFCQgpLJqc0zw==",
916
951
  "license": "Apache-2.0",
917
952
  "peerDependencies": {
918
953
  "bare-abort-controller": "*"
@@ -2241,6 +2276,19 @@
2241
2276
  "integrity": "sha512-RJ8XvFvpPM/Dmc5SV+dC4y5PCeOhT3x1Hq0NU3rjGeg5a/CqlhZ7uudknPwZFz4aeAXDcbAyaeP7GAo9lvngtA==",
2242
2277
  "license": "MIT"
2243
2278
  },
2279
+ "node_modules/https-proxy-agent": {
2280
+ "version": "5.0.1",
2281
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
2282
+ "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
2283
+ "license": "MIT",
2284
+ "dependencies": {
2285
+ "agent-base": "6",
2286
+ "debug": "4"
2287
+ },
2288
+ "engines": {
2289
+ "node": ">= 6"
2290
+ }
2291
+ },
2244
2292
  "node_modules/iconv-lite": {
2245
2293
  "version": "0.7.2",
2246
2294
  "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
@@ -4122,17 +4170,34 @@
4122
4170
  }
4123
4171
  },
4124
4172
  "node_modules/type-is": {
4125
- "version": "2.0.1",
4126
- "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
4127
- "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
4173
+ "version": "2.1.0",
4174
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
4175
+ "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==",
4128
4176
  "license": "MIT",
4129
4177
  "dependencies": {
4130
- "content-type": "^1.0.5",
4178
+ "content-type": "^2.0.0",
4131
4179
  "media-typer": "^1.1.0",
4132
4180
  "mime-types": "^3.0.0"
4133
4181
  },
4134
4182
  "engines": {
4135
- "node": ">= 0.6"
4183
+ "node": ">= 18"
4184
+ },
4185
+ "funding": {
4186
+ "type": "opencollective",
4187
+ "url": "https://opencollective.com/express"
4188
+ }
4189
+ },
4190
+ "node_modules/type-is/node_modules/content-type": {
4191
+ "version": "2.0.0",
4192
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
4193
+ "integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
4194
+ "license": "MIT",
4195
+ "engines": {
4196
+ "node": ">=18"
4197
+ },
4198
+ "funding": {
4199
+ "type": "opencollective",
4200
+ "url": "https://opencollective.com/express"
4136
4201
  }
4137
4202
  },
4138
4203
  "node_modules/typescript": {
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "xcuitest",
9
9
  "xctest"
10
10
  ],
11
- "version": "11.3.1",
11
+ "version": "11.4.1",
12
12
  "author": "Appium Contributors",
13
13
  "license": "Apache-2.0",
14
14
  "repository": {
@@ -36,6 +36,7 @@
36
36
  "tunnel-creation": "./scripts/tunnel-creation.mjs",
37
37
  "download-wda": "./scripts/download-wda.mjs",
38
38
  "download-wda-sim": "./scripts/download-wda-sim.mjs",
39
+ "sign-wda": "./scripts/sign-wda.mjs",
39
40
  "image-mounter": "./scripts/image-mounter.mjs",
40
41
  "list-real-devices": "./scripts/list-real-devices.mjs",
41
42
  "cleanup-videos": "./scripts/cleanup-videos.mjs",
@@ -107,7 +108,7 @@
107
108
  "ws": "^8.13.0"
108
109
  },
109
110
  "optionalDependencies": {
110
- "appium-ios-remotexpc": "^1.1.8"
111
+ "appium-ios-remotexpc": "^1.1.10"
111
112
  },
112
113
  "scripts": {
113
114
  "build": "tsc -b",
@@ -0,0 +1,412 @@
1
+ import {fs, logger} from 'appium/support.js';
2
+ import {exec} from 'teen_process';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import {pathToFileURL} from 'node:url';
6
+ import {mkdtemp, rm} from 'node:fs/promises';
7
+ import {Command} from 'commander';
8
+
9
+ const SCRIPT_NAME = 'sign-wda';
10
+ const RESIGNER_BINARY_NAME = 'resigner';
11
+ const MOBILEPROVISION_EXTENSION = '.mobileprovision';
12
+ const DEFAULT_PROFILE_DIR_CANDIDATES = [
13
+ path.join(os.homedir(), 'Library', 'Developer', 'Xcode', 'UserData', 'Provisioning Profiles'),
14
+ path.join(os.homedir(), 'Library', 'MobileDevice', 'Provisioning Profiles'),
15
+ ];
16
+ const DEFAULT_WDA_BUNDLE_IDS = [
17
+ 'com.facebook.WebDriverAgentRunner',
18
+ 'com.facebook.WebDriverAgentRunner.xctrunner',
19
+ 'com.facebook.WebDriverAgentLib',
20
+ ];
21
+
22
+ const log = logger.getLogger(SCRIPT_NAME);
23
+
24
+ class RunCmd {
25
+ /**
26
+ * Check if the resginer binary is available in the PATH.
27
+ * @returns {Promise<void>} Whether the resigner binary is available in the local environment
28
+ */
29
+ async requireResignerBinary() {
30
+ try {
31
+ await fs.which(RESIGNER_BINARY_NAME);
32
+ } catch {
33
+ throw new Error('Resigner binary is not available in the PATH.');
34
+ }
35
+ }
36
+ }
37
+
38
+
39
+ class RunInspectWDA extends RunCmd {
40
+ /**
41
+ * Run resigner inspect on the signed WDA and return the output.
42
+ * @param {InspectWDAOptions} options
43
+ * @returns {Promise<void>}
44
+ */
45
+ async inspect(options) {
46
+ if (!(await fs.exists(options.wdaPath))) {
47
+ throw new Error(`WDA path does not exist: ${options.wdaPath}`);
48
+ }
49
+ await this.requireResignerBinary();
50
+ const inspectResult = await inspectWDAWithResigner(options.wdaPath);
51
+ if (inspectResult) {
52
+ log.info(`Resigner inspect result:\n---\n${inspectResult}`);
53
+ } else {
54
+ log.info('Resigner inspect finished, but no output was returned.');
55
+ }
56
+ }
57
+ }
58
+
59
+ class RunSignWDA extends RunCmd {
60
+ /**
61
+ * Run resigner to sign the WDA.
62
+ * @param {SignWDAOptions} options
63
+ * @returns {Promise<void>}
64
+ */
65
+ async sign(options) {
66
+ if (!(await fs.exists(options.wdaPath))) {
67
+ throw new Error(`WDA path does not exist: ${options.wdaPath}`);
68
+ }
69
+ await this.requireResignerBinary();
70
+ const resolvedProfileDir = await resolveProfileDir(options.profileDir);
71
+
72
+ let p12File = options.p12File;
73
+ let tempDir;
74
+ let p12Password = options.p12Password;
75
+
76
+ try {
77
+ // If cert and key provided, convert to p12 with auto-generated password
78
+ if (options.p12Cert && options.p12Key) {
79
+ const generatedPassword = generateRandomPassword();
80
+ const result = await convertCertAndKeyToP12(options.p12Cert, options.p12Key, generatedPassword);
81
+ p12File = result.p12File;
82
+ tempDir = result.tempDir;
83
+ p12Password = generatedPassword;
84
+ }
85
+
86
+ if (!p12File) {
87
+ throw new Error('No p12 file available for signing');
88
+ }
89
+
90
+ await signWDAWithResigner(options.wdaPath, {
91
+ p12File,
92
+ p12Password,
93
+ profileDir: resolvedProfileDir,
94
+ bundleId: options.bundleId,
95
+ });
96
+ } finally {
97
+ // Clean up temp directory if it was created
98
+ if (tempDir) {
99
+ try {
100
+ await rm(tempDir, {recursive: true, force: true});
101
+ log.info(`Cleaned up temporary directory: ${tempDir}`);
102
+ } catch (err) {
103
+ log.warn(`Failed to clean up temporary directory ${tempDir}: ${err.message}`);
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Generate a random password for temporary .p12 files.
112
+ * @returns {string} A random 12-character alphanumeric password
113
+ */
114
+ function generateRandomPassword() {
115
+ const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
116
+ let password = '';
117
+ for (let i = 0; i < 12; i++) {
118
+ password += chars[Math.floor(Math.random() * chars.length)];
119
+ }
120
+ return password;
121
+ }
122
+
123
+ /**
124
+ * Convert .cer and .key files to a .p12 file.
125
+ * @param {string} certPath - Path to the .cer certificate file
126
+ * @param {string} keyPath - Path to the .key private key file
127
+ * @param {string} p12Password - Password to protect the .p12 file
128
+ * @returns {Promise<{p12File: string, tempDir: string}>} Path to the generated .p12 and temp directory
129
+ */
130
+ async function convertCertAndKeyToP12(certPath, keyPath, p12Password) {
131
+ // Validate input files exist
132
+ if (!(await fs.exists(certPath))) {
133
+ throw new Error(`Certificate file does not exist: ${certPath}`);
134
+ }
135
+ if (!(await fs.exists(keyPath))) {
136
+ throw new Error(`Private key file does not exist: ${keyPath}`);
137
+ }
138
+
139
+ try {
140
+ await fs.which('openssl');
141
+ } catch {
142
+ throw new Error('OpenSSL binary is not available in the PATH. ' +
143
+ 'It is required to convert .cer and .key files to .p12 format.');
144
+ }
145
+
146
+ // Create temp directory
147
+ const tempDir = await mkdtemp(path.join(os.tmpdir(), 'wda-sign-'));
148
+
149
+ try {
150
+ const certPem = path.join(tempDir, 'certificate.pem');
151
+ const p12File = path.join(tempDir, 'certificate.p12');
152
+
153
+ // Convert .cer to .pem
154
+ log.info(`Converting certificate from ${certPath} to PEM format`);
155
+ await exec('openssl', [
156
+ 'x509',
157
+ '-in', certPath,
158
+ '-inform', 'DER',
159
+ '-out', certPem,
160
+ ]);
161
+
162
+ // Convert to .p12
163
+ log.info(`Creating .p12 file from certificate and key`);
164
+ await exec('openssl', [
165
+ 'pkcs12',
166
+ '-export',
167
+ '-in', certPem,
168
+ '-inkey', keyPath,
169
+ '-out', p12File,
170
+ '-passout', `pass:${p12Password}`,
171
+ ]);
172
+
173
+ log.info(`Successfully created temporary .p12 file: ${p12File}`);
174
+ return {p12File, tempDir};
175
+ } catch (err) {
176
+ // Clean up temp dir on error
177
+ try {
178
+ await rm(tempDir, {recursive: true, force: true});
179
+ } catch {}
180
+ throw err;
181
+ }
182
+ }
183
+
184
+ /**
185
+ * Validate a provisioning profile directory.
186
+ * @param {string} dir
187
+ * @param {string} source
188
+ * @returns {Promise<string>}
189
+ */
190
+ async function validateProfileDir(dir, source) {
191
+ if (!(await fs.exists(dir))) {
192
+ throw new Error(`${source} provisioning profile directory does not exist: ${dir}`);
193
+ }
194
+
195
+ let entries;
196
+ try {
197
+ entries = await fs.readdir(dir);
198
+ } catch {
199
+ throw new Error(`${source} provisioning profile directory is not a readable directory: ${dir}`);
200
+ }
201
+
202
+ if (!entries.some((name) => name.toLowerCase().endsWith(MOBILEPROVISION_EXTENSION))) {
203
+ throw new Error(
204
+ `${source} provisioning profile directory does not contain any ${MOBILEPROVISION_EXTENSION} files: ${dir}`
205
+ );
206
+ }
207
+
208
+ return dir;
209
+ }
210
+
211
+ /**
212
+ * Resolve the provisioning profile directory.
213
+ * If user provided --profile-dir, validate and use it.
214
+ * Otherwise discover from known defaults in priority order.
215
+ * @param {string | undefined} profileDir
216
+ * @returns {Promise<string>}
217
+ */
218
+ async function resolveProfileDir(profileDir) {
219
+ if (profileDir) {
220
+ return await validateProfileDir(profileDir, 'Provided');
221
+ }
222
+
223
+ for (const candidate of DEFAULT_PROFILE_DIR_CANDIDATES) {
224
+ if (!(await fs.exists(candidate))) {
225
+ continue;
226
+ }
227
+ try {
228
+ await validateProfileDir(candidate, 'Discovered');
229
+ log.info(`Using discovered provisioning profile directory: ${candidate}`);
230
+ return candidate;
231
+ } catch {
232
+ continue;
233
+ }
234
+ }
235
+
236
+ throw new Error(
237
+ `No provisioning profile directory could be discovered. ` +
238
+ `Please provide --profile-dir explicitly. Checked: ${DEFAULT_PROFILE_DIR_CANDIDATES.join(', ')}`
239
+ );
240
+ }
241
+
242
+ /**
243
+ * Run resigner to sign WDA
244
+ * @param {string} wdaPath
245
+ * @param {SignOptions} options
246
+ * @returns {Promise<void>}
247
+ */
248
+ async function signWDAWithResigner(wdaPath, options) {
249
+ const args = [
250
+ '--p12-file', options.p12File,
251
+ '--profile', options.profileDir,
252
+ '--force',
253
+ ];
254
+
255
+ if (options.bundleId) {
256
+ args.push(
257
+ ...[
258
+ // To re-apply the same mapping again for past failure cases for safe.
259
+ options.bundleId,
260
+ ...DEFAULT_WDA_BUNDLE_IDS,
261
+ ].flatMap((bundleId) => [
262
+ '--bundle-id-remap',
263
+ `${bundleId}=${options.bundleId}`,
264
+ ])
265
+ );
266
+ }
267
+
268
+ args.push(wdaPath);
269
+
270
+ log.info(`Running resigner to sign ${wdaPath}`);
271
+ await exec(RESIGNER_BINARY_NAME, args, {
272
+ env: {
273
+ ...process.env,
274
+ P12_PASSWORD: options.p12Password,
275
+ },
276
+ });
277
+ log.info('WDA signed successfully');
278
+ }
279
+
280
+ /**
281
+ * Run resigner inspect on the signed WDA and return the output.
282
+ * @param {string} wdaPath
283
+ * @returns {Promise<string>}
284
+ */
285
+ async function inspectWDAWithResigner(wdaPath) {
286
+ log.info(`Inspecting signed WDA at ${wdaPath}`);
287
+ const {stdout} = await exec(RESIGNER_BINARY_NAME, ['--inspect', wdaPath]);
288
+ return String(stdout || '').trim();
289
+ }
290
+
291
+ async function main() {
292
+ const program = new Command();
293
+
294
+ program
295
+ .name('appium driver run xcuitest sign-wda')
296
+ .description('Sign a WebDriverAgentRunner app bundle with code signing certificate')
297
+ .requiredOption('--wda-path <path>', 'Path to the WebDriverAgentRunner.app bundle to sign')
298
+ .option('--inspect', 'Run resigner inspect only (no signing)')
299
+ .option('--p12-file <path>', 'Path to the .p12 signing certificate file (requires P12_PASSWORD env var; mutually exclusive with --p12-cert/--p12-key)')
300
+ .option('--p12-cert <path>', 'Path to the .cer certificate file from Apple Developer portal (auto-converted to .p12 with generated password; mutually exclusive with --p12-file; must use with --p12-key)')
301
+ .option('--p12-key <path>', 'Path to the .key private key file from Apple Developer portal (auto-converted to .p12 with generated password; mutually exclusive with --p12-file; must use with --p12-cert)')
302
+ .option('--profile-dir <path>', 'Directory containing provisioning profiles (auto-discovered if omitted)')
303
+ .option('--bundle-id <id>', 'Target bundle ID for remapping (e.g., com.example.wda)')
304
+ .addHelpText(
305
+ 'after',
306
+ `
307
+ EXAMPLES:
308
+ # Sign downloaded WDA with .p12 certificate (requires P12_PASSWORD)
309
+ P12_PASSWORD=mypassword appium driver run xcuitest sign-wda -- --wda-path ./wda-real/WebDriverAgentRunner-Runner.app \
310
+ --p12-file ~/sign.p12
311
+
312
+ # Sign WDA with .cer and .key files (auto-converted, no password needed!)
313
+ appium driver run xcuitest sign-wda -- --wda-path ./wda-real/WebDriverAgentRunner-Runner.app \
314
+ --p12-cert ~/certificate.cer \
315
+ --p12-key ~/private.key
316
+
317
+ # Sign WDA and remap bundle ID with .p12 certificate (requires P12_PASSWORD)
318
+ P12_PASSWORD=mypassword appium driver run xcuitest sign-wda -- --wda-path ./wda-real/WebDriverAgentRunner-Runner.app \
319
+ --p12-file ~/sign.p12 \
320
+ --bundle-id com.example.wda
321
+
322
+ # Sign WDA with specified provisioning profile directory (cert+key approach)
323
+ appium driver run xcuitest sign-wda -- --wda-path ./wda-real/WebDriverAgentRunner-Runner.app \
324
+ --p12-cert ~/certificate.cer \
325
+ --p12-key ~/private.key \
326
+ --profile-dir /path/to/your/provisioning/profiles
327
+
328
+ # Inspect a WDA app without signing
329
+ appium driver run xcuitest sign-wda -- --wda-path ./wda-real/WebDriverAgentRunner-Runner.app --inspect`,
330
+ )
331
+ .action(async (options) => {
332
+ if (options.inspect) {
333
+ new RunInspectWDA().inspect({
334
+ wdaPath: options.wdaPath,
335
+ });
336
+ return;
337
+ }
338
+
339
+ const p12Password = process.env.P12_PASSWORD;
340
+
341
+ // Validate that either --p12-file OR (--p12-cert AND --p12-key) is provided
342
+ const hasP12File = !!options.p12File;
343
+ const hasCertAndKey = !!(options.p12Cert && options.p12Key);
344
+
345
+ if (!hasP12File && !hasCertAndKey) {
346
+ throw new Error(
347
+ `Must provide either --p12-file or both --p12-cert and --p12-key for signing mode`
348
+ );
349
+ }
350
+
351
+ if (hasP12File && hasCertAndKey) {
352
+ throw new Error(
353
+ `Cannot provide both --p12-file and --p12-cert/--p12-key; use one approach`
354
+ );
355
+ }
356
+
357
+ if ((options.p12Cert && !options.p12Key) || (!options.p12Cert && options.p12Key)) {
358
+ throw new Error(
359
+ `Both --p12-cert and --p12-key must be provided together`
360
+ );
361
+ }
362
+
363
+ // P12_PASSWORD is only required when using --p12-file
364
+ if (hasP12File && !p12Password) {
365
+ throw new Error(
366
+ `Missing required option for signing mode: P12_PASSWORD env var (required when using --p12-file)`
367
+ );
368
+ }
369
+
370
+ await new RunSignWDA().sign({
371
+ wdaPath: options.wdaPath,
372
+ p12File: options.p12File,
373
+ p12Cert: options.p12Cert,
374
+ p12Key: options.p12Key,
375
+ p12Password: p12Password || '',
376
+ profileDir: options.profileDir,
377
+ bundleId: options.bundleId,
378
+ });
379
+ });
380
+
381
+ await program.parseAsync(process.argv);
382
+ }
383
+
384
+ const isMainModule =
385
+ Boolean(process.argv[1]) && import.meta.url === pathToFileURL(process.argv[1]).href;
386
+ if (isMainModule) {
387
+ await main();
388
+ }
389
+
390
+ /**
391
+ * @typedef {Object} SignOptions
392
+ * @property {string} p12File
393
+ * @property {string} p12Password
394
+ * @property {string} profileDir
395
+ * @property {string | undefined} [bundleId]
396
+ */
397
+
398
+ /**
399
+ * @typedef {Object} SignWDAOptions
400
+ * @property {string} wdaPath
401
+ * @property {string | undefined} [p12File]
402
+ * @property {string | undefined} [p12Cert]
403
+ * @property {string | undefined} [p12Key]
404
+ * @property {string} p12Password
405
+ * @property {string | undefined} [profileDir]
406
+ * @property {string | undefined} [bundleId]
407
+ */
408
+
409
+ /**
410
+ * @typedef {Object} InspectWDAOptions
411
+ * @property {string} wdaPath
412
+ */