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

Install Chromium browser and its webdriver #577

Merged
merged 1 commit into from
Mar 1, 2022

Conversation

ollietreend
Copy link
Contributor

This commit changes the base docker image to install Chromium browser instead of Google Chrome. This change should make the docker image compatible with the ARM architecture, making it possible for developers to use govuk-docker on Apple M1 MacBooks.

It also installs Chromium WebDriver (chromium-driver) alongside the browser, meaning applications will be able to run Selenium tests without having to install any additional dependencies.

Installing the browser and its associated webdriver as a pair – at the same time, and in the same way – should also avoid any potential for compatibility issues arising from mismatched versions between these two components.

This change should make it possible for us to update the govuk_test gem so that it no longer needs to install chromedriver by itself.

Copy link
Member

@kevindew kevindew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, have you been able to test a couple of apps to check that their selenium tests still pass with this?

This commit changes the base docker image to install Chromium browser instead of Google Chrome. This change should make the docker image compatible with the ARM architecture, making it possible for developers to use govuk-docker on Apple M1 MacBooks.

It also installs Chromium WebDriver (chromium-driver) alongside the browser, meaning applications will be able to run Selenium tests without having to install any additional dependencies.

Installing the browser and its associated webdriver as a pair – at the same time, and in the same way – should also avoid any potential for compatibility issues arising from mismatched versions between these two components.

This change should make it possible for us to update the [govuk_test] gem so that it no longer needs to install chromedriver by itself.

[govuk_test]: https://github.com/alphagov/govuk_test
Copy link
Contributor

@ChrisBAshton ChrisBAshton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@DilwoarH DilwoarH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work - I will close #576

kevindew added a commit to alphagov/govuk_publishing_components that referenced this pull request Feb 28, 2022
In the time since PR 2625 [1] was merged we've learnt that the webdrivers
gem is going to cause a problem for the GOV.UK development environment,
govuk-docker, when running on M1 macs.

We have decided to change tact and focus on installing a chromedriver on
the underlying machine rather than using webdrivers as a source of this
software [2] [3]. This seems extra pragmatic now that we have Javascript
dependencies also using chromedriver.

A step towards this is removing this intertwining of Ruby webdriver
dependency from this repo's yarn tests.

The effect merging this will have is:

- The build will continue to pass in GitHub Actions CI - chromedriver is
  installed
- Users running jasmine tests in govuk-docker will need to be using [2]
- Users running jasmine tests on their local machine will have to
  install chromedriver manually (there is a helpful prompt)

[1]: #2625
[2]: alphagov/govuk-docker#577
[3]: alphagov/govuk_test#43
@ollietreend ollietreend merged commit 3cf2737 into main Mar 1, 2022
@ollietreend ollietreend deleted the install-chromium-with-driver branch March 1, 2022 16:05
ollietreend added a commit to alphagov/govuk-puppet that referenced this pull request Mar 3, 2022
This adds a module `govuk_chromedriver` which can be included to install Google Chrome alongside a compatible version of ChromeDriver, ready for use by Selenium browser tests.

This is being introduced so that there is always a usable version of ChromeDriver available on CI machines which need to run tests. In the past, CI machines have had a system-wide version of Google Chrome available for use, but no accompanying ChromeDriver. Instead each application has had to use the `webdrivers` gem to install its own version of ChromeDriver locally.

This change represents a deliberate shift in responsibility. Where previously applications were responsible for sourcing their own ChromeDriver (and hence depended on the `webdrivers` gem), we've now decided that it be the responsibility of the underlying operating environment to provide it.

In real terms, this means that the GOV.UK development environment – [govuk-docker] – and the CI environment need to have ChromeDriver installed.

[govuk-docker]: alphagov/govuk-docker#577
ollietreend added a commit to alphagov/govuk-puppet that referenced this pull request Mar 4, 2022
This adds a module `govuk_chromedriver` which can be included to install Google Chrome alongside a compatible version of ChromeDriver, ready for use by Selenium browser tests.

