Pass --load-images=no to PhantomJS via Capybara/Poltergeist

We were unintentionally hitting `gravatar.com` whenever a test that used
Poltergeist was run. This was certainly wasting their resources and
slowing down our tests even further, for no reason.
This commit is contained in:
Robert Speicher 2016-11-28 16:50:08 +08:00
parent eff2404785
commit 1e66f35c56
2 changed files with 18 additions and 2 deletions

View file

@ -6,7 +6,15 @@ timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 15
Capybara.javascript_driver = :poltergeist Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app| Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: true, timeout: timeout, window_size: [1366, 768]) Capybara::Poltergeist::Driver.new(
app,
js_errors: true,
timeout: timeout,
window_size: [1366, 768],
phantomjs_options: [
'--load-images=no'
]
)
end end
Capybara.default_max_wait_time = timeout Capybara.default_max_wait_time = timeout

View file

@ -7,7 +7,15 @@ timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 90 : 10
Capybara.javascript_driver = :poltergeist Capybara.javascript_driver = :poltergeist
Capybara.register_driver :poltergeist do |app| Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, js_errors: true, timeout: timeout, window_size: [1366, 768]) Capybara::Poltergeist::Driver.new(
app,
js_errors: true,
timeout: timeout,
window_size: [1366, 768],
phantomjs_options: [
'--load-images=no'
]
)
end end
Capybara.default_max_wait_time = timeout Capybara.default_max_wait_time = timeout