Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Question about Modal dialog #795

Closed
nritholtz opened this issue Jun 14, 2015 · 3 comments
Closed

Question about Modal dialog #795

nritholtz opened this issue Jun 14, 2015 · 3 comments

Comments

@nritholtz
Copy link
Contributor

Quick question about the current implementation of the Modal dialog API.

I noticed in the commit for the feature, it mentions Confirm dialogs are accepted by default; dialogs are dismissed. So, when someone adds an accept_confirm for an action, does it override this action of the dialog being accepted by default?

The only reason I ask is that I have a test case scenario (unfortunately cannot post due to proprietary) which prompts a confirm dialog, which is failing intermittently with a Timed out waiting for modal dialog (Capybara::ModalNotFound). I noticed from the failed screenshot, that dialog has already been confirmed. Is it possible that the dialog was already accepted by default before the accept_confirm was called to evaluate the dialog?

@mhoran
Copy link
Collaborator

mhoran commented Jun 14, 2015

accept_confirm and friends change this default behavior. This is the default behavior because it was so before the modal API was introduced in Capybara. To maintain backwards compatibility, the old behavior remains in place but can be overridden with the new API.

It probably makes sense to behave more like the other drivers in the next major bump. However, for now, backwards compatibility is more important. Removing this behavior actually simplifies the implementation a bit, so I'm looking forward to ripping it out. When it's removed, you'll get some error stating an unexpected modal was encountered, like other drivers.

@nritholtz
Copy link
Contributor Author

Great, thanks for the explanation!

I will see if I can narrow down the cause of these intermittent issues I'm getting.

@mhoran
Copy link
Collaborator

mhoran commented Jun 28, 2015

I pushed up a commit to #801 which will change this default behavior and bring us in line with Selenium.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants