Untitled

mail@pastecode.io avatar
unknown
javascript
a year ago
536 B
4
Indexable
function checkInbox(mailinator,inbox,retries=0){
            if(retries != 5){
                mailinator.getInbox(inbox).then((inboxResponse) => {
                    if(inboxResponse.body.msgs.length == 0){
                        cy.wait(2000)
                        checkInbox(mailinator,inbox,retries+=1);
                    } else {
                        return Promise.resolve()
                    }
                })
            } else {
                return Promise.reject(new Error('fail'))
            }    
        }
Leave a Comment