[英]How to continue the intern test once timeout for leadfoot/Session#executeAsync calls has reached
在应用程序中有许多URL要加载。 页面加载后将触发页面就绪事件。 但是,在调味酱实验室运行时,该事件不会在随机页面上触发,并且测试失败。
如果事件未触发,是否可以继续测试?
return remote.get(url)
.setExecuteAsyncTimeout(20000)
.then(function() {
var pageLoadEvent = conf.get("pageLoadEvent");
console.log("waiting for " + pageLoadEvent + " event to occur");
remote.executeAsync(function(done) {
window.addEventListener(pageLoadEvent, function() {
done();
}, false);
}, []);
})
您可以在executeAsync
之后使用catch
回调来消耗该错误,尽管如果可以跳过ready事件,则实际上是否有必要进行测试?
您还应该返回在then
回调中创建的所有Command链的结果,以确保异步链正确继续。 否则,外部Command链将继续运行,而无需等待executeAsync
完成。
return remote.executeAsync(function (done) {
...
}).catch(function (error) {
// Do nothing here to consume the error, or rethrow it to have the test fail.
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.