@eyeo/get-browser-binary 0.5.0 → 0.7.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/.gitlab-ci.yml +6 -7
- package/.mocharc.json +3 -0
- package/README.md +24 -14
- package/RELEASE_NOTES.md +26 -0
- package/package.json +4 -5
- package/src/browsers.js +329 -453
- package/src/utils.js +1 -7
- package/test/browsers.js +49 -24
- package/test/extension/{background.js → mv2/background.js} +0 -0
- package/test/extension/mv2/index.html +1 -0
- package/test/extension/{manifest.json → mv2/manifest.json} +1 -2
- package/test/extension/mv3/background.js +3 -0
- package/test/extension/mv3/index.html +1 -0
- package/test/extension/mv3/manifest.json +8 -0
- package/test/extension/index.html +0 -1
package/.gitlab-ci.yml
CHANGED
|
@@ -53,14 +53,13 @@ test:browsers:windows:
|
|
|
53
53
|
- choco upgrade -y nodejs --version 16.10.0
|
|
54
54
|
- npm install
|
|
55
55
|
script:
|
|
56
|
-
# Running only a subset of Firefox
|
|
56
|
+
# Running only a subset of Firefox tests to avoid low OS resources error
|
|
57
57
|
# https://gitlab.com/eyeo/developer-experience/get-browser-binary/-/issues/2
|
|
58
|
-
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
# does the trick.
|
|
62
|
-
-
|
|
63
|
-
- npm test -- --grep """"$subset_tests""""
|
|
58
|
+
- npm test -- --grep "firefox.*installs"
|
|
59
|
+
# Running npm v8 on powershell has issues when the grep value contains the
|
|
60
|
+
# pipe (|) literal. Storing that string as a verbatim string (single quotes)
|
|
61
|
+
# and then sorrounding it with four double quotes does the trick.
|
|
62
|
+
# https://gitlab.com/eyeo/developer-experience/get-browser-binary/-/issues/29
|
|
64
63
|
- $full_tests = '(chromium|edge.*latest)'
|
|
65
64
|
- npm test -- --grep """"$full_tests""""
|
|
66
65
|
tags:
|
package/.mocharc.json
ADDED
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# get-browser-binary
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Install specific browser versions for Chromium, Firefox and Edge, and their
|
|
4
|
+
matching [selenium webdriver](https://www.selenium.dev/selenium/docs/api/javascript/index.html).
|
|
5
5
|
|
|
6
6
|
## Getting started
|
|
7
7
|
|
|
8
|
-
The sample below shows how to
|
|
8
|
+
The sample below shows how to install the latest Chromium and run it using
|
|
9
9
|
selenium webdriver:
|
|
10
10
|
|
|
11
11
|
```javascript
|
|
12
12
|
import {BROWSERS} from "@eyeo/get-browser-binary";
|
|
13
13
|
|
|
14
14
|
(async function example() {
|
|
15
|
-
let {binary} = await BROWSERS.chromium.
|
|
16
|
-
console.log(`Chromium
|
|
15
|
+
let {binary} = await BROWSERS.chromium.installBrowser("latest");
|
|
16
|
+
console.log(`Chromium executable location: ${binary}`);
|
|
17
17
|
|
|
18
18
|
let driver = await BROWSERS.chromium.getDriver("latest");
|
|
19
19
|
await driver.navigate().to("https://example.com/");
|
|
@@ -33,13 +33,10 @@ the right side.
|
|
|
33
33
|
- Chromium >= 75
|
|
34
34
|
- Firefox >= 60
|
|
35
35
|
- Edge >= 95
|
|
36
|
-
- Opera >= 62
|
|
37
36
|
|
|
38
|
-
Note: Edge
|
|
37
|
+
Note: Installing Edge is not supported on Windows. It is assumed to be installed
|
|
39
38
|
because it is the default browser on that platform.
|
|
40
39
|
|
|
41
|
-
Note: Using the `operadriver` on Windows is not supported.
|
|
42
|
-
|
|
43
40
|
## Development
|
|
44
41
|
|
|
45
42
|
### Prerequisites
|
|
@@ -55,7 +52,7 @@ npm install
|
|
|
55
52
|
|
|
56
53
|
### Folders to ignore / cache
|
|
57
54
|
|
|
58
|
-
All browser and webdriver files will be
|
|
55
|
+
All browser and webdriver files will be extracted to the `./browser-snapshots`
|
|
59
56
|
folder, which probably makes sense to be ignored (for instance, by adding it to
|
|
60
57
|
`.gitignore`).
|
|
61
58
|
|
|
@@ -78,6 +75,13 @@ The `grep` option filters the tests to run with a regular expression. Example:
|
|
|
78
75
|
npm test -- --grep "chromium.*latest"
|
|
79
76
|
```
|
|
80
77
|
|
|
78
|
+
The `timeout` option overrides the timeout defined by `.mocharc.json`.
|
|
79
|
+
Increasing the timeout may be useful on slow connection environments:
|
|
80
|
+
|
|
81
|
+
```shell
|
|
82
|
+
npm test -- --timeout <ms>
|
|
83
|
+
```
|
|
84
|
+
|
|
81
85
|
### Running tests on Docker
|
|
82
86
|
|
|
83
87
|
Useful to reproduce the CI environment of the `test:browsers:linux` job:
|
|
@@ -87,14 +91,20 @@ docker build -f test/docker/Dockerfile -t browsers .
|
|
|
87
91
|
docker run --shm-size=256m -it browsers
|
|
88
92
|
```
|
|
89
93
|
|
|
90
|
-
The `grep`
|
|
94
|
+
The `grep` and `timeout` options can also be used on Docker via the `TEST_ARGS`
|
|
95
|
+
parameter:
|
|
91
96
|
|
|
92
97
|
```shell
|
|
93
|
-
docker run --shm-size=256m -e TEST_ARGS="--grep chromium.*latest" -it browsers
|
|
98
|
+
docker run --shm-size=256m -e TEST_ARGS="--grep chromium.*latest --timeout 100000" -it browsers
|
|
94
99
|
```
|
|
95
100
|
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
By default, tests delete the `./browser-snapshots` before each `Browser` suite
|
|
102
|
+
runs. To change that behavior you may set the `TEST_KEEP_SNAPSHOTS` environment
|
|
103
|
+
variable to `true`. Example:
|
|
104
|
+
|
|
105
|
+
```shell
|
|
106
|
+
TEST_KEEP_SNAPSHOTS=true npm test
|
|
107
|
+
```
|
|
98
108
|
|
|
99
109
|
## Building the documentation
|
|
100
110
|
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
# 0.7.0
|
|
2
|
+
|
|
3
|
+
- Implement takeFullPageScreenshot (#32)
|
|
4
|
+
- Unify error messages (#22)
|
|
5
|
+
- Document when a browser binary is downloaded or installed (#30)
|
|
6
|
+
- Use cached driver binary if it already exists (#20)
|
|
7
|
+
- Remove chromedriver dependency (#33)
|
|
8
|
+
- Fallback mechanism on minor browser versions (Edge) (#27)
|
|
9
|
+
|
|
10
|
+
### Testing
|
|
11
|
+
|
|
12
|
+
- Use a manifest V3 extension on latest chromium-based browsers tests (#31)
|
|
13
|
+
- Allow test run to not delete browser snapshots (#28)
|
|
14
|
+
- Add a timeout option to run the tests (#24)
|
|
15
|
+
|
|
16
|
+
### Notes for integrators
|
|
17
|
+
|
|
18
|
+
- The `downloadBinary` function has been renamed to `installBrowser` (!38).
|
|
19
|
+
|
|
20
|
+
# 0.6.0
|
|
21
|
+
|
|
22
|
+
- Removes Opera support (#26)
|
|
23
|
+
- Improves error handling when the downloaded browser version doesn't match
|
|
24
|
+
known channels (#25)
|
|
25
|
+
- Fixes an Edge running issue on Windows (32-bit) (#23)
|
|
26
|
+
|
|
1
27
|
# 0.5.0
|
|
2
28
|
|
|
3
29
|
- Enables Edge binary downloads on MacOS (!25)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eyeo/get-browser-binary",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Install browser binaries and matching webdrivers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://gitlab.com/eyeo/developer-experience/get-browser-binary"
|
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"chromedriver": "^90.0.1",
|
|
19
18
|
"dmg": "^0.1.0",
|
|
20
19
|
"extract-zip": "^2.0.1",
|
|
21
|
-
"fs-extra": "^10.0.0",
|
|
22
20
|
"geckodriver": "^3.0.2",
|
|
23
21
|
"got": "^11.8.2",
|
|
24
|
-
"
|
|
22
|
+
"jimp": "^0.16.2",
|
|
23
|
+
"selenium-webdriver": "^4.7.1"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
26
|
"eslint": "^8.17.0",
|