I have a test where a certain fetch request is happening around 70 times and at the end of the test I need to check that all the status codes were 200
or 204
. So far I am intercepting the request and can check the response.statusCode
for that 1 request but I'm having trouble doing it for the rest. Here is what I have so far.
it('Testing', function () {
cy.intercept('proxy/test*').as('test')
cy.visit('/user/test');
const aliases = [];
for (let i = 1; i <= 70; i++){
aliases.push('@test')
}
.............
.............
cy.wait(aliases).its('response.statusCode').should('eq', 200 || 204)
The error I am getting is
Timed out retrying after 4000ms: cy.its() errored because the property: response does not exist on your subject.
cy.its() waited for the specified property response to exist, but it never did.
Can anyone help with this?