File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,17 @@ def teardown
141141 super
142142
143143 # Clear the session and logout after each test.
144- ::Capybara . reset_sessions!
144+ begin
145+ ::Capybara . reset_sessions!
146+ rescue
147+ # Resetting may fail since it navigates away from the page, which may
148+ # trigger an extra `onbeforeunload` alert warning. Since this is not
149+ # automatically handled (due to `unhandled_prompt_behavior`), trigger
150+ # the internal mechanism to dismiss these unload alerts, and then try
151+ # resetting again.
152+ ::Capybara . current_session . driver . send ( :accept_unhandled_reset_alert )
153+ retry
154+ end
145155
146156 # Ensure the default driver is used again for future tests (for any
147157 # tests that may have changed the driver).
You can’t perform that action at this time.
0 commit comments