wonderful-match-15836
07/16/2021, 7:59 PMCypress.Commands.add('interceptApi', (endpoint, fixturePath, statusCode = 200) => {
cy.intercept(INTERCEPT_API_URL + endpoint, {
statusCode,
fixture: `/${fixturePath}.json`,
}).as(fixturePath);
});
And we do stuff like cy.interceptApi('/yourEndpoint', 'lil-fixture-path/500-error', 500); then make our assertions.