What is the best solution for polling response until value in response change from 'WAITING' to 'RUNNING'. So recursive function is not solution, because I don't want to send more than 1 request.
Cypress.Commands.add('createService', () => {
const query = '';
cy.request({
method: 'POST',
url: 'http://localhost:3000/create',
body: {
query
}
}).then((response){
//before RUNNING status is WAITING
expect(response.body.serviceStatus).to.eql('RUNNING');
});
});