appium-chromedriver 9.0.0 → 9.0.2

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 (47) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/chromedriver.d.ts +5 -5
  3. package/build/lib/chromedriver.d.ts.map +1 -1
  4. package/build/lib/chromedriver.js +5 -5
  5. package/build/lib/chromedriver.js.map +1 -1
  6. package/build/lib/commands/binary.d.ts.map +1 -1
  7. package/build/lib/commands/binary.js +5 -8
  8. package/build/lib/commands/binary.js.map +1 -1
  9. package/build/lib/commands/process.d.ts.map +1 -1
  10. package/build/lib/commands/process.js +1 -6
  11. package/build/lib/commands/process.js.map +1 -1
  12. package/build/lib/commands/session.d.ts.map +1 -1
  13. package/build/lib/commands/session.js +3 -4
  14. package/build/lib/commands/session.js.map +1 -1
  15. package/build/lib/commands/types.d.ts +4 -4
  16. package/build/lib/commands/types.d.ts.map +1 -1
  17. package/build/lib/commands/version.d.ts.map +1 -1
  18. package/build/lib/commands/version.js.map +1 -1
  19. package/build/lib/constants.d.ts.map +1 -1
  20. package/build/lib/constants.js +1 -3
  21. package/build/lib/constants.js.map +1 -1
  22. package/build/lib/storage-client/chromelabs.d.ts.map +1 -1
  23. package/build/lib/storage-client/chromelabs.js +7 -4
  24. package/build/lib/storage-client/chromelabs.js.map +1 -1
  25. package/build/lib/storage-client/googleapis.d.ts.map +1 -1
  26. package/build/lib/storage-client/googleapis.js +7 -10
  27. package/build/lib/storage-client/googleapis.js.map +1 -1
  28. package/build/lib/storage-client/storage-client.d.ts.map +1 -1
  29. package/build/lib/storage-client/storage-client.js +8 -10
  30. package/build/lib/storage-client/storage-client.js.map +1 -1
  31. package/build/lib/utils.d.ts +1 -1
  32. package/build/lib/utils.d.ts.map +1 -1
  33. package/build/lib/utils.js +6 -8
  34. package/build/lib/utils.js.map +1 -1
  35. package/config/mapping.json +1 -1
  36. package/lib/chromedriver.ts +13 -24
  37. package/lib/commands/binary.ts +19 -56
  38. package/lib/commands/process.ts +2 -6
  39. package/lib/commands/session.ts +7 -16
  40. package/lib/commands/types.ts +6 -4
  41. package/lib/commands/version.ts +4 -9
  42. package/lib/constants.ts +1 -3
  43. package/lib/storage-client/chromelabs.ts +11 -16
  44. package/lib/storage-client/googleapis.ts +11 -26
  45. package/lib/storage-client/storage-client.ts +17 -50
  46. package/lib/utils.ts +11 -16
  47. package/package.json +30 -40
@@ -1,29 +1,15 @@
1
- import {getChromedriverDir, retrieveData, getOsInfo, convertToInt, getCpuType} from '../utils.js';
2
1
  import path from 'node:path';
3
- import {asyncmap} from 'asyncbox';
2
+
4
3
  import {system, fs, logger, tempDir, zip, util, net} from '@appium/support';
5
- import {
6
- STORAGE_REQ_TIMEOUT_MS,
7
- GOOGLEAPIS_CDN,
8
- USER_AGENT,
9
- CHROMELABS_URL,
10
- ARCH,
11
- OS,
12
- CPU,
13
- } from '../constants.js';
14
- import {parseGoogleapiStorageXml} from './googleapis.js';
15
- import {
16
- parseKnownGoodVersionsWithDownloadsJson,
17
- parseLatestKnownGoodVersionsJson,
18
- } from './chromelabs.js';
4
+ import {asyncmap} from 'asyncbox';
19
5
  import {compareVersions} from 'compare-versions';
20
6
  import * as semver from 'semver';
21
- import type {
22
- ChromedriverStorageClientOpts,
23
- SyncOptions,
24
- OSInfo,
25
- ChromedriverDetailsMapping,
26
- } from '../types.js';
7
+
8
+ import {STORAGE_REQ_TIMEOUT_MS, GOOGLEAPIS_CDN, USER_AGENT, CHROMELABS_URL, ARCH, OS, CPU} from '../constants.js';
9
+ import type {ChromedriverStorageClientOpts, SyncOptions, OSInfo, ChromedriverDetailsMapping} from '../types.js';
10
+ import {getChromedriverDir, retrieveData, getOsInfo, convertToInt, getCpuType} from '../utils.js';
11
+ import {parseKnownGoodVersionsWithDownloadsJson, parseLatestKnownGoodVersionsJson} from './chromelabs.js';
12
+ import {parseGoogleapiStorageXml} from './googleapis.js';
27
13
 
