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 started: false
done: false done: false
xhrObjects: {}
onQueueStateChange: -> onQueueStateChange: ->
queueRunner: (failsafe = 5) -> queueRunner: (failsafe = 5) ->

View File

@ -63,7 +63,9 @@ module Flowerbox
begin begin
browser.close browser.close
rescue Errno::ECONNREFUSED => e 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
end end

View File

@ -48,7 +48,7 @@ module Flowerbox::Result
end end
def first_local_stack 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}}] } !system_files.any? { |file| line[%r{\(#{file}}] }
end || stack[1] || '' end || stack[1] || ''
end end

View File

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

View File

@ -21,7 +21,16 @@ module Flowerbox
def run(sprockets, spec_files, options) def run(sprockets, spec_files, options)
super do 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 ensure_alive
end end

View File

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