Created
March 21, 2014 15:02
-
-
Save kucaahbe/9688195 to your computer and use it in GitHub Desktop.
BROKEN: cucumber with capybara: if scenario failed and left modal alert after self: accept it and prevent other scenarios failing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# features/support/capybara_ignore_alert_after_scenario.rb | |
# if scenario failed and left modal alert after self | |
# accept it and prevent other scenarios failing | |
After '@javascript' do |scenario| | |
if scenario.failed? | |
# exception for modal dialogs | |
# http://rdoc.info/gems/selenium-webdriver/Selenium/WebDriver/Error/UnhandledAlertError | |
if scenario.exception.instance_of?(Selenium::WebDriver::Error::UnhandledAlertError) | |
page.driver.browser.switch_to.alert.accept | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment