Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove automatic download of the latest chromedriver upon install #430

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ more details on it.
> This package can work with Microsoft Edge WebDriver as well, but the support is limited.
> For example, automatic downloads do not work for Microsoft Edge WebDriver.

## Skipping binary installation
## Automatic Chromedriver download on module install

Since version 6.0.0 of this module automatic download of the latest known chromedriver
does not happen anymore. The below information is only relevant for older module versions:

### Skipping binary installation

By default, upon installation the package downloads the most recent known Chromedriver version from
Chromedriver CDN server: http://chromedriver.storage.googleapis.com.
Expand All @@ -35,7 +40,7 @@ binary set the `APPIUM_SKIP_CHROMEDRIVER_INSTALL` environment variable:
APPIUM_SKIP_CHROMEDRIVER_INSTALL=1 npm install appium-chromedriver
```

## Custom Chromedriver version
### Custom Chromedriver version

By default, the package uses the most recent known Chromedriver version.
The full list of known Chromedriver versions and their corresponding supported
Expand All @@ -51,19 +56,8 @@ CHROMEDRIVER_VERSION=107.0.5304.62 npm install appium-chromedriver
## Custom binaries url

If you want Chromedriver to be downloaded from another CDN, which differs from the
default one https://chromedriver.storage.googleapis.com, then either set the npm config property `chromedriver_cdnurl`:

```bash
npm install appium-chromedriver --chromedriver_cdnurl=http://npm.taobao.org/mirrors/chromedriver
```

The property could also be added into your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.

```bash
chromedriver_cdnurl=http://npm.taobao.org/mirrors/chromedriver
```

Or set the new URL to `CHROMEDRIVER_CDNURL` environment variable:
default one https://chromedriver.storage.googleapis.com, then set the new URL to
the `CHROMEDRIVER_CDNURL` environment variable:

```bash
CHROMEDRIVER_CDNURL=http://npm.taobao.org/mirrors/chromedriver npm install appium-chromedriver
Expand All @@ -77,7 +71,7 @@ the server returns a proper list of stored drivers in response to requests havin
Since version 5.6 the second environment variable has been added: `CHROMELABS_URL`. By default, it points
to https://googlechromelabs.github.io, and is expected to contain the actual prefix of
[Chrome for Testing availability](https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints)
JSON API. This API allows retrieval of chromedrivers whose versions are greater than 114.
JSON API. This API allows retrieval of chromedrivers whose major versions are greater than `114`.

Similarly to the above it could be also defined in the .npmrc file:

Expand Down
80 changes: 0 additions & 80 deletions install-npm.js

This file was deleted.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
},
"files": [
"config",
"install-npm.js",
"lib",
"build",
"!build/test",
Expand Down Expand Up @@ -62,7 +61,6 @@
"dev": "npm run build -- --watch",
"lint": "eslint .",
"lint:fix": "npm run lint -- --fix",
"postinstall": "node install-npm.js",
"prepare": "npm run build",
"format": "prettier -w ./lib",
"test": "mocha --exit --timeout 1m \"./test/unit/**/*-specs.js\"",
Expand Down
2 changes: 1 addition & 1 deletion test/functional/chromedriver-e2e-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// transpile:mocha

import {Chromedriver} from '../../lib/chromedriver';
import {install} from '../../lib/install';
import {install} from '../helpers/install';
import B from 'bluebird';
import {exec} from 'teen_process';
import _ from 'lodash';
Expand Down
58 changes: 0 additions & 58 deletions test/functional/install-e2e-specs.js

This file was deleted.

16 changes: 5 additions & 11 deletions lib/install.js → test/helpers/install.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import _ from 'lodash';
import { fs, mkdirp } from '@appium/support';
import ChromedriverStorageClient from './storage-client/storage-client';
import {parseLatestKnownGoodVersionsJson} from './storage-client/chromelabs';
import ChromedriverStorageClient from '../../lib/storage-client/storage-client';
import {parseLatestKnownGoodVersionsJson} from '../../lib/storage-client/chromelabs';
import {
CD_VER, retrieveData, getOsInfo, getChromedriverDir,
} from './utils';
import { USER_AGENT, STORAGE_REQ_TIMEOUT_MS, CHROMELABS_URL } from './constants';
} from '../../lib/utils';
import { USER_AGENT, STORAGE_REQ_TIMEOUT_MS, CHROMELABS_URL } from '../../lib/constants';

const LATEST_VERSION = 'LATEST';

Expand Down Expand Up @@ -49,7 +49,7 @@ async function prepareChromedriverDir (platformName) {
return chromedriverDir;
}

async function install () {
export async function install () {
const osInfo = await getOsInfo();
const client = new ChromedriverStorageClient({
chromedriverDir: await prepareChromedriverDir(osInfo.name),
Expand All @@ -59,9 +59,3 @@ async function install () {
versions: [await formatCdVersion(CD_VER)],
});
}

async function doInstall () {
await install();
}

export { install, doInstall };
Loading