一旦leadfoot / Session #cuteAsync调用超时达到

时间:2015-07-31 18:05:20

标签: javascript intern leadfoot

要在应用程序中加载一系列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);
                                }, []);
                            })

1 个答案:

答案 0 :(得分:0)

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?

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.
})