appium-xcuitest-driver 11.14.0 → 11.14.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,9 @@
1
+ ## [11.14.1](https://github.com/appium/appium-xcuitest-driver/compare/v11.14.0...v11.14.1) (2026-06-24)
2
+
3
+ ### Bug Fixes
4
+
5
+ * Only assert root after arguments parsing is finished ([#2886](https://github.com/appium/appium-xcuitest-driver/issues/2886)) ([6d9f317](https://github.com/appium/appium-xcuitest-driver/commit/6d9f317e8864d7161404a15c8a841e1b95815f26))
6
+
1
7
  ## [11.14.0](https://github.com/appium/appium-xcuitest-driver/compare/v11.13.0...v11.14.0) (2026-06-23)
2
8
 
3
9
  ### Features
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-xcuitest-driver",
3
- "version": "11.14.0",
3
+ "version": "11.14.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-xcuitest-driver",
9
- "version": "11.14.0",
9
+ "version": "11.14.1",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@appium/css-locator-to-native": "^1.0.1",
@@ -549,9 +549,9 @@
549
549
  }
550
550
  },
551
551
  "node_modules/appium-ios-remotexpc": {
552
- "version": "5.2.0",
553
- "resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-5.2.0.tgz",
554
- "integrity": "sha512-6E1hkewEeGvurAUnfRNm8e0ten2bA0y7uqdyp6MyL+Oz9Ts+Ym4MBfbzF8qIqL5aO01AiBfOEmR/SonhWkirTQ==",
552
+ "version": "5.2.2",
553
+ "resolved": "https://registry.npmjs.org/appium-ios-remotexpc/-/appium-ios-remotexpc-5.2.2.tgz",
554
+ "integrity": "sha512-WSAL/BCzD380vk28g2Ec7EFmiRmqvSn76Nx5nWVipuwGD+9M0gTrqWXi9T7yc4DbJYNYA9ZQN1uSzDMHiINHWA==",
555
555
  "license": "Apache-2.0",
556
556
  "optional": true,
557
557
  "dependencies": {
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "xcuitest",
9
9
  "xctest"
10
10
  ],
11
- "version": "11.14.0",
11
+ "version": "11.14.1",
12
12
  "author": "Appium Contributors",
13
13
  "license": "Apache-2.0",
14
14
  "repository": {
@@ -1,15 +1,37 @@
1
+ import { exec } from 'teen_process';
2
+
3
+ const COMMAND_PREFIX = 'appium driver run xcuitest';
4
+
1
5
  /**
2
- * Ensures a driver helper script is run with elevated privileges on platforms that expose getuid.
6
+ * Ensures a helper script is run with elevated privileges.
3
7
  *
4
8
  * @param {string} scriptName
5
9
  */
6
- export function assertRoot(scriptName) {
10
+ export async function assertRoot(scriptName) {
11
+ if (process.platform === 'win32') {
12
+ await assertWindowsAdmin(scriptName);
13
+ return;
14
+ }
15
+
7
16
  if (typeof process.getuid !== 'function') {
8
17
  return;
9
18
  }
10
19
  if (process.getuid() !== 0) {
11
20
  throw new Error(
12
- `This script must be run as root (e.g. sudo appium driver run xcuitest ${scriptName} ...).`,
21
+ `This script must be run as root/admin (e.g. sudo ${COMMAND_PREFIX} "${scriptName}").`
22
+ );
23
+ }
24
+ }
25
+
26
+ /**
27
+ * @param {string} scriptName
28
+ */
29
+ async function assertWindowsAdmin(scriptName) {
30
+ try {
31
+ await exec('net', ['session']);
32
+ } catch {
33
+ throw new Error(
34
+ `This script must be run as Administrator (e.g. from an elevated terminal: ${COMMAND_PREFIX} "${scriptName}").`,
13
35
  );
14
36
  }
15
37
  }
@@ -23,7 +23,8 @@
23
23
  import {logger} from 'appium/support.js';
24
24
  import {Command} from 'commander';
25
25
  import {AppleTVPairingService, UserInputService} from 'appium-ios-remotexpc';
26
-
26
+ import path from 'node:path';
27
+ import {fileURLToPath} from 'node:url';
27
28
  import {parsePositiveIntegerOption} from './lib/options.mjs';
28
29
  import {startTimeoutProgressLogger} from './lib/progress.mjs';
29
30
  import {assertRoot} from './lib/root.mjs';
@@ -35,7 +36,6 @@ const DEFAULT_APPLETV_PAIRING_DISCOVERY_TIMEOUT_MS =
35
36
  const APPLETV_PAIRING_DISCOVERY_PROGRESS_BAR_WIDTH = 24;
36
37
 
37
38
  async function main() {
38
- assertRoot('pair-appletv');
39
39
  const program = new Command();
40
40
  program
41
41
  .name('appium driver run xcuitest pair-appletv')
@@ -54,6 +54,8 @@ async function main() {
54
54
  program.parse(process.argv);
55
55
  const options = program.opts();
56
56
 
57
+ await assertRoot(path.parse(fileURLToPath(import.meta.url)).name);
58
+
57
59
  const userInput = new UserInputService();
58
60
  const pairingService = new AppleTVPairingService(userInput);
59
61
 
@@ -6,6 +6,8 @@
6
6
  * Must be run as root (e.g. sudo appium driver run xcuitest tunnel-creation).
7
7
  */
8
8
  import {logger} from 'appium/support.js';
9
+ import path from 'node:path';
10
+ import {fileURLToPath} from 'node:url';
9
11
 
10
12
  import {
11
13
  AppleTVTunnelService,
@@ -886,7 +888,6 @@ function setupCleanupHandlers(tunnelCreator) {
886
888
  }
887
889
 
888
890
  async function main() {
889
- assertRoot('tunnel-creation');
890
891
  const program = new Command();
891
892
  program
892
893
  .name('appium driver run xcuitest tunnel-creation')
@@ -937,6 +938,8 @@ async function main() {
937
938
  const shouldRunUsbFlow = !hasRequestedAppleTVIds || hasRequestedUdids;
938
939
  const shouldRunAppleTVFlow = !hasRequestedUdids || hasRequestedAppleTVIds;
939
940
 
941
+ await assertRoot(path.parse(fileURLToPath(import.meta.url)).name);
942
+
940
943
  const tunnelCreator = new TunnelCreator({
941
944
  appleTVDiscoveryTimeoutMs: options.appletvDiscoveryTimeoutMs,
942
945
  });