Testing a redirect to a new route with Cypress
What you need to do is assert that the url is in the expected state.
There are many commands in Cypress that can be used to make assertions about the url. Specifically, cy.url()
, cy.location()
or cy.hash()
may meet your requirements. Probably the best example for your use case would be this:
cy.location('pathname').should('eq', '/newthing/:id')