Use capybara-webmock to avoid external requests

The images from OpenStreetMap take a while to load, sometimes even
causing Net::ReadTimeout errors if the internet connection is slow. It's
happened a lot recently on Travis builds.

Using capybara-webmock we guarantee the test suite doesn't fail due to
network issues.
This commit is contained in:
Javi Martín
2019-09-05 17:03:47 +02:00
parent 1f0a4cd875
commit 8bb5462253
4 changed files with 20 additions and 1 deletions

View File

@@ -33,7 +33,9 @@ end
Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless no-sandbox window-size=1200,600) }
chromeOptions: {
args: %W[headless no-sandbox window-size=1200,600 proxy-server=127.0.0.1:#{Capybara::Webmock.port_number}]
}
)
Capybara::Selenium::Driver.new(