一旦到达leadfoot/Session#executeAsync调用超时,如何继续进行内部测试 [英] How to continue the intern test once timeout for leadfoot/Session#executeAsync calls has reached

查看:117
本文介绍了一旦到达leadfoot/Session#executeAsync调用超时,如何继续进行内部测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序中要加载的URL数组.页面加载后将触发页面就绪事件.但是,在调味酱实验室中运行时,该事件不会在随机页面上触发,并且测试失败.

There are array of URLs to load within an application. A page ready event is fired once the page load. However, when running on sauce labs, the event does not fire on a random page and test fails.

如果事件未触发,是否有任何方法可以继续测试?

Is there any way to continue the tests if the event does not fire?

              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事件,那么实际上是否有必要测试?

You can use a catch callback after the executeAsync to consume the error, although if the ready event can be skipped, is it actually necessary to the test?

您还应该返回在then回调中创建的任何Command链的结果,以确保异步链正确继续.否则,外部Command链将继续运行而无需等待executeAsync完成.

You should also return the result of any Command chains created within a then callback to ensure the asynchronous chain continues properly. Otherwise, the outer Command chain will continue without waiting for the executeAsync to complete.

return remote.executeAsync(function (done) {
    ...
}).catch(function (error) {
    // Do nothing here to consume the error, or rethrow it to have the test fail.
})

这篇关于一旦到达leadfoot/Session#executeAsync调用超时,如何继续进行内部测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