量角器,茉莉花超时问题 [英] Protractor ,Jasmine timeout issue

查看:49
本文介绍了量角器,茉莉花超时问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Protractor 和 Jasmine 进行 e2e 测试.我们的应用程序使用 Angular.

I'm doing e2e-testing with Protractor and Jasmine. Our application is in Angular.

我在配置文件中写了给定的 getPageTimeout: 500000, allScriptsTimeout: 600000.根据 GitHub 添加 defaultTimeoutInterval:500000.

I have written given getPageTimeout: 500000, allScriptsTimeout: 600000, in the config file. Added defaultTimeoutInterval:500000 as per GitHub .

即便如此,我还是遇到了以下异常.感谢您的帮助.

Even then I'm getting the below exception. Appreciate any help.

A Jasmine spec timed out. Resetting the WebDriver Control Flow.
The last active task was:
Protractor.waitForAngular()
at [object Object].webdriver.WebDriver.schedule (C:\Users\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:345:15)
at [object Object].Protractor.executeAsyncScript_ (C:\Users\AppData\Roaming\npm\node_modules\protractor\lib\protractor.js:1141:26)
at [object Object].Protractor.waitForAngular (C:\Users\AppData\Roaming\npm\node_modules\protractor\lib\protractor.js:1159:15)
at [object Object].getWebElements (C:\Users\AppData\Roaming\npm\node_modules\protractor\lib\protractor.js:191:21)
at [object Object].getWebElements 

推荐答案

Angular 永远不会在您的应用中准备就绪.您看到 jasmine 超时而不是量角器超时的唯一原因是因为您将量角器超时限制增加到高于 jasmine 超时限制.这可能是应用程序无限期轮询的问题,而不是您编写测试的方式的问题.

Angular is never becoming ready in your app. The only reason why you're seeing jasmine timeout instead of protractor timeouts is because you increased your protractor timeout limit to be higher than your jasmine timeout limit. This is likely a problem with the app polling indefinitely, rather than a problem with how you're writing your test.

来自 https://github.com/angular/protractor/blob/master/docs/超时.md:

"在执行任何操作之前,Protractor 会要求 Angular 等待页面同步.这意味着所有超时和 http 请求都已完成.如果您的应用程序不断轮询 $timeout 或 $http,它将永远不会注册为完全加载. 您应该将 $interval 服务 (interval.js) 用于任何持续轮询的内容(在 Angular 1.2rc3 中引入)."

"Before performing any action, Protractor asks Angular to wait until the page is synchronized. This means that all timeouts and http requests are finished. If your application continuously polls $timeout or $http, it will never be registered as completely loaded. You should use the $interval service (interval.js) for anything that polls continuously (introduced in Angular 1.2rc3)."

这篇关于量角器,茉莉花超时问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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