As it stands Cypress's current behavior is to auto accept alert and confirm.
We should make the following changes:
return falseYou'll now see and have control over these events.
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 0.20.0
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: https://github.com/cypress-io/cypress-example-recipes/issues/339
Most helpful comment
Any news about how to working on with a prompt box ? Cypress still not automatically accept it.