title: How to click Accept in window confirm with Cypress
body: <p>I just got this type of Alert and have no idea how to handle it with Cypress</p>
  
  <p><a href="https://i.stack.imgur.com/SVqbO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SVqbO.png" alt="please click here to view my alert"></a></p>
  
  <p>Basically, I thought that from the documentation, cypress will automatically accept the alert but turned out the cypress window is stuck when alert appeared</p>
  
  <p>I have tried with some solutions that I read online but none of them help. Like this one below </p>
  
  <pre><code>    cy.on('window:confirm', str =&gt; {
          expect(str).to.eq('do you swear you are a legitimate user and intend to act honestly?')
      })
  </code></pre>
  
  <p>as they said that if this one return true or doesn't return any thing, it would work. But in real situation, it is not.</p>
  
  <pre><code>    it('interceptorTrigger', () =&gt; {
          cy.visit('http://localhost:9009/?path=/story/loginwithemail--interceptortrigger')
          cy.getIframe('#storybook-preview-iframe')
              .find('button')
              .click()
          cy.on('window:confirm', str =&gt; {
              // expect(str).to.eq('do you swear you are a legitimate user and intend to act honestly?')
          })
          cy.wait(2000)
          cy.log('done')
      })
  </code></pre>