I am using the monkey version of Selenium Webdriver that opens the PhantomJS browser between test runs. See this blog post: http://blog.sharetribe.com/2014/04/07/faster-cucumber-startup-keep-phantomjs-browser-open-between-tests/
The trick is to Selenium::WebDriver::PhantomJS::Service.create_process method and tell Selenium Driver to use port 8910 by default, even if it is reserved.
You can add this piece of code to the config / test.rb file:
class Selenium::WebDriver::PortProber def self.free?(port) true end end class Selenium::WebDriver::PhantomJS::Service def create_process(args) puts "Starting monkey-patched PhantomJS Selenium Webdriver" Struct.new("ChildProcessFake") do def start() end def exited?() true end end.new end end
Now you can start PhantomJS on the terminal tab:
phantomjs --webdriver=8910
And when you start PhantomJS, you can start the cucumber tests.
Obviously this only works for PhantomJS, but something like this can work with other browsers as well.
rap1ds
source share