Skip to content

Commit

Permalink
Support development ChromeDriver version overrides
Browse files Browse the repository at this point in the history
Refines the changes introduced to the CI configuration made in
[b1cbe12][].

Recent Chrome upgrades are causing errors like the following while
executing the test suite locally:

```
SessionNotCreatedException: [POST http://localhost:4444/wd/hub/session / {"desiredCapabilities":{"name":"intern","idle-timeout":60,"browserName":"chrome","goog:chromeOptions":{"args":["headless","disable-gpu","no-sandbox"]},"browser":"chrome"}}] session not created: This version of ChromeDriver only supports Chrome version 99
Current browser version is 102.0.5005.115 with binary path
```

The **only supports Chrome version 99** portion is due to `digdug`'s
locked-support for Chrome version 99 declared in its [webdrivers.json][]
file.

This commit checks for the presence of the `CHROMEVER` environment
variable, and overrides the [intern.json](./intern.json) configuration
to incorporate that into its `tunnelOptions.drivers` value.

[webdrivers.json]: https://github.com/theintern/digdug/blob/806dcf29c2265d3cb1a26a09ef5b43e93fc2a739/src/webdrivers.json#L8-L11
[b1cbe12]: b1cbe12
  • Loading branch information
seanpdoyle committed Jun 20, 2022
1 parent 631701d commit b83c04d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ jobs:

- name: Set Chrome Version
run: |
CHROMEVER="$(chromedriver --version | cut -d' ' -f2)"
export CHROMEVER="$(chromedriver --version | cut -d' ' -f2)"
echo "Actions ChromeDriver is $CHROMEVER"
CONTENTS="$(jq '.tunnelOptions.drivers[0].name = "chrome"' < intern.json)"
CONTENTS="$(echo ${CONTENTS} | jq --arg chromever "$CHROMEVER" '.tunnelOptions.drivers[0].version = $chromever')"
echo "${CONTENTS}" > intern.json
cat intern.json
- name: Lint
run: yarn lint
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ Once you are done developing the feature or bug fix you have 2 options:
### Testing
The library is tested by running the test suite (found in: `src/tests/*`) against headless browsers. The browsers are setup in `intern.json` check it out to see the used browser environments.

To override the ChromeDriver version, declare the `CHROMEVER` environment
variable.

The tests are using the compiled version of the library and they are themselves also compiled. To compile the tests and library and watch for changes:

```bash
Expand Down
9 changes: 9 additions & 0 deletions src/tests/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { TestServer } = require("../../dist/tests/server")
const configuration = require("../../intern.json")
const intern = require("intern").default
const arg = require("arg");
const { CHROMEVER } = process.env

const args = arg({
"--grep": String,
Expand All @@ -11,6 +12,14 @@ const args = arg({
intern.configure(configuration)
intern.configure({ reporters: [ "runner" ] })

if (CHROMEVER) {
intern.configure({
tunnelOptions: {
drivers: [{ name: "chrome", version: CHROMEVER }]
}
})
}

if (args["--grep"]) {
intern.configure({ grep: args["--grep"] })
}
Expand Down

0 comments on commit b83c04d

Please sign in to comment.