fixes for when browsers die

This commit is contained in:
John Bintz 2012-03-21 17:36:17 -04:00
parent 7afc799775
commit 63ffe14692
6 changed files with 21 additions and 3 deletions

View File

@ -19,6 +19,8 @@ Flowerbox =
started: false
done: false
xhrObjects: {}
onQueueStateChange: ->
queueRunner: (failsafe = 5) ->

View File

@ -63,7 +63,9 @@ module Flowerbox
begin
browser.close
rescue Errno::ECONNREFUSED => e
puts "Browser already closed."
puts "Browser already closed.".foreground(:yellow)
rescue ::Selenium::WebDriver::Error::UnknownError => e
puts "Unknown browser error, pushing past it to close...".foreground(:yellow)
end
end

View File

@ -48,7 +48,7 @@ module Flowerbox::Result
end
def first_local_stack
@first_local_stack ||= stack[1..-1].find do |line|
@first_local_stack ||= (stack[1..-1] || []).find do |line|
!system_files.any? { |file| line[%r{\(#{file}}] }
end || stack[1] || ''
end

View File

@ -78,6 +78,10 @@ module Flowerbox
end
@results
rescue ExecJS::RuntimeError => e
puts e.message.foreground(:red)
raise RunnerDiedError.new
end
def configured?

View File

@ -21,7 +21,16 @@ module Flowerbox
def run(sprockets, spec_files, options)
super do
browser.navigate.to "http://localhost:#{server.port}/"
navigate = Proc.new { browser.navigate.to "http://localhost:#{server.port}/" }
begin
navigate.call
rescue ::Selenium::WebDriver::Error::UnknownError => e
puts "Browser communication error, reopening all browsers...".foreground(:yellow)
Flowerbox.cleanup!
navigate.call
end
ensure_alive
end

View File

@ -3,6 +3,7 @@ require 'net/http'
require 'socket'
require 'rack/builder'
require 'thin'
require 'eventmachine'
module Flowerbox
class Server