appium-xcuitest-driver 9.3.1 → 9.4.0

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 (54) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/build/lib/app-infos-cache.js +2 -2
  3. package/build/lib/app-infos-cache.js.map +1 -1
  4. package/build/lib/app-utils.js +1 -1
  5. package/build/lib/app-utils.js.map +1 -1
  6. package/build/lib/commands/app-strings.d.ts.map +1 -1
  7. package/build/lib/commands/app-strings.js +3 -2
  8. package/build/lib/commands/app-strings.js.map +1 -1
  9. package/build/lib/commands/audit.d.ts +3 -3
  10. package/build/lib/commands/audit.js +3 -3
  11. package/build/lib/commands/certificate.js +1 -1
  12. package/build/lib/commands/certificate.js.map +1 -1
  13. package/build/lib/commands/file-movement.js +2 -2
  14. package/build/lib/commands/find.js +1 -1
  15. package/build/lib/commands/find.js.map +1 -1
  16. package/build/lib/commands/geolocation.d.ts +1 -1
  17. package/build/lib/commands/geolocation.js +1 -1
  18. package/build/lib/commands/gesture.d.ts +3 -3
  19. package/build/lib/commands/gesture.d.ts.map +1 -1
  20. package/build/lib/commands/gesture.js +13 -10
  21. package/build/lib/commands/gesture.js.map +1 -1
  22. package/build/lib/commands/hid-event.js +1 -1
  23. package/build/lib/commands/increase-contrast.d.ts +1 -1
  24. package/build/lib/commands/increase-contrast.js +1 -1
  25. package/build/lib/commands/localization.d.ts +1 -1
  26. package/build/lib/commands/localization.js +1 -1
  27. package/build/lib/commands/location.js +1 -1
  28. package/build/lib/commands/recordscreen.js +1 -1
  29. package/build/lib/commands/recordscreen.js.map +1 -1
  30. package/build/lib/device-log/ios-simulator-log.js +2 -2
  31. package/build/lib/device-log/ios-simulator-log.js.map +1 -1
  32. package/build/lib/driver.js +7 -7
  33. package/build/lib/driver.js.map +1 -1
  34. package/build/lib/utils.d.ts +1 -1
  35. package/build/lib/utils.js +1 -1
  36. package/lib/app-infos-cache.js +2 -2
  37. package/lib/app-utils.js +1 -1
  38. package/lib/commands/app-strings.js +3 -2
  39. package/lib/commands/audit.js +3 -3
  40. package/lib/commands/certificate.js +1 -1
  41. package/lib/commands/file-movement.js +2 -2
  42. package/lib/commands/find.js +1 -1
  43. package/lib/commands/geolocation.js +1 -1
  44. package/lib/commands/gesture.js +13 -16
  45. package/lib/commands/hid-event.ts +1 -1
  46. package/lib/commands/increase-contrast.js +1 -1
  47. package/lib/commands/localization.js +1 -1
  48. package/lib/commands/location.js +1 -1
  49. package/lib/commands/recordscreen.js +1 -1
  50. package/lib/device-log/ios-simulator-log.ts +2 -2
  51. package/lib/driver.js +7 -7
  52. package/lib/utils.js +1 -1
  53. package/npm-shrinkwrap.json +110 -271
  54. package/package.json +2 -2
