lib/superbot/capybara/runner.rb in superbot-0.1.6 vs lib/superbot/capybara/runner.rb in superbot-0.1.7
- old
+ new
@@ -58,10 +58,14 @@
@test_result = "Test succeed!"
@finished = true
end
runner.out.every(/{"type":"error".*\n/) do
- parsed_error = JSON.parse(runner.out.lines.last, symbolize_names: true)
+ parsed_error = begin
+ JSON.parse(runner.out.lines.last, symbolize_names: true)
+ rescue JSON::ParseError
+ { message: runner.out.lines.last }
+ end
@test_result = "Test failed: #{parsed_error[:message]}"
@finished = true
case parsed_error[:class]
when "Selenium::WebDriver::Error::WebDriverError", "Selenium::WebDriver::Error::NoSuchWindowError"