I have the following code:
let test="not-set";
cy.intercept(
{
url: '**/consumers/rx?extension=.jpg',
method:"POST"
},
(req) => {
req.on('response', (res) => {
// cy.log(res.body.rxId);
expect(res.body.rxId).not.to.be.null;
test = res.body.rxId;
// cy.wrap(res.body.rxId).as('rxId')
})
}
)
cy.log(test); // the value will be not-set
How could I save/use the value res.body.id in the follwing test steps