Replace PhantomJS/Poltergeist config with Headless Chrome
This commit is contained in:
@@ -10,7 +10,7 @@ require 'rspec/rails'
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require 'capybara/rails'
|
require 'capybara/rails'
|
||||||
require 'capybara/rspec'
|
require 'capybara/rspec'
|
||||||
require 'capybara/poltergeist'
|
require 'selenium/webdriver'
|
||||||
|
|
||||||
I18n.default_locale = :en
|
I18n.default_locale = :en
|
||||||
|
|
||||||
@@ -26,17 +26,23 @@ RSpec.configure do |config|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Capybara.register_driver :poltergeist do |app|
|
Capybara.register_driver :chrome do |app|
|
||||||
Capybara::Poltergeist::Driver.new(app,
|
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
||||||
timeout: 1.minute,
|
end
|
||||||
inspector: true, # allows remote debugging by executing page.driver.debug
|
|
||||||
phantomjs_logger: File.open(File::NULL, "w"), # don't print console.log calls in console
|
Capybara.register_driver :headless_chrome do |app|
|
||||||
phantomjs_options: ['--load-images=no', '--disk-cache=false'],
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
||||||
extensions: [File.expand_path("../support/phantomjs_ext/disable_js_fx.js", __FILE__)] # disable js effects
|
chromeOptions: { args: %w(headless disable-gpu) }
|
||||||
|
)
|
||||||
|
|
||||||
|
Capybara::Selenium::Driver.new(
|
||||||
|
app,
|
||||||
|
browser: :chrome,
|
||||||
|
desired_capabilities: capabilities
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
Capybara.javascript_driver = :poltergeist
|
Capybara.javascript_driver = :headless_chrome
|
||||||
|
|
||||||
Capybara.exact = true
|
Capybara.exact = true
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
document.addEventListener("DOMContentLoaded", function() {
|
|
||||||
if (typeof $ !== 'undefined') {
|
|
||||||
$.fx.off = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user