appium-mac2-driver 4.0.4 → 4.0.6

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 (78) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/commands/app-management.d.ts +1 -1
  3. package/build/lib/commands/app-management.d.ts.map +1 -1
  4. package/build/lib/commands/app-management.js.map +1 -1
  5. package/build/lib/commands/applescript.d.ts.map +1 -1
  6. package/build/lib/commands/applescript.js +1 -1
  7. package/build/lib/commands/applescript.js.map +1 -1
  8. package/build/lib/commands/bidi/models.d.ts.map +1 -1
  9. package/build/lib/commands/bidi/models.js.map +1 -1
  10. package/build/lib/commands/clipboard.d.ts.map +1 -1
  11. package/build/lib/commands/clipboard.js.map +1 -1
  12. package/build/lib/commands/execute.d.ts +1 -1
  13. package/build/lib/commands/execute.d.ts.map +1 -1
  14. package/build/lib/commands/execute.js.map +1 -1
  15. package/build/lib/commands/find.d.ts.map +1 -1
  16. package/build/lib/commands/find.js.map +1 -1
  17. package/build/lib/commands/gestures.d.ts.map +1 -1
  18. package/build/lib/commands/gestures.js +5 -13
  19. package/build/lib/commands/gestures.js.map +1 -1
  20. package/build/lib/commands/helpers.d.ts +1 -1
  21. package/build/lib/commands/helpers.d.ts.map +1 -1
  22. package/build/lib/commands/helpers.js.map +1 -1
  23. package/build/lib/commands/native-record-screen.d.ts +2 -2
  24. package/build/lib/commands/native-record-screen.d.ts.map +1 -1
  25. package/build/lib/commands/native-record-screen.js +4 -5
  26. package/build/lib/commands/native-record-screen.js.map +1 -1
  27. package/build/lib/commands/navigation.d.ts.map +1 -1
  28. package/build/lib/commands/navigation.js.map +1 -1
  29. package/build/lib/commands/record-screen.d.ts +1 -1
  30. package/build/lib/commands/record-screen.d.ts.map +1 -1
  31. package/build/lib/commands/record-screen.js +2 -2
  32. package/build/lib/commands/record-screen.js.map +1 -1
  33. package/build/lib/commands/screenshots.d.ts.map +1 -1
  34. package/build/lib/commands/screenshots.js.map +1 -1
  35. package/build/lib/commands/source.d.ts.map +1 -1
  36. package/build/lib/commands/source.js.map +1 -1
  37. package/build/lib/doctor/optional-checks.d.ts.map +1 -1
  38. package/build/lib/doctor/optional-checks.js +2 -2
  39. package/build/lib/doctor/optional-checks.js.map +1 -1
  40. package/build/lib/doctor/required-checks.d.ts.map +1 -1
  41. package/build/lib/doctor/required-checks.js +1 -1
  42. package/build/lib/doctor/required-checks.js.map +1 -1
  43. package/build/lib/driver.d.ts +5 -5
  44. package/build/lib/driver.d.ts.map +1 -1
  45. package/build/lib/driver.js +9 -10
  46. package/build/lib/driver.js.map +1 -1
  47. package/build/lib/execute-method-map.d.ts.map +1 -1
  48. package/build/lib/execute-method-map.js +4 -37
  49. package/build/lib/execute-method-map.js.map +1 -1
  50. package/build/lib/utils.d.ts.map +1 -1
  51. package/build/lib/utils.js +2 -2
  52. package/build/lib/utils.js.map +1 -1
  53. package/build/lib/wda-mac.d.ts +1 -1
  54. package/build/lib/wda-mac.d.ts.map +1 -1
  55. package/build/lib/wda-mac.js +8 -12
  56. package/build/lib/wda-mac.js.map +1 -1
  57. package/lib/commands/app-management.ts +5 -16
  58. package/lib/commands/applescript.ts +3 -1
  59. package/lib/commands/bidi/models.ts +2 -5
  60. package/lib/commands/clipboard.ts +1 -4
  61. package/lib/commands/execute.ts +3 -6
  62. package/lib/commands/find.ts +1 -0
  63. package/lib/commands/gestures.ts +10 -44
  64. package/lib/commands/helpers.ts +3 -4
  65. package/lib/commands/native-record-screen.ts +15 -28
  66. package/lib/commands/navigation.ts +1 -5
  67. package/lib/commands/record-screen.ts +10 -30
  68. package/lib/commands/screenshots.ts +1 -4
  69. package/lib/commands/source.ts +1 -4
  70. package/lib/doctor/optional-checks.ts +10 -19
  71. package/lib/doctor/required-checks.ts +3 -5
  72. package/lib/driver.ts +12 -21
  73. package/lib/execute-method-map.ts +4 -37
  74. package/lib/utils.ts +3 -2
  75. package/lib/wda-mac.ts +19 -31
  76. package/npm-shrinkwrap.json +169 -198
  77. package/package.json +66 -77
  78. package/scripts/open-wda.mjs +2 -1
package/lib/wda-mac.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import path from 'node:path';
2
- import url from 'node:url';
3
- import axios from 'axios';
4
2
  import {setTimeout as delay} from 'node:timers/promises';
3
+ import url from 'node:url';
4
+
5
+ import {strongbox} from '@appium/strongbox';
6
+ import type {HTTPMethod, HTTPBody, ProxyResponse, ProxyOptions} from '@appium/types';
5
7
  import {JWProxy, errors} from 'appium/driver.js';
6
8
  import {fs, logger, util, timing} from 'appium/support.js';
