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
|
method_options :pwd => :string, :env_options => nil, :runners => :string, :runner => :string, :verbose_server => false
|
||||||
def test(dir = "spec/javascripts", *files)
|
def test(dir = "spec/javascripts", *files)
|
||||||
Dir.chdir(pwd) do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -110,6 +110,15 @@ module Flowerbox
|
|||||||
def run(dir, options = {})
|
def run(dir, options = {})
|
||||||
Flowerbox::Run::Test.execute(dir, options)
|
Flowerbox::Run::Test.execute(dir, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def browsers
|
||||||
|
@browsers ||= {}
|
||||||
|
end
|
||||||
|
|
||||||
|
def cleanup!
|
||||||
|
browsers.values.each(&:close)
|
||||||
|
@browsers = {}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -13,8 +13,7 @@ class Flowerbox::Runner::Chrome < Flowerbox::Runner::Selenium
|
|||||||
end
|
end
|
||||||
|
|
||||||
def browser
|
def browser
|
||||||
@browser ||= ::Selenium::WebDriver.for(:chrome)
|
Flowerbox.browsers[:chrome] ||= ::Selenium::WebDriver.for(:chrome)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ module Flowerbox
|
|||||||
end
|
end
|
||||||
|
|
||||||
def cleanup
|
def cleanup
|
||||||
@browser.close if @browser
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def browser
|
def browser
|
||||||
|
Loading…
Reference in New Issue
Block a user