Skip to content

Commit

Permalink
Make Chromedriver truly headless (#982)
Browse files Browse the repository at this point in the history
* Make Chromedriver truly headless

When I use Suspenders' configuration on a new project, JavaScript tests
open up the Chrome app in a real window.

When using the configuration in this commit, Chrome quietly bounces
once, in the taskbar (on macOS), and does not create a window.

* Remove needless Chromedriver options
  • Loading branch information
gabebw authored and composerinteralia committed Jun 26, 2019
1 parent 5d7fc35 commit 75158c8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions templates/chromedriver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
end

Capybara.register_driver :headless_chrome do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
chromeOptions: { args: %w(headless disable-gpu) },
)
options = ::Selenium::WebDriver::Chrome::Options.new
options.headless!

Capybara::Selenium::Driver.new app,
browser: :chrome,
desired_capabilities: capabilities
options: options
end

Capybara.javascript_driver = :headless_chrome

0 comments on commit 75158c8

Please sign in to comment.