I use poltergeist/phantomjs for CI, but I want to be able to optionally change the JS driver to selenium to watch my test runs locally. Ideally I'd like to have a command line flag for this- default poltergeist, but be able to run rspec --driver=selenium (or something similar)
Any ideas?
Never ended up finding an answer for this, so here's the hacky solution I came up with:
The only thing I found that I could reliably change was the tagging system. So I call using -t visual tag and then take it away.
In spec/spec_helper.rb
Rspec.configure do |config|
if config.filter_manager.inclusions[:visual]
Capybara.javascript_driver = :selenium
config.filter_manager.inclusions.delete(:visual)
else
Capybara.javascript_driver = :poltergeist
end
~rest of rspec config code~
Now you can run your tests with rspec (tests to run) -t visual
The main problem with this is that it will prevent you from running specific tests. You can still do a single file with rspec spec/features/signup_spec.rb -t visual
but you cannot add a :54
to run at a specific line number.