28
14
  const MAX_PARALLEL_DOWNLOADS = 5;
29
15
 
@@ -68,10 +54,7 @@ export class ChromedriverStorageClient {
68
54
  * @returns Promise<ChromedriverDetailsMapping>
69
55
  */
70
56
  async retrieveMapping(shouldParseNotes = true): Promise<ChromedriverDetailsMapping> {
71
- const retrieveResponseSafely = async ({
72
- url,
73
- accept,
74
- }: StorageInfo): Promise<string | undefined> => {
57
+ const retrieveResponseSafely = async ({url, accept}: StorageInfo): Promise<string | undefined> => {
75
58
  try {
76
59
  return await retrieveData(
77
60
  url,
@@ -130,8 +113,7 @@ export class ChromedriverStorageClient {
130
113
  return [];
131
114
  }
132
115
  log.debug(
133
- `Got ${util.pluralize('driver', driversToSync.length, true)} to sync: ` +
134
- JSON.stringify(driversToSync, null, 2),
116
+ `Got ${util.pluralize('driver', driversToSync.length, true)} to sync: ` + JSON.stringify(driversToSync, null, 2),
135
117
  );
136
118
 
137
119
  const synchronizedDrivers: string[] = [];
@@ -150,10 +132,7 @@ export class ChromedriverStorageClient {
150
132
  await fs.rimraf(archivesRoot);
151
133
  }
152
134
  if (!util.isEmpty(synchronizedDrivers)) {
153
- log.info(
154
- `Successfully synchronized ` +
155
- `${util.pluralize('chromedriver', synchronizedDrivers.length, true)}`,
156
- );
135
+ log.info(`Successfully synchronized ` + `${util.pluralize('chromedriver', synchronizedDrivers.length, true)}`);
157
136
  } else {
158
137
  log.info(`No chromedrivers were synchronized`);
159
138
  }
@@ -204,9 +183,7 @@ export class ChromedriverStorageClient {
204
183
  if (!util.isEmpty(versions)) {
205
184
  // Handle only selected versions if requested
206
185
  log.debug(`Selecting chromedrivers whose versions match to ${versions}`);
207
- driversToSync = driversToSync.filter((cdName) =>
208
- versions.includes(`${this.mapping[cdName].version}`),
209
- );
186
+ driversToSync = driversToSync.filter((cdName) => versions.includes(`${this.mapping[cdName].version}`));
210
187
 
211
188
  log.debug(`Got ${util.pluralize('item', driversToSync.length, true)}`);
212
189
  if (util.isEmpty(driversToSync)) {
@@ -217,16 +194,11 @@ export class ChromedriverStorageClient {
217
194
  const minBrowserVersionInt = convertToInt(minBrowserVersion);
218
195
  if (minBrowserVersionInt !== null) {
219
196
  // Only select drivers that support the current browser whose major version number equals to `minBrowserVersion`
220
- log.debug(
221
- `Selecting chromedrivers whose minimum supported browser version matches to ${minBrowserVersionInt}`,
222
- );
197
+ log.debug(`Selecting chromedrivers whose minimum supported browser version matches to ${minBrowserVersionInt}`);
223
198
  let closestMatchedVersionNumber = 0;
224
199
  // Select the newest available and compatible chromedriver
225
200
  for (const cdName of driversToSync) {
226
- const currentMinBrowserVersion = parseInt(
227
- String(this.mapping[cdName].minBrowserVersion),
228
- 10,
229
- );
201
+ const currentMinBrowserVersion = parseInt(String(this.mapping[cdName].minBrowserVersion), 10);
230
202
  if (
231
203
  !Number.isNaN(currentMinBrowserVersion) &&
232
204
  currentMinBrowserVersion <= minBrowserVersionInt &&
@@ -314,9 +286,7 @@ export class ChromedriverStorageClient {
314
286
  for (const sortedVersions of Object.values(patchesMap)) {
315
287
  selectedVersions.add(sortedVersions[0]);
316
288
  }
317
- driversToSync = driversToSync.filter((cdName) =>
318
- selectedVersions.has(this.mapping[cdName].version),
319
- );
289
+ driversToSync = driversToSync.filter((cdName) => selectedVersions.has(this.mapping[cdName].version));
320
290
  }
321
291
  }
322
292
 
@@ -423,13 +393,10 @@ export class ChromedriverStorageClient {
423
393
  const chromedriverPath = await fs.walkDir(
424
394
  tmpRoot,
425
395
  true,
426
- (itemPath, isDirectory) =>
427
- !isDirectory && path.parse(itemPath).name.toLowerCase() === 'chromedriver',
396
+ (itemPath, isDirectory) => !isDirectory && path.parse(itemPath).name.toLowerCase() === 'chromedriver',
428
397
  );
429
398
  if (!chromedriverPath) {
430
- throw new Error(
431
- 'The archive was unzipped properly, but we could not find any chromedriver executable',
432
- );
399
+ throw new Error('The archive was unzipped properly, but we could not find any chromedriver executable');
433
400
  }
434
401
  log.debug(`Moving the extracted '${path.basename(chromedriverPath)}' to '${dst}'`);
435
402
  await fs.mv(chromedriverPath, dst, {
package/lib/utils.ts CHANGED
@@ -1,14 +1,16 @@
1
- import {system, fs, node, util} from '@appium/support';
2
- import {BaseDriver} from '@appium/base-driver';
3
- import path from 'node:path';
4
1
  import {readFileSync} from 'node:fs';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
5
4
  import {fileURLToPath} from 'node:url';
6
- import {compareVersions} from 'compare-versions';
5
+
6
+ import {BaseDriver} from '@appium/base-driver';
7
+ import {system, fs, node, util} from '@appium/support';
8
+ import type {ADB} from 'appium-adb';
7
9
  import axios from 'axios';
8
10
  import type {AxiosRequestConfig} from 'axios';
9
- import os from 'node:os';
11
+ import {compareVersions} from 'compare-versions';
12
+
10
13
  import {OS, CPU} from './constants.js';
11
- import type {ADB} from 'appium-adb';
12
14
  import type {ChromedriverVersionMapping, OSInfo} from './types.js';
13
15
 
14
16
  const CD_EXECUTABLE_PREFIX = 'chromedriver';
@@ -39,9 +41,7 @@ export const CD_BASE_DIR = path.join(getModuleRoot(), 'chromedriver');
39
41
  * @returns The most recent version string.
40
42
  * @throws {Error} If the mapping is empty.
41
43
  */
42
- export function getMostRecentChromedriver(
43
- mapping: ChromedriverVersionMapping = CHROMEDRIVER_CHROME_MAPPING,
44
- ): string {
44
+ export function getMostRecentChromedriver(mapping: ChromedriverVersionMapping = CHROMEDRIVER_CHROME_MAPPING): string {
45
45
  if (util.isEmpty(mapping)) {
46
46
  throw new Error('Unable to get most recent Chromedriver version from empty mapping');
47
47
  }
@@ -50,9 +50,7 @@ export function getMostRecentChromedriver(
50
50
  }
51
51
 
52
52
  export const CD_VER: string =
53
- process.env.npm_config_chromedriver_version ||
54
- process.env.CHROMEDRIVER_VERSION ||
55
- getMostRecentChromedriver();
53
+ process.env.npm_config_chromedriver_version || process.env.CHROMEDRIVER_VERSION || getMostRecentChromedriver();
56
54
 
57
55
  /**
58
56
  * Gets the Chrome version for a given bundle ID using ADB.
@@ -160,10 +158,7 @@ const getBaseDriverInstance = util.memoize(() => new BaseDriver({}, false));
160
158
  * @returns The generated log prefix string.
161
159
  */
162
160
  export function generateLogPrefix(obj: any, sessionId: string | null = null): string {
163
- return getBaseDriverInstance().helpers.generateDriverLogPrefix(
164
- obj,
165
- sessionId ? sessionId : undefined,
166
- );
161
+ return getBaseDriverInstance().helpers.generateDriverLogPrefix(obj, sessionId ? sessionId : undefined);
167
162
  }
168
163
 
169
164
  /**
package/package.json CHANGED
@@ -1,32 +1,21 @@
1
1
  {
2
2
  "name": "appium-chromedriver",
3
+ "version": "9.0.2",
3
4
  "description": "Node.js wrapper around chromedriver.",
4
5
  "keywords": [
6
+ "android",
5
7
  "appium",
6
- "chrome",
7
- "android"
8
+ "chrome"
8
9
  ],
9
- "version": "9.0.0",
10
- "author": "Appium Contributors",
10
+ "bugs": {
11
+ "url": "https://github.com/appium/appium/issues"
12
+ },
11
13
  "license": "Apache-2.0",
14
+ "author": "Appium Contributors",
12
15
  "repository": {
13
16
  "type": "git",
14
17
  "url": "https://github.com/appium/appium-chromedriver.git"
15
18
  },
16
- "bugs": {
17
- "url": "https://github.com/appium/appium/issues"
18
- },
19
- "engines": {
20
- "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
21
- "npm": ">=10"
22
- },
23
- "prettier": {
24
- "bracketSpacing": false,
25
- "printWidth": 100,
26
- "singleQuote": true
27
- },
28
- "main": "./build/lib/index.js",
29
- "type": "module",
30
19
  "directories": {
31
20
  "lib": "lib"
32
21
  },
@@ -36,6 +25,8 @@
36
25
  "build/lib",
37
26
  "CHANGELOG.md"
38
27
  ],
28
+ "type": "module",
29
+ "main": "./build/lib/index.js",
39
30
  "types": "./build/lib/index.d.ts",
40
31
  "exports": {
41
32
  ".": {
@@ -44,11 +35,23 @@
44
35
  },
45
36
  "./package.json": "./package.json"
46
37
  },
38
+ "scripts": {
39
+ "build": "tsc -b",
40
+ "clean": "tsc -b --clean",
41
+ "dev": "npm run build -- --watch",
42
+ "lint": "oxlint -c oxlint.config.mjs .",
43
+ "lint:fix": "oxlint -c oxlint.config.mjs --fix .",
44
+ "prepare": "npm run build",
45
+ "format": "oxfmt -c oxfmt.config.mjs .",
46
+ "format:check": "oxfmt -c oxfmt.config.mjs --check .",
47
+ "test": "node --enable-source-maps --test --test-force-exit --test-timeout=60000 \"./build/test/unit/**/*.spec.js\"",
48
+ "e2e-test": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 --test-timeout=600000 \"./build/test/functional/**/*.spec.js\""
49
+ },
47
50
  "dependencies": {
48
51
  "@appium/base-driver": "^10.0.0-rc.2",
49
52
  "@appium/support": "^7.2.2",
50
53
  "@xmldom/xmldom": "^0.x",
51
- "appium-adb": "^15.0.0",
54
+ "appium-adb": "^16.0.0",
52
55
  "asyncbox": "^6.0.1",
53
56
  "axios": "^1.16.0",
54
57
  "compare-versions": "^6.0.0",
@@ -56,23 +59,10 @@
56
59
  "teen_process": "^4.0.4",
57
60
  "xpath": "^0.x"
58
61
  },
59
- "scripts": {
60
- "build": "tsc -b",
61
- "clean": "tsc -b --clean",
62
- "dev": "npm run build -- --watch",
63
- "lint": "eslint .",
64
- "lint:fix": "npm run lint -- --fix",
65
- "prepare": "npm run build",
66
- "format": "prettier -w ./lib ./test",
67
- "format:check": "prettier --check ./lib ./test",
68
- "test": "node --enable-source-maps --test --test-force-exit --test-timeout=60000 \"./build/test/unit/**/*.spec.js\"",
69
- "e2e-test": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 --test-timeout=600000 \"./build/test/functional/**/*.spec.js\""
70
- },
71
62
  "devDependencies": {
72
- "@appium/eslint-config-appium-ts": "^3.0.0",
73
- "@appium/tsconfig": "^1.0.0-rc.1",
74
- "@semantic-release/changelog": "^6.0.1",
75
- "@semantic-release/git": "^10.0.1",
63
+ "@appium/oxc-config": "^1.1.0",
64
+ "@appium/semantic-release-config": "^1.1.0",
65
+ "@appium/tsconfig": "^1.2.0",
76
66
  "@types/chai": "^5.2.3",
77
67
  "@types/chai-as-promised": "^8.0.2",
78
68
  "@types/express": "^5.0.6",
@@ -81,11 +71,11 @@
81
71
  "@types/sinon": "^22.0.0",
82
72
  "chai": "^6.0.0",
83
73
  "chai-as-promised": "^8.0.0",
84
- "conventional-changelog-conventionalcommits": "^9.3.1",
85
74
  "esmock": "^2.7.6",
86
- "prettier": "^3.0.0",
87
- "semantic-release": "^25.0.2",
88
- "sinon": "^22.0.0",
89
- "typescript": "^6.0.2"
75
+ "sinon": "^22.0.0"
76
+ },
77
+ "engines": {
78
+ "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
79
+ "npm": ">=10"
90
80
  }
91
81
  }