【问题标题】:How to continue the intern test once timeout for leadfoot/Session#executeAsync calls has reached一旦leadfoot/Session#executeAsync调用超时,如何继续实习测试
【发布时间】:2015-07-31 18:05:20
【问题描述】:

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

【问题讨论】:

    标签: javascript intern leadfoot


    【解决方案1】:

    你可以在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.
    })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-30
      • 1970-01-01
      • 1970-01-01
      • 2013-12-23
      • 1970-01-01
      相关资源
      最近更新 更多