I have a request that triggers another request that has a value needed later in the test.
I queued the code that uses the value, but still it is undefined. What an I doing wrong?
let val;
cy.request(api).then(response => {
return fetch(`url-${response.id}`).then(response2 => {
val = response2.id
})
})
cy.then(() => {
console.log('val', val) // undefined
})