keep browser windows open between runs, good for guard
This commit is contained in:
parent
8b36430ba9
commit
cc753a10fd
@ -8,7 +8,9 @@ class Flowerbox::CLI < Thor
|
||||
method_options :pwd => :string, :env_options => nil, :runners => :string, :runner => :string, :verbose_server => false
|
||||
def test(dir = "spec/javascripts", *files)
|
||||
Dir.chdir(pwd) do
|
||||
exit Flowerbox.run(dir, options.dup.merge(:files => files))
|
||||
result = Flowerbox.run(dir, options.dup.merge(:files => files))
|
||||
Flowerbox.cleanup!
|
||||
exit result
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -110,6 +110,15 @@ module Flowerbox
|
||||
def run(dir, options = {})
|
||||
Flowerbox::Run::Test.execute(dir, options)
|
||||
end
|
||||
|
||||
def browsers
|
||||
@browsers ||= {}
|
||||
end
|
||||
|
||||
def cleanup!
|
||||
browsers.values.each(&:close)
|
||||
@browsers = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -13,8 +13,7 @@ class Flowerbox::Runner::Chrome < Flowerbox::Runner::Selenium
|
||||
end
|
||||
|
||||
def browser
|
||||
@browser ||= ::Selenium::WebDriver.for(:chrome)
|
||||
Flowerbox.browsers[:chrome] ||= ::Selenium::WebDriver.for(:chrome)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -12,7 +12,6 @@ module Flowerbox
|
||||
end
|
||||
|
||||
def cleanup
|
||||
@browser.close if @browser
|
||||
end
|
||||
|
||||
def browser
|
||||
|
Loading…
Reference in New Issue
Block a user