@@ -107,19 +107,16 @@ const commands = {
107
107
  // This is mandatory, since WDA only supports TOUCH pointer type
108
108
  // and Selenium API uses MOUSE as the default one
109
109
  const preprocessedActions = actions
110
- .map((action) =>
111
- Object.assign(
112
- {},
113
- action,
114
- action.type === 'pointer'
115
- ? {
116
- parameters: {
117
- pointerType: 'touch',
118
- },
119
- }
120
- : {},
121
- ),
122
- )
110
+ .map((action) => ({
111
+ ...action,
112
+ ...(action.type === 'pointer'
113
+ ? {
114
+ parameters: {
115
+ pointerType: 'touch',
116
+ },
117
+ }
118
+ : {}),
119
+ }))
123
120
  .map((action) => {
124
121
  const modifiedAction = _.clone(action) || {};
125
122
  // Selenium API unexpectedly inserts zero pauses, which are not supported by WDA
@@ -170,14 +167,14 @@ const helpers = {
170
167
  *
171
168
  * Use this command to emulate precise scrolling in tables or collection views where it is already known to which element the scrolling should be performed.
172
169
  *
173
- * The arguments define the choosen strategy: one of `name`, `direction`, `predicateString` or `toVisible`.
170
+ * The arguments define the chosen strategy: one of `name`, `direction`, `predicateString` or `toVisible`.
174
171
  *
175
172
  * **All strategies are exclusive**; only one strategy can be used at one time.
176
173
  *
177
174
  * **Known Limitations:**
178
175
  *
179
176
  * - If it is necessary to perform many scroll gestures on parent container to reach the necessary child element (tens of them), then the method call may fail. *
180
- * - The implemntation of this extension relies on several undocumented XCTest features, which might not always be reliable.
177
+ * - The implementation of this extension relies on several undocumented XCTest features, which might not always be reliable.
181
178
  *
182
179
  * @param {string} [name] - The internal element identifier (as hexadecimal hash string) to scroll on (e.g. the container). The Application element will be used if this argument is not provided.
183
180
  * @param {import('./types').Direction} [direction] - The main difference between this command and a `mobile: swipe` command using the same direction is that `mobile: scroll` will attempt to move the current viewport exactly to the next or previous page (the term "page" means the content, which fits into a single device screen).
@@ -473,7 +470,7 @@ const helpers = {
473
470
  * @throws If the target device does not support the "force press" gesture.
474
471
  * @param {number} [x] - The _x_ coordinate of the gesture. If `elementId` is set, this is calculated relative to its position; otherwise it's calculated relative to the active Application.
475
472
  * @param {number} [y] - The _y_ coordinate of the gesture. If `elementId` is set, this is calculated relative to its position; otherwise it's calculated relative to the active Application.
476
- * @param {number} [duration] - The duraiton (in seconds) of the force press. If this is provided, `pressure` must also be provided.
473
+ * @param {number} [duration] - The duration (in seconds) of the force press. If this is provided, `pressure` must also be provided.
477
474
  * @param {number} [pressure] - A float value defining the pressure of the force press. If this is provided, `duration` must also be provided.
478
475
  * @param {string|Element} [elementId] - The internal element identifier (as hexadecimal hash string) to perform one or more taps.
479
476
  * The Application element will be used if this parameter is not provided.
@@ -1128,7 +1128,7 @@ export enum HIDUsagePowerDeviceEvent {
1128
1128
  /* Reserved 0x48 - 0x4F */
1129
1129
  kHIDUsage_PD_SwitchOnControl = 0x50 /* DV F- Power Device Switch On Control */,
1130
1130
  kHIDUsage_PD_SwitchOffControl = 0x51 /* DV F- Power Device Switch Off Control */,
1131
- kHIDUsage_PD_ToggleControl = 0x52 /* DV F- Power Device Toogle Sequence Control */,
1131
+ kHIDUsage_PD_ToggleControl = 0x52 /* DV F- Power Device Toggle Sequence Control */,
1132
1132
  kHIDUsage_PD_LowVoltageTransfer = 0x53 /* DV F- Power Device Min Transfer Voltage */,
1133
1133
  kHIDUsage_PD_HighVoltageTransfer = 0x54 /* DV F- Power Device Max Transfer Voltage */,
1134
1134
  kHIDUsage_PD_DelayBeforeReboot = 0x55 /* DV F- Power Device Delay Before Reboot */,
@@ -14,7 +14,7 @@ export default {
14
14
  * Sets the increase contrast configuration for the given simulator.
15
15
  *
16
16
  * @since Xcode 15 (but lower xcode could have this command)
17
- * @param {IncreaseContrastAction} increaseContrast valid increase constrast configuration value.
17
+ * @param {IncreaseContrastAction} increaseContrast valid increase contrast configuration value.
18
18
  * Acceptable value is 'enabled' or 'disabled' with Xcode 16.2.
19
19
  * @throws {Error} if the current platform does not support content size appearance changes
20
20
  * @this {XCUITestDriver}
@@ -8,7 +8,7 @@ export default {
8
8
  * Change localization settings on the currently booted simulator
9
9
  *
10
10
  * The changed settings are only applied for _newly started_ applications and activities.
11
- * Currently running applications will be unchanged. This means, for example, that the keyboard should be hidden and shown again in order to observe the changed layout, and curresponding apps must be restarted in order to observe their interface using the newly set locale/language.
11
+ * Currently running applications will be unchanged. This means, for example, that the keyboard should be hidden and shown again in order to observe the changed layout, and corresponding apps must be restarted in order to observe their interface using the newly set locale/language.
12
12
  *
13
13
  * The driver performs no strict checking of the arguments (such as locale names). Be aware that an incorrect or invalid string may cause unexpected behavior.
14
14
  * @param {import('./types').KeyboardOptions} [keyboard] - Keyboard options
@@ -118,7 +118,7 @@ export default {
118
118
  } catch (err) {
119
119
  throw this.log.errorWithException(
120
120
  `Failed to reset the location on the device on device '${this.opts.udid}'. ` +
121
- `Origianl error: ${err.message}`,
121
+ `Original error: ${err.message}`,
122
122
  );
123
123
  } finally {
124
124
  service.close();
@@ -138,7 +138,7 @@ export class ScreenRecorder {
138
138
  this.timeoutHandler = null;
139
139
  }
140
140
 
141
- if (this.mainProcess && this.mainProcess.isRunning) {
141
+ if (this.mainProcess?.isRunning) {
142
142
  const interruptPromise = this.mainProcess.stop(force ? 'SIGTERM' : 'SIGINT');
143
143
  this.mainProcess = null;
144
144
  try {
@@ -71,7 +71,7 @@ export class IOSSimulatorLog extends LineConsumingLog {
71
71
  }
72
72
 
73
73
  override get isCapturing(): boolean {
74
- return Boolean(this.proc && this.proc.isRunning);
74
+ return Boolean(this.proc?.isRunning);
75
75
  }
76
76
 
77
77
  private onOutput(logRow: string, prefix: string = ''): void {
@@ -131,7 +131,7 @@ export class IOSSimulatorLog extends LineConsumingLog {
131
131
  await exec('kill', pids.map(String));
132
132
  } catch (e) {
133
133
  this.log.warn(
134
- `Cound not terminate one or more obsolete log streams: ${e.stderr || e.message}`
134
+ `Could not terminate one or more obsolete log streams: ${e.stderr || e.message}`
135
135
  );
136
136
  }
137
137
  }
package/lib/driver.js CHANGED
@@ -429,7 +429,7 @@ export class XCUITestDriver extends BaseDriver {
429
429
  await this.start();
430
430
 
431
431
  // merge server capabilities + desired capabilities
432
- caps = Object.assign({}, defaultServerCaps, caps);
432
+ caps = { ...defaultServerCaps, ...caps };
433
433
  // update the udid with what is actually used
434
434
  caps.udid = this.opts.udid;
435
435
  // ensure we track nativeWebTap capability as a setting as well
@@ -1025,8 +1025,8 @@ export class XCUITestDriver extends BaseDriver {
1025
1025
  await simulatorDevice.delete();
1026
1026
  }
1027
1027
 
1028
- const shouldResetLocationServivce = this.isRealDevice() && !!this.opts.resetLocationService;
1029
- if (shouldResetLocationServivce) {
1028
+ const shouldResetLocationService = this.isRealDevice() && !!this.opts.resetLocationService;
1029
+ if (shouldResetLocationService) {
1030
1030
  try {
1031
1031
  await this.mobileResetLocationService();
1032
1032
  } catch {
@@ -1055,7 +1055,7 @@ export class XCUITestDriver extends BaseDriver {
1055
1055
  this.jwpProxyActive = false;
1056
1056
  this.proxyReqRes = null;
1057
1057
 
1058
- if (this.wda && this.wda.fullyStarted) {
1058
+ if (this.wda?.fullyStarted) {
1059
1059
  if (this.wda.jwproxy) {
1060
1060
  try {
1061
1061
  await this.proxyCommand(`/session/${this.sessionId}`, 'DELETE');
@@ -1065,7 +1065,7 @@ export class XCUITestDriver extends BaseDriver {
1065
1065
  }
1066
1066
  }
1067
1067
  // The former could cache the xcodebuild, so should not quit the process.
1068
- // If the session skiped the xcodebuild (this.wda.canSkipXcodebuild), the this.wda instance
1068
+ // If the session skipped the xcodebuild (this.wda.canSkipXcodebuild), the this.wda instance
1069
1069
  // should quit properly.
1070
1070
  if ((!this.wda.webDriverAgentUrl && this.opts.useNewWDA) || this.wda.canSkipXcodebuild) {
1071
1071
  await this.wda.quit();
@@ -1666,7 +1666,7 @@ export class XCUITestDriver extends BaseDriver {
1666
1666
  } catch (e) {
1667
1667
  throw this.log.errorWithException(`Could not parse "otherApps" capability: ${e.message}`);
1668
1668
  }
1669
- if (!appsList || !appsList.length) {
1669
+ if (!appsList?.length) {
1670
1670
  this.log.info(`Got zero apps from 'otherApps' capability value. Doing nothing`);
1671
1671
  return;
1672
1672
  }
@@ -1764,7 +1764,7 @@ export class XCUITestDriver extends BaseDriver {
1764
1764
  );
1765
1765
 
1766
1766
  // Note: The CFBundleVersion in the test bundle was always 1.
1767
- // It may not be able to compare with the installed versio.
1767
+ // It may not be able to compare with the installed version.
1768
1768
  if (this.isRealDevice()) {
1769
1769
  await installToRealDevice.bind(this)(
1770
1770
  this.opts.prebuiltWDAPath,
package/lib/utils.js CHANGED
@@ -402,7 +402,7 @@ async function encodeBase64OrUpload(localPath, remotePath = null, uploadOptions
402
402
 
403
403
  /**
404
404
  * Stops and removes all web socket handlers that are listening
405
- * in scope of the currect session.
405
+ * in scope of the current session.
406
406
  *
407
407
  * @param {Object} server - The instance of NodeJs HTTP server,
408
408
  * which hosts Appium