I am copying code from the Cypress docs and have returned this error
cy.intercept is not a function
My code is straight from the docs...
describe('My First Test', () => {
it('Visit Home Page', () => {
cy.intercept('search/*', [{ item: 'Book 1' }, { item: 'Book 2' }]).as('getSearch')
}
})
Not sure why this would happen?
See intercept - history, the functionality has been available since Cypress v5.1.0, it was just called cy.route2()
(in case you did not want to upgrade).
Version Changes
6.0.0 Renamed cy.route2() to cy.intercept().
6.0.0 Removed experimentalNetworkStubbing option and made it the default behavior.
5.1.0 Added experimental cy.route2() command under experimentalNetworkStubbing option.
But if you remain at v5.3.0, you will have to add
"experimentalNetworkStubbing": true
to cypress.json.
Version 7.0.0
Release notes say
cy.route2() was previously aliased to cy.intercept(). Now the alias cy.route2() has been removed. Please update usage of cy.route2() to cy.intercept()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With