We have added a new feature to our app for offline continuity, and I need the API requests not to return a value. There are a lot of tests and waiting for a disconnected API is not practical.
How can I simulate a disconnected network?
This is what I have so far, but it's not working
cy.intercept({
'GET',
'**/api/**/*'
}, (req) => {
throw 'Network failure'
})
.as('failed')
cy.visit('/')
cy.wait('@failed')
cy.get('[data-cy="Error message"]')
.should('be.visible')