I have a situation where the test needs to wait for a minute to execute. Tried below code but it doesn't work:
describe('/incidents/:incidentId/feedback', async function feedback() {
it('creates and update', async function updateIncident() {
// this works fine
});
// need to wait here for a minute before executing below test
it('check incident has no feedback', function checkFeedback(done){
setTimeout(function(){
const result = send({
user: 'Acme User',
url: `/incidents/${createdIncident.id}/feedback`,
method: 'get',
});
console.log(result);
expect(result.response.statusCode).to.equal(200);
expect(result.response.hasFeedback).to.equal(false);
done();
}, 1000*60*1);
});
});
Here, send()
returns Promise
. I tried with async await
but it didn't work.
How do I make test wait for a minute before executing ?