我正在使用Protractor和Jasmine进行e2e测试.我们的申请是在Angular.
我已经写定getPageTimeout: 500000,allScriptsTimeout: 600000在配置文件中.defaultTimeoutInterval:500000根据GitHub 添加.
即使这样,我也得到了以下异常.感谢任何帮助.
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
Run Code Online (Sandbox Code Playgroud)
Angular永远不会在您的应用中做好准备.您看到茉莉花超时而不是量角器超时的唯一原因是因为您将量角器超时限制增加到高于茉莉花超时限制.这可能是应用程序无限期轮询的问题,而不是您编写测试的问题.
来自https://github.com/angular/protractor/blob/master/docs/timeouts.md:
"在执行任何操作之前,Protractor要求Angular等待页面同步.这意味着所有超时和http请求都已完成.如果您的应用程序不断轮询$ timeout或$ http,它将永远不会被注册为完全加载.您应该将$ interval服务(interval.js)用于连续轮询的任何内容(在Angular 1.2rc3中引入)."