-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle alert
and confirm
better
#621
Comments
This is how they'll appear. This is how the confirm event can be controlled: it "can turn on and off confirmation", ->
cy.on "window:confirm", (str) ->
switch str
when "foo" then false
when "bar" then true
when "baz" then undefined
cy.window().then (win) ->
confirmedFoo = win.confirm("foo")
expect(confirmedFoo).to.be.false
confirmedBar = win.confirm("bar")
expect(confirmedBar).to.be.true
## undefined is not strictly false
## so the confirmation should be true
confirmedBaz = win.confirm("baz")
expect(confirmedBaz).to.be.true |
The code for this is done, but has yet to be released. We'll update this issue and reference the changelog when it's released. |
Fixed in |
I realise that confirms originating from an iframe will appear, but is there a way to handle and dismiss them from a test? |
If it is a prompt box Cypress will not automatically accept it. |
Any news about how to working on with a prompt box ? Cypress still not automatically accept it. |
@FabiGomes Yes there are examples here: cypress-io/cypress-example-recipes#339 |
As it stands Cypress's current behavior is to auto accept
alert
andconfirm
.We should make the following changes:
Alerts
Confirms
return false
You'll now see and have control over these events.
The text was updated successfully, but these errors were encountered: