Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor ,Jasmine timeout issue

Tags:

protractor

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

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 
like image 493
mrr Avatar asked Jan 15 '15 20:01

mrr


People also ask

How do you fix a timeout error in protractor?

In order to modify this behavior to handle timeouts in Protractor Selenium, you need to add allScriptsTimeout (timeout in millis) to the protractor configuration file and this will reflect the change in timeout globally.

How do you avoid timeout in protractor?

Add allScriptsTimeout: 1100000 to avoid script timeout if scripts are too long.

What is the default timeout in Jasmine for an async test?

It ensures that the test process doesn't get stuck if something goes wrong. By default, the timeout is 10 seconds, which means that a single test should not take longer than that.


1 Answers

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.

From https://github.com/angular/protractor/blob/master/docs/timeouts.md:

"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)."

like image 176
hankduan Avatar answered Sep 21 '22 14:09

hankduan