This is being introduced so that there is always a usable version of ChromeDriver available on CI machines which need to run tests. In the past, CI machines have had a system-wide version of Google Chrome available for use, but no accompanying ChromeDriver. Instead each application has had to use the `webdrivers` gem to install its own version of ChromeDriver locally.

This change represents a deliberate shift in responsibility. Where previously applications were responsible for sourcing their own ChromeDriver (and hence depended on the `webdrivers` gem), we've now decided that it be the responsibility of the underlying operating environment to provide it.

In real terms, this means that the GOV.UK development environment – [govuk-docker] – and the CI environment need to have ChromeDriver installed.

[govuk-docker]: alphagov/govuk-docker#577
ollietreend added a commit to alphagov/govuk-puppet that referenced this pull request Mar 4, 2022
This adds a module `govuk_chromedriver` which can be included to install Google Chrome alongside a compatible version of ChromeDriver, ready for use by Selenium browser tests.

This is being introduced so that there is always a usable version of ChromeDriver available on CI machines which need to run tests. In the past, CI machines have had a system-wide version of Google Chrome available for use, but no accompanying ChromeDriver. Instead each application has had to use the `webdrivers` gem to install its own version of ChromeDriver locally.

This change represents a deliberate shift in responsibility. Where previously applications were responsible for sourcing their own ChromeDriver (and hence depended on the `webdrivers` gem), we've now decided that it be the responsibility of the underlying operating environment to provide it.

In real terms, this means that the GOV.UK development environment – [govuk-docker] – and the CI environment need to have ChromeDriver installed.

[govuk-docker]: alphagov/govuk-docker#577
ollietreend added a commit to alphagov/govuk-puppet that referenced this pull request Mar 7, 2022
This adds a module `govuk_chromedriver` which can be included to install Google Chrome alongside a compatible version of ChromeDriver, ready for use by Selenium browser tests.

This is being introduced so that there is always a usable version of ChromeDriver available on CI machines which need to run tests. In the past, CI machines have had a system-wide version of Google Chrome available for use, but no accompanying ChromeDriver. Instead each application has had to use the `webdrivers` gem to install its own version of ChromeDriver locally.

This change represents a deliberate shift in responsibility. Where previously applications were responsible for sourcing their own ChromeDriver (and hence depended on the `webdrivers` gem), we've now decided that it be the responsibility of the underlying operating environment to provide it.

In real terms, this means that the GOV.UK development environment – [govuk-docker] – and the CI environment need to have ChromeDriver installed.

[govuk-docker]: alphagov/govuk-docker#577
ollietreend added a commit to alphagov/govuk_test that referenced this pull request Mar 7, 2022
We've traditionally used the gem [`webdrivers`][webdrivers] to automagically install ChromeDriver on the system at runtime, so that it's available for use by Capybara and headless Jasmine tests.

However this approach is beginning to cause us some problems because Google Chrome and ChromeDriver aren't currently available as Linux ARM binaries. This means that developers on Apple M1 MacBooks are unable to run tests when working in the [govuk-docker] development environment.

We've therefore made the decision to change how we install and use Chrome and its associated WebDriver. Instead of applications being responsible for installing ChromeDriver via this gem's use of `webdrivers`, we've made it the responsibility of the underlying operating system to provide a compatible browser and WebDriver.

In everyday use, this change should be unnoticeable because we've prepared our tooling ahead of time:
- govuk-docker now comes with ChromeDriver (see alphagov/govuk-docker#577)
- Jasmine CI workers also have ChromeDriver (see alphagov/govuk-puppet#11568)
- The GitHub Actions `ubuntu-latest` image has ChromeDriver pre-installed (see [the docs][ubuntu-latest])

However, if you're running tests in another environment (e.g. local development on bare metal), you'll need to make sure ChromeDriver is available. This is usually as simple as running:

```
$ brew install chromedriver
```

[webdrivers]: https://rubygems.org/gems/webdrivers
[govuk-docker]: https://github.com/alphagov/govuk-docker
[ubuntu-latest]: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#browsers-and-drivers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants