-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to using suspender's Capybara configuration
With more recent Chromedriver versions, we need to specify the headless window size which this does. Plus more familiarity with this configuration.
- Loading branch information
1 parent
140e721
commit dd54052
Showing
2 changed files
with
30 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |