失败:超时等待异步Angular任务在11秒后完成 [英] Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds

查看:118
本文介绍了失败:超时等待异步Angular任务在11秒后完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Protractor对我们的角度2应用程序进行端到端测试,但我坚持使用以下消息:

I would like to end-to-end test our angular 2 application using Protractor, but I'm stuck with the message:

"Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds."

我的conf文件。

exports.config = {
  directConnect: true,
  specs: ['spec.js'],

  // For angular2 tests
  useAllAngular2AppRoots: true,
}

Chrome已打开,网站也已打开,然后在超时之前没有任何事情发生。

Chrome is opened, and the website is also opened, then nothing happens till the the timeout.

当禁用同步时(使用browser.ignoreSynchronization = true;),没关系。但我失去了自动等待功能,这是使用量角器的主要优势之一。

When disabling the synchronisation (using browser.ignoreSynchronization = true; ), it's OK. But I'm loosing the "automatic waiting" feature, one of the main advantages of using Protractor.

应用程序完全基于角度2.所以为什么这不是工作?

The application is fully based on angular 2. So why this does not work?

我们的开发人员告诉我,我们没有轮询(根据量角器文档)。
顺便说一下,我们正在使用websocket架构。我不知道是否有链接。

Our developers told me that we are not polling (one of the possible cause according Protractor documentation). By the way, we are using websocket architecture. I don't know if there's a link.

实际上,我根本不知道如何解决这个问题。

Actually, I don't know how to troubleshoot this issue at all.

有人可以帮忙吗?

推荐答案

你的猜测是正确的。当他们在angular2应用程序中运行任何未完成的任务时会发生此错误。

Your guess is right. This error would occur when their are any outstanding tasks running in your angular2 application.

是的,最常见的原因是当应用程序连续轮询$ timeout或$ http时,Protractor将无限期地等待和超时。但这也可能发生在App占用时间超过11秒的情况下

Yes, the most common reason is when application continuously polls $timeout or $http, Protractor will wait indefinitely and time out. But this can also occur in scenarios where App takes more than 11 seconds

请参考这里有关不同超时的更多信息

Please refer here for more information on different timeouts

默认超时值为11秒。您可以通过调整 config.js 并尝试查看您是否仍然看到问题

the default timeout value is 11 seconds. You can change this by adjusting the below value in config.js and try and see if you are still seeing the issue

  /**
   * The timeout in milliseconds for each script run on the browser. This
   * should be longer than the maximum time your application needs to
   * stabilize between tasks.
   */
  allScriptsTimeout?: number;

这篇关于失败:超时等待异步Angular任务在11秒后完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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