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

Switch to using suspender's Capybara configuration #1785

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

require "rspec/rails"
require "shoulda/matchers"
require "selenium/webdriver"

Dir[Rails.root.join("../../spec/support/**/*.rb")].each { |file| require file }

Expand All @@ -31,22 +30,3 @@ module Features
end

ActiveRecord::Migration.maintain_test_schema!

Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end

Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: {
args: %w[headless enable-features=NetworkService,NetworkServiceInProcess]
}
)
Capybara::Selenium::Driver.new app,
browser: :chrome,
desired_capabilities: capabilities
end

Capybara.javascript_driver = :selenium_chrome_headless

Capybara.server = :webrick
30 changes: 30 additions & 0 deletions spec/support/webdrivers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require "selenium/webdriver"

Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end

Capybara.register_driver :headless_chrome do |app|
options = ::Selenium::WebDriver::Chrome::Options.new
options.headless!
options.add_argument "--window-size=1680,1050"

Capybara::Selenium::Driver.new(
app,
browser: :chrome,
options: options,
)
end

Capybara.javascript_driver = :headless_chrome
Capybara.server = :webrick

RSpec.configure do |config|
config.before(:each, type: :system) do
driven_by :rack_test
end

config.before(:each, type: :system, js: true) do
driven_by Capybara.javascript_driver
end
end