appium-xcuitest-driver 9.8.1 → 9.9.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [9.9.0](https://github.com/appium/appium-xcuitest-driver/compare/v9.8.1...v9.9.0) (2025-06-26)
2
+
3
+ ### Features
4
+
5
+ * add download-wda-sim to download prebuilt WDA for Sim ([#2587](https://github.com/appium/appium-xcuitest-driver/issues/2587)) ([c1fb5a4](https://github.com/appium/appium-xcuitest-driver/commit/c1fb5a4df52cc8d8816c0a362916570d8236275d))
6
+
1
7
  ## [9.8.1](https://github.com/appium/appium-xcuitest-driver/compare/v9.8.0...v9.8.1) (2025-06-25)
2
8
 
3
9
  ### Miscellaneous Chores
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appium-xcuitest-driver",
3
- "version": "9.8.1",
3
+ "version": "9.9.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "appium-xcuitest-driver",
9
- "version": "9.8.1",
9
+ "version": "9.9.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@appium/strongbox": "^0.x",
@@ -480,9 +480,9 @@
480
480
  "license": "MIT"
481
481
  },
482
482
  "node_modules/@types/lodash": {
483
- "version": "4.17.18",
484
- "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.18.tgz",
485
- "integrity": "sha512-KJ65INaxqxmU6EoCiJmRPZC9H9RVWCRd349tXM2M3O5NA7cY6YL7c0bHAHQ93NOfTObEQ004kd2QVHs/r0+m4g==",
483
+ "version": "4.17.19",
484
+ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.19.tgz",
485
+ "integrity": "sha512-NYqRyg/hIQrYPT9lbOeYc3kIRabJDn/k4qQHIXUpx88CBDww2fD15Sg5kbXlW86zm2XEW4g0QxkTI3/Kfkc7xQ==",
486
486
  "license": "MIT"
487
487
  },
488
488
  "node_modules/@types/node": {
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "xcuitest",
9
9
  "xctest"
10
10
  ],
11
- "version": "9.8.1",
11
+ "version": "9.9.0",
12
12
  "author": "Appium Contributors",
13
13
  "license": "Apache-2.0",
14
14
  "repository": {
@@ -33,7 +33,8 @@
33
33
  "scripts": {
34
34
  "build-wda": "./scripts/build-wda.js",
35
35
  "open-wda": "./scripts/open-wda.js",
36
- "tunnel-creation": "./scripts/tunnel-creation.mjs"
36
+ "tunnel-creation": "./scripts/tunnel-creation.mjs",
37
+ "download-wda-sim": "./scripts/download-wda-sim.mjs"
37
38
  },
38
39
  "schema": {
39
40
  "$schema": "http://json-schema.org/draft-07/schema",
@@ -3,20 +3,10 @@ const xcode = require('appium-xcode');
3
3
  const {Simctl} = require('node-simctl');
4
4
  const {getSimulator} = require('appium-ios-simulator');
5
5
  const {logger} = require('appium/support');
6
+ const {parseArgValue} = require('./utils');
6
7
 
7
8
  const log = logger.getLogger('WDA');
8
9
 
9
- function parseArgValue(argName) {
10
- const argNamePattern = new RegExp(`^--${argName}\\b`);
11
- for (let i = 1; i < process.argv.length; ++i) {
12
- const arg = process.argv[i];
13
- if (argNamePattern.test(arg)) {
14
- return arg.includes('=') ? arg.split('=')[1] : process.argv[i + 1];
15
- }
16
- }
17
- return null;
18
- }
19
-
20
10
  async function build() {
21
11
  const customDevice = parseArgValue('name');
22
12
  const xcodeVersion = await xcode.getVersion(true);
@@ -0,0 +1,68 @@
1
+ import {fs, logger, zip, net, node} from 'appium/support.js';
2
+ import _ from 'lodash';
3
+ import os from 'os';
4
+ import path from 'path';
5
+ import {parseArgValue} from './utils.js';
6
+
7
+ const log = logger.getLogger('download-wda-sim');
8
+ const wdaUrl = (version, zipFileName) =>
9
+ `https://github.com/appium/WebDriverAgent/releases/download/v${version}/${zipFileName}`;
10
+ const destZip = (platform) => {
11
+ const scheme = `WebDriverAgentRunner${_.toLower(platform) === 'tvos' ? '_tvOS' : ''}`;
12
+ return `${scheme}-Build-Sim-${os.arch() === 'arm64' ? 'arm64' : 'x86_64'}.zip`;
13
+ };
14
+
15
+ /**
16
+ * Return installed appium-webdriveragent package version
17
+ * @returns {number}
18
+ */
19
+ async function webdriveragentPkgVersion() {
20
+ const pkgPath = path.join(
21
+ node.getModuleRootSync('appium-xcuitest-driver', import.meta.url),
22
+ 'node_modules',
23
+ 'appium-webdriveragent',
24
+ 'package.json'
25
+ );
26
+ return JSON.parse(await fs.readFile(pkgPath, 'utf8')).version;
27
+ };
28
+
29
+ /**
30
+ * Prepare the working root directory.
31
+ * @returns {string} Root directory to download and unzip.
32
+ */
33
+ async function prepareRootDir() {
34
+ const destDirRoot = parseArgValue('outdir');
35
+ if (!destDirRoot) {
36
+ throw new Error(`--outdir is required`);
37
+ }
38
+ const destDir = path.resolve(process.cwd(), destDirRoot);
39
+ if (await fs.exists(destDir)) {
40
+ throw new Error(`${destDir} already exists`);
41
+ }
42
+ await fs.mkdir(destDir, {recursive: true});
43
+ return destDir;
44
+ }
45
+
46
+ async function getWDAPrebuiltPackage() {
47
+ const destDir = await prepareRootDir();
48
+ const platform = parseArgValue('platform');
49
+ const zipFileName = destZip(platform);
50
+ const wdaVersion = await webdriveragentPkgVersion();
51
+ const urlToDownload = wdaUrl(wdaVersion, zipFileName);
52
+ const downloadedZipFile = path.join(destDir, zipFileName);
53
+ try {
54
+ log.info(`Downloading ${urlToDownload}`);
55
+ await net.downloadFile(urlToDownload, downloadedZipFile);
56
+
57
+ log.info(`Unpacking ${downloadedZipFile} into ${destDir}`);
58
+ await zip.extractAllTo(downloadedZipFile, destDir);
59
+
60
+ log.info(`Deleting ${downloadedZipFile}`);
61
+ } finally {
62
+ if (await fs.exists(downloadedZipFile)) {
63
+ await fs.unlink(downloadedZipFile);
64
+ }
65
+ }
66
+ }
67
+
68
+ (async () => await getWDAPrebuiltPackage())();
@@ -3,7 +3,7 @@
3
3
  * Test script for creating lockdown service, starting CoreDeviceProxy, and creating tunnel
4
4
  * This script demonstrates the tunnel creation workflow for all connected devices
5
5
  */
6
- import {logger, node} from '@appium/support';
6
+ import {logger, node} from 'appium/support.js';
7
7
  import _ from 'lodash';
8
8
  /* eslint-disable import/no-unresolved */
9
9
  import {
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Get the value of the given argument name.
3
+ *
4
+ * @param {string} argName
5
+ * @returns {string?} The value of the given 'argName'.
6
+ */
7
+ export function parseArgValue(argName) {
8
+ const argNamePattern = new RegExp(`^--${argName}\\b`);
9
+ for (let i = 1; i < process.argv.length; ++i) {
10
+ const arg = process.argv[i];
11
+ if (argNamePattern.test(arg)) {
12
+ return arg.includes('=') ? arg.split('=')[1] : process.argv[i + 1];
13
+ }
14
+ }
15
+ return null;
16
+ }