I am trying to automate a situation where I need to wait until in the response body I see the value Success. What I tried:
cy.server()
cy.route({
method: 'GET',
url: 'https://endpoint.com/api/readsomething'
auth: {
'username': username
'password': password
},
response: {}
}).as('checkStatus');
cy.wait('@checkStatus').then((ele) => {
expect(ele).should('have.property', 'response.body.latest_run.status', 'Success')
})
})
I am getting an error as: cy.wait() timed out waiting 5000ms for the 1st request to the route: checkStatus. No request ever occurred.
Would be great if you can let me know where I am doing wrong.