要在应用程序中加载的URL数组。一旦页面加载,就会触发页面就绪事件。然而,当在sauce实验室上运行时,事件不会在随机页面上触发,测试也会失败。
如果事件没有触发,有什么方法可以继续测试吗?
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);
}, []);
})发布于 2015-08-01 04:35:51
您可以在executeAsync之后使用catch回调来处理错误,但是如果可以跳过ready事件,那么测试真的有必要吗?
您还应该返回在then回调中创建的任何命令链的结果,以确保异步链正常继续。否则,外部命令链将继续运行,而不等待executeAsync完成。
return remote.executeAsync(function (done) {
...
}).catch(function (error) {
// Do nothing here to consume the error, or rethrow it to have the test fail.
})https://stackoverflow.com/questions/31752452
复制相似问题