How to continue the intern test once timeout for l

2019-09-06 01:18发布

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);
                                }, []);
                            })

1条回答
贼婆χ
2楼-- · 2019-09-06 01:27

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.
})
查看更多
登录 后发表回答