testing javascript logo
    Loading

    Simulate HTTP Errors in Cypress Tests

    Normally I prefer to test error states using integration or unit tests, but there are some situations where it can be really useful to mock out a response to test a specific scenario in an E2E test. Let’s use the cypress server and route commands to mock a response from our registration request to test the error state.

    Transcript

    Simulate HTTP Errors in Cypress Tests

    module imageInstall, Configure, and Script Cypress for JavaScript Web Applications
    • 1.
      What's changed in Install, Configure, and Script Cypress for JavaScript Web Applications
    • 2.
      Intro to Install, Configure, and Script Cypress for JavaScript Web Applications
    • 3.
      Install and Run Cypress
    • 4.
      Write the First Cypress Test
    • 5.
      Configure Cypress in cypress.json
    • 6.
      Installing Cypress Testing Library
    • 7.
      Script Cypress for Local Development and Continuous Integration
    • 8.
      Debug a Test with Cypress
    • 9.
      Test User Registration with Cypress
    • 10.
      Cypress Driven Development
    • 11.
      Simulate HTTP Errors in Cypress Tests
    • 12.
      Test User Login with Cypress
    • 13.
      Create a User with cy.request from Cypress
    • 14.
      Keep Tests Isolated and Focused with Custom Cypress Commands
    • 15.
      Use Custom Cypress Command for Reusable Assertions
    • 16.
      Run Tests as an Authenticated User with Cypress
    • 17.
      Use cy.request from Cypress to Authenticate as a New User
    • 18.
      Use a Custom Cypress Command to Login as a User
    • 19.
      Combine Custom Cypress Commands into a Single Custom Command
    • 20.
      Install React DevTools with Cypress