Read more

VCR and the webdrivers gem

Niklas Hä.
September 23, 2020Software engineer at makandra GmbH

If you're using the webdrivers Show archive.org snapshot gem and VCR together, depending on your configuration, VCR will yell at you regulary.
The webdrivers gem tries to update your webdrivers on your local machine. To do so, it checks the internet for newer versions, firing an HTTP-request to e.g. https://chromedriver.storage.googleapis.com

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

You can "fix" this in multiple ways:

  1. Update your drivers on your machine with
    RAILS_ENV=test rake webdrivers:chromedriver:update

  2. Ignore the driver update-URL in your VCR configuration

# e.g. for the chromedriver
VCR.configure do |config|
  config.ignore_hosts 'chromedriver.storage.googleapis.com'
end
  1. Pin the version Show archive.org snapshot of your driver

To check if your suite is "affected" by this, you can reduce the webdriver update interval and see if VCR complains:

WD_CACHE_TIME=1 bundle exec cucumber

Note:
Newer Rails versions come with the webdrivers gem automatically.

Posted by Niklas Hä. to makandra dev (2020-09-23 18:43)