I am using Cypress for testing my web application.
This snippet currently works and will submit a new thing:
describe('The Create Page', () => {
it('successfully creates a thing', () => {
cy.visit('/create')
cy.get('input[name=description]').type('Hello World')
cy.get('button#submit')
.click()
// After POST'ing this data via AJAX, the web app then
// receives the id of the new thing that was just created
// and redirects the user to /newthing/:id
// How do I test that this redirection worked?
})
})
As the comment illustrates, I am not sure how to test whether or not the redirection to the new route works. I can see it in the browser simulation that the redirect works, I just want to add a test for it.
Thanks!!!
Aucun commentaire:
Enregistrer un commentaire