lib/superbot/capybara/runner.rb in superbot-0.1.4.rc1 vs lib/superbot/capybara/runner.rb in superbot-0.1.4.rc2

- old
+ new

@@ -12,14 +12,10 @@ def run(script) create_runner runner.in.writeln({ eval: script }.to_json) end - def rerun(script) - runner.in.writeln({ eval: script }.to_json) - end - def kill_session runner&.kill rescue Timeout::Error p # do nothing ensure @@ -46,10 +42,11 @@ runner.out.every(/{"type":"error".*\n/) do parsed_error = JSON.parse(runner.out.lines.last, symbolize_names: true) puts "Test failed: #{parsed_error[:message]}" @finished = true - if parsed_error[:class].start_with?('Selenium::WebDriver::Error') + + if parsed_error[:class].match?(/Selenium::WebDriver::Error::(WebDriverError|NoSuchWindowError)/) kill_session puts "", "ERROR: Seems like browser session has been closed, try to run test again to create new session" end end