I am running tests for a Rails app with Capybara, Cucumber and Selenium Webdriver (Ruby). I have a question: why Capybara doesn't close browser when Net::ReadTimeout happens even I had a hook which asked browser to quit after each test scenario? How can I force it to close the browser when Net::ReadTimeout occurs?
This is my hooks.rb
after do |scenario|
if scenario.failed?
page.driver.browser.save_screenshot("#{scenario.__id__}.png")
end
Capybara.current_session.driver.browser.manage.delete_all_cookies
Capybara.current_session.driver.quit
end