In Rails 5.1 tests, the driver used is set by calling driven_by
ApplicationSystemTestCase (test / application_system_test_case.rb). Assuming you have registered your capybara-webkit driver as "webkit", you should be able to do
driven_by :webkit
Another potential option if you are using Chrome 59+ on linux / mac is to use headless chrome
Capybara.register_driver :headless_chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome, :args => ['headless'])
end
and then in your test class
driven_by :headless_chrome
This gives you a headless version of chrome, so none of the problems of capybara-webkit / poltergeist supports current web standards. Unfortunately, chromedriver currently has problems with JS system mods (warning, confirmation, hint - a workaround in the master capybara branch) and freezes if you try to close windows during tests. We hope that these 2 questions will be fixed in the near future.
, rails 5.1 database_cleaner , .