Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save unlocomqx/9b109639ee3e621dcfcc8aee6ab6b3d5 to your computer and use it in GitHub Desktop.

Select an option

Save unlocomqx/9b109639ee3e621dcfcc8aee6ab6b3d5 to your computer and use it in GitHub Desktop.
Testing a 404 page with Cypress
cy.visit('/404')
//=> Test fails
cy.visit('/404', {failOnStatusCode: false})
//=> Test passes but does not test the HTTP code was 404
cy.request({url: '/404', failOnStatusCode: false}).its('status').should('equal', 404)
cy.visit('/404', {failOnStatusCode: false})
//=> Test passes, tests that the HTTP code was 404, and tests page was visited
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment