@eyeo/get-browser-binary 0.3.0 → 0.5.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/.dockerignore ADDED
@@ -0,0 +1,3 @@
1
+ node_modules/
2
+ browser-snapshots/
3
+ docs/
package/.eslintrc.json CHANGED
@@ -5,7 +5,8 @@
5
5
  "root": true,
6
6
  "env": {
7
7
  "es2022": true,
8
- "node": true
8
+ "node": true,
9
+ "browser": true
9
10
  },
10
11
  "rules": {
11
12
  "brace-style": ["error", "stroustrup"],
package/.gitlab-ci.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  default:
2
- image: registry.gitlab.com/eyeo/docker/adblockplus-ci:node16-no-python
2
+ image: registry.gitlab.com/eyeo/docker/get-browser-binary:node16
3
3
  interruptible: true
4
4
 
5
5
  stages:
@@ -29,18 +29,15 @@ test:basic:
29
29
 
30
30
  test:browsers:linux:
31
31
  stage: test
32
+ image: docker:20.10.16
33
+ services:
34
+ - docker:20.10.16-dind
35
+ variables:
36
+ DOCKER_DRIVER: overlay2
32
37
  before_script:
33
- - apt-get update && apt-get install -y procps
34
- - npm install
35
- # https://www.how2shout.com/linux/install-microsoft-edge-on-linux/
36
- - wget https://packages.microsoft.com/keys/microsoft.asc
37
- - cat microsoft.asc | gpg --dearmor > microsoft.gpg
38
- - install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
39
- - echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list
40
- - rm microsoft.*
41
- - apt-get update && apt-get install -y microsoft-edge-stable
38
+ - docker build -f test/docker/Dockerfile -t browsers .
42
39
  script:
43
- - xvfb-run -a npm test -- --grep "Browser"
40
+ - docker run --shm-size=256m browsers
44
41
 
45
42
  test:browsers:windows:
46
43
  stage: test
@@ -56,8 +53,16 @@ test:browsers:windows:
56
53
  - choco upgrade -y nodejs --version 16.10.0
57
54
  - npm install
58
55
  script:
59
- - npm test -- --grep "chromium"
60
- - npm test -- --grep "edge"
56
+ # Running only a subset of Firefox and Opera tests to avoid low OS resources error
57
+ # https://gitlab.com/eyeo/developer-experience/get-browser-binary/-/issues/2
58
+ # Regarding grep, running npm v8 on powershell has issues when the grep
59
+ # value contains the pipe (|) literal. Storing that string as a verbatim
60
+ # string (single quotes) and then sorrounding it with four double quotes
61
+ # does the trick.
62
+ - $subset_tests = '(firefox|opera).*latest.*downloads'
63
+ - npm test -- --grep """"$subset_tests""""
64
+ - $full_tests = '(chromium|edge.*latest)'
65
+ - npm test -- --grep """"$full_tests""""
61
66
  tags:
62
67
  - shared-windows
63
68
  - windows
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ code-of-conduct@eyeo.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
126
+ at [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
package/README.md CHANGED
@@ -1,11 +1,7 @@
1
1
  # get-browser-binary
2
2
 
3
- Download 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
-
6
- Note: Edge download is not implemented, and it is assumed to be already
7
- installed on the running system. In that case, the matching `msedgedriver`
8
- will be downloaded accordingly.
3
+ Download specific browser versions for Chromium, Firefox, Edge and Opera, and
4
+ their matching [selenium webdriver](https://www.selenium.dev/selenium/docs/api/javascript/index.html).
9
5
 
10
6
  ## Getting started
11
7
 
@@ -16,12 +12,10 @@ selenium webdriver:
16
12
  import {BROWSERS} from "@eyeo/get-browser-binary";
17
13
 
18
14
  (async function example() {
19
- let {chromium} = BROWSERS;
20
-
21
- let {binary} = await chromium.downloadBinary();
15
+ let {binary} = await BROWSERS.chromium.downloadBinary("latest");
22
16
  console.log(`Chromium binary downloaded to ${binary}`);
23
17
 
24
- let driver = await chromium.getDriver();
18
+ let driver = await BROWSERS.chromium.getDriver("latest");
25
19
  await driver.navigate().to("https://example.com/");
26
20
  await driver.quit();
27
21
  })();
@@ -34,6 +28,18 @@ For more information, please refer to the [API documention](https://gitlab.com/e
34
28
  If you are already on the documentation page, you may find the API contents on
35
29
  the right side.
36
30
 
31
+ ### Supported browser versions
32
+
33
+ - Chromium >= 75
34
+ - Firefox >= 60
35
+ - Edge >= 95
36
+ - Opera >= 62
37
+
38
+ Note: Edge download is not supported on Windows. It is assumed to be installed
39
+ because it is the default browser on that platform.
40
+
41
+ Note: Using the `operadriver` on Windows is not supported.
42
+
37
43
  ## Development
38
44
 
39
45
  ### Prerequisites
@@ -69,11 +75,34 @@ npm test
69
75
  The `grep` option filters the tests to run with a regular expression. Example:
70
76
 
71
77
  ```shell
72
- npm test -- --grep "chromium latest"
78
+ npm test -- --grep "chromium.*latest"
79
+ ```
80
+
81
+ ### Running tests on Docker
82
+
83
+ Useful to reproduce the CI environment of the `test:browsers:linux` job:
84
+
85
+ ```shell
86
+ docker build -f test/docker/Dockerfile -t browsers .
87
+ docker run --shm-size=256m -it browsers
73
88
  ```
74
89
 
90
+ The `grep` option can also be used on Docker via the `TEST_ARGS` parameter:
91
+
92
+ ```shell
93
+ docker run --shm-size=256m -e TEST_ARGS="--grep chromium.*latest" -it browsers
94
+ ```
95
+
96
+ Note: For a full automated run, `opera` tests should not use the interactive
97
+ tty `-it` flag.
98
+
75
99
  ## Building the documentation
76
100
 
77
101
  ```shell
78
102
  npm run docs
79
103
  ```
104
+
105
+ ## Code of Conduct
106
+
107
+ All contributors to this project are required to read and follow our
108
+ [code of conduct](./CODE_OF_CONDUCT.md).
package/RELEASE_NOTES.md CHANGED
@@ -1,3 +1,17 @@
1
+ # 0.5.0
2
+
3
+ - Enables Edge binary downloads on MacOS (!25)
4
+ - Sets unsupported browser versions (#16)
5
+ - Fixes the Edge repo url (!27)
6
+ - Fixes an issue when downloading Opera (#21)
7
+ - Fixes redundant Opera installations on Linux (!24)
8
+
9
+ # 0.4.0
10
+
11
+ - Adds Opera as a supported browser (#7)
12
+ - Enables Edge binary downloads on Linux (!18)
13
+ - Adds a code of conduct (#15)
14
+
1
15
  # 0.3.0
2
16
 
3
17
  - Adds incognito mode support to all browsers (#5)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eyeo/get-browser-binary",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Download browser binaries and matching webdrivers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,6 @@
21
21
  "fs-extra": "^10.0.0",
22
22
  "geckodriver": "^3.0.2",
23
23
  "got": "^11.8.2",
24
- "msedgedriver": "^91.0.0",
25
24
  "selenium-webdriver": "^4.2.0"
26
25
  },
27
26
  "devDependencies": {