Cypress · Middle · Question 6 of 77

How do you assert on the response of an intercepted request?

cy.wait("@saveOrder").its("response.statusCode").should("eq", 201);
Show the answer

Correct answer: Wait on the alias and check properties of the interception

Explanation

cy.wait('@alias') yields an object with request and response, so body, headers and status can all be asserted.

Further reading

Problem with a question

Cypress · Middle · question 6

Test yourself

Take the Cypress · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz