Here is my code snippet:
verifyBookingSuccess(){
cy.findByTitle(/created/i).parent().parent().then(async($ele)=>{
bookingId= ($ele.attr("href").split("/"))[2]
cy.log("Booking ID:"+bookingId)
})
return bookingId;
}
I can able to read the bookingId value inside the then() method. But Outside am unable to access it. Is there any way to access that bookingId value?