I'm using headless watir-webdriver together with MiniTest for browser testing. That works fine. However there's something that doesn't satisfy me. I load the headless browser again and again before each test. I would prefer loading it once and using it all the time.
Is it possible to do so?
Here's a short example:
require 'watir-webdriver'
require 'headless'
require 'minitest/autorun'
class TestMe < MiniTest::Test
def setup
$headless = Headless.new
$headless.start
$b = Watir::Browser.new :firefox
$b.goto 'http://www.google.com'
puts "Browser loaded"
end
def teardown
$b.close
$headless.destroy
end
def test_that_page_is_google
assert_equal "Google", $b.title
end
def test_something
assert ( $b.span(:id => 'gbqfsa').exists?), ">>Fail Google search button exists"
end
end
You'll see that "Browser loaded" is printed twice.
Any idea is welcome, thanks!