Open petarnikolovski opened 5 years ago
check if you have any pending timeouts or Intervalls in your app.
@MichaRedM sorry for late reponse. Yes, I have intervals and timeouts in my app, but all of those are set to no more than 1 second. All these should timeout. There is just one place where I'm resetting timeout/interval until window is resized. However, this error appeared before I introduced that change.
I have the same issue. See if the error goes if you set:
waitForAngularEnabled(false)
My question on stackoverflow: https://stackoverflow.com/questions/55107347/protractor-tests-wont-run-on-angular-4-site-without-waitforangularenabledfalse
Also seeing this...
Also seeing this...
waitForAngularEnabled(false)
will fix that but then we will need to manually set browser.sleep
.
So I think I figured it out. Basically any action on an element selected by By.css
or $
or $$
or whatever causes protractor to first wait for angular to stabilize by calling the waitForAngular
function.
This function is waiting for all pending http-queries and all unfinished timeouts and doesn't allow the script to proceed further if they are found.
So basically most of the time you can just user browser.sleep(3000)
most of the times, because the majority of timeouts happen in animations and such, and most of http-queries will be finished after 3 seconds.
However sometimes the timeouts will not be finished in 3 seconds: such as in cases of long polling or some features implementd using super-long timeouts. In our application we had the auto-logout feature implemented. After login, the service would check the expiration date of the JWT token and wait for (ExpirationDate-CurrentDate) before logging the user out. As you can imagine, it was a huge timeout, 36-hours timeout! After we removed it, everything worked like a charm.
Don't do that, implement these features differently. Search for all occurences of setTimeout
, setInterval
, timeout
, interval
in your code and deal with them.
Same problem on my end.
allScriptsTimeout: 11000
in you config fails you tests after 11 sec.
If anyone still looking for the answer, I've found this article as a solution: https://christianliebel.com/2016/11/angular-2-protractor-timeout-heres-fix/
In short: add your setInterval / setTimeout
inside this.ngZone.runOutsideAngular
and the problem should be gone
Bug report
Hi, I have a simple tests, that switches between tabs (made with angular/material). It clicks on a tab, checks a certain condition, and then it switches back and checks again. This test worked OK until recently, it just stopped working. I didn't make any drastic changes except adding d3 to my project (test stopped working when I've made an innocuous commit that calculates pie chart arc coordinates in one of my components).
I've tried setting higher timeout values in
beforeEach
, and inallScriptsTimeout
, and also inonPrepare
, but none of the methods worked (though it shows different error - timeout error). I've provided stack trace, if anyone can help me decipher what is the bug.Node Version:
10.14.2
Protractor Version:
5.3.1
Angular Version:
7.1.3
Browser(s):
Chrome/Chromium Headless
Operating System and Version
Ubuntu 16.04
Your protractor configuration file
N/A
N/A