I have a scenario in which I need to call APIs during a Casper test. In order to call these APIs, I'm thinking of using then()
.
The problem is that Casper doesn't wait whatever I pass to then()
, even if I return a Promise like this:
casper.then(function() {
return new Promise(function(f, r) {
setTimeout(function() {
console.log('waited 10 secs');
f();
}, 10000)
});});
How can I make Casper wait inside the function I pass to then()
?