I just got this type of Alert and have no idea how to handle it with Cypress
Basically, I thought that from the documentation, cypress will automatically accept the alert but turned out the cypress window is stuck when alert appeared
I have tried with some solutions that I read online but none of them help. Like this one below
cy.on('window:confirm', str => {
expect(str).to.eq('do you swear you are a legitimate user and intend to act honestly?')
})
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.
it('interceptorTrigger', () => {
cy.visit('http://localhost:9009/?path=/story/loginwithemail--interceptortrigger')
cy.getIframe('#storybook-preview-iframe')
.find('button')
.click()
cy.on('window:confirm', str => {
// expect(str).to.eq('do you swear you are a legitimate user and intend to act honestly?')
})
cy.wait(2000)
cy.log('done')
})
