Course lesson

Change a Response Body with cy.intercept to Provide Your Own Data in an API Call

With .intercept() command, we can change the response body. This enables us to provide our own response instead of the real one coming from server. We can then test our application’s behavior under different situations and test different edge cases.

Duration
1 min
Access
Included
Transcript
Retained from source evidence

With .intercept() command, we can change the response body. This enables us to provide our own response instead of the real one coming from server. We can then test our application’s behavior under different situations and test different edge cases.