7
- import {strongbox} from '@appium/strongbox';
8
- import {SubProcess, exec} from 'teen_process';
9
9
  import {waitForCondition} from 'asyncbox';
10
+ import axios from 'axios';
10
11
  import {checkPortStatus} from 'portscanner';
11
- import type {HTTPMethod, HTTPBody, ProxyResponse, ProxyOptions} from '@appium/types';
12
+ import {SubProcess, exec} from 'teen_process';
13
+
12
14
  import {listChildrenProcessIds, getModuleRoot, clearArray, removeAllOccurrences} from './utils.js';
13
15
 
14
16
  const log = logger.getLogger('WebDriverAgentMac');
@@ -51,9 +53,10 @@ class WDAMacProcess {
51
53
  }
52
54
 
53
55
  async cleanupProjectIfFresh(): Promise<void> {
54
- const packageInfo = JSON.parse(
55
- await fs.readFile(path.join(getModuleRoot(), 'package.json'), 'utf8'),
56
- ) as {name: string; version: string};
56
+ const packageInfo = JSON.parse(await fs.readFile(path.join(getModuleRoot(), 'package.json'), 'utf8')) as {
57
+ name: string;
58
+ version: string;
59
+ };
57
60
  const box = strongbox(packageInfo.name);
58
61
  let boxItem = box.getItem(RECENT_MODULE_VERSION_ITEM_NAME);
59
62
  if (!boxItem) {
@@ -69,9 +72,7 @@ class WDAMacProcess {
69
72
  return;
70
73
  }
71
74
  } else {
72
- log.info(
73
- 'There is no need to perform the project cleanup. A fresh install has been detected',
74
- );
75
+ log.info('There is no need to perform the project cleanup. A fresh install has been detected');
75
76
  try {
76
77
  await box.createItemWithValue(RECENT_MODULE_VERSION_ITEM_NAME, packageInfo.version);
77
78
  } catch (e: any) {
@@ -86,9 +87,7 @@ class WDAMacProcess {
86
87
  recentModuleVersion = util.coerceVersion(recentModuleVersion, true);
87
88
  } catch (e: any) {
88
89
  log.warn(`The persisted module version string has been damaged: ${e.message}`);
89
- log.info(
90
- `Updating it to '${packageInfo.version}' assuming the project cleanup is not needed`,
91
- );
90
+ log.info(`Updating it to '${packageInfo.version}' assuming the project cleanup is not needed`);
92
91
  await boxItem.write(packageInfo.version);
93
92
  return;
94
93
  }
@@ -137,8 +136,7 @@ class WDAMacProcess {
137
136
  xcodebuild = await fs.which(XCODEBUILD);
138
137
  } catch {
139
138
  throw new Error(
140
- `${XCODEBUILD} binary cannot be found in PATH. ` +
141
- `Please make sure that Xcode is installed on your system`,
139
+ `${XCODEBUILD} binary cannot be found in PATH. Please make sure that Xcode is installed on your system`,
142
140
  );
143
141
  }
144
142
  log.debug(`Using ${XCODEBUILD} binary at '${xcodebuild}'`);
@@ -147,8 +145,7 @@ class WDAMacProcess {
147
145
 
148
146
  log.debug(`Using ${this.host} as server host`);
149
147
  log.debug(`Using port ${this.port}`);
150
- const isPortBusy = async (): Promise<boolean> =>
151
- (await checkPortStatus(this.port, this.host)) === 'open';
148
+ const isPortBusy = async (): Promise<boolean> => (await checkPortStatus(this.port, this.host)) === 'open';
152
149
  if (await isPortBusy()) {
153
150
  log.warn(
154
151
  `The port #${this.port} at ${this.host} is busy. ` +
@@ -256,16 +253,10 @@ class WDAMacProcess {
256
253
  ) {
257
254
  return false;
258
255
  }
259
- if (
260
- (systemPort && this.port !== systemPort) ||
261
- (!systemPort && this.port !== DEFAULT_SYSTEM_PORT)
262
- ) {
256
+ if ((systemPort && this.port !== systemPort) || (!systemPort && this.port !== DEFAULT_SYSTEM_PORT)) {
263
257
  return false;
264
258
  }
265
- if (
266
- (systemHost && this.host !== systemHost) ||
267
- (!systemHost && this.host !== DEFAULT_SYSTEM_HOST)
268
- ) {
259
+ if ((systemHost && this.host !== systemHost) || (!systemHost && this.host !== DEFAULT_SYSTEM_HOST)) {
269
260
  return false;
270
261
  }
271
262
  if (
@@ -385,9 +376,7 @@ export class WDAMacServer {
385
376
  removeAllOccurrences(RUNNING_PROCESS_IDS, pid);
386
377
  });
387
378
  }
388
- log.info(
389
- `The host process is ready within ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`,
390
- );
379
+ log.info(`The host process is ready within ${timer.getDuration().asMilliSeconds.toFixed(0)}ms`);
391
380
  }
392
381
  } else {
393
382
  log.info('The host process has already been listening. Proceeding with session creation');
@@ -455,8 +444,7 @@ export class WDAMacServer {
455
444
  parsedUrl = new url.URL(caps.webDriverAgentMacUrl);
456
445
  } catch (e: any) {
457
446
  throw new Error(
458
- `webDriverAgentMacUrl, '${caps.webDriverAgentMacUrl}', ` +
459
- `in the capabilities is invalid. ${e.message}`,
447
+ `webDriverAgentMacUrl, '${caps.webDriverAgentMacUrl}', in the capabilities is invalid. ${e.message}`,
460
448
  {cause: e},
461
449
  );
462
450
  }