Understanding the Selenium error "Modal Dialog Present"
So your Cucumber feature sometimes dies with this exception:
Modal Dialog Present (Selenium::WebDriver::Error::UnhandledAlertError)
As a seasoned Selenium vetaran you are used to misleading error messages. Hence you might be surprised that the reason for this particular error is that there is actually a modal dialog present and preventing Selenium from executing commands like
How your code triggers this issue
The reason why a dialog is shown is somewhat fucked up. It often happens like this:
How to solve this
Make sure your AJAX requests always finish before your scenario ends. The best way is to observe some side effect of your AJAX call within your scenario, so you know it has finished.
If there is no side effect to observe, change your code so there is one as described in Waiting for page loads and AJAX requests to finish with Capybara.
Many Bothans died to bring you this card.