You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
@mgiambalvo and I think that we have a more general way to fix this - testability.whenStable should always run $browser.notifyWhenNoOustandingRequests asynchronously. This should give http a chance to register all requests with the backend first. We're testing that out now.
I'm going to proceed with the PR Julie mentioned, but it's worth pointing out that Protractor already effectively runs $browser.notifyWhenNoOustandingRequests asynchronously, since it only calls this from webdriver calls. The attached fiddle doesn't represent a situation that Protractor would ever encounter, since Protractor would never be calling $browser.notifyWhenNoOustandingRequests synchronously from within your application. The example app in #1641 is problematic for the same reasons.
It is possible there exists a situation where Protractor calls whenStable() when there are no outstanding http requests and there's a callback on the asyncQueue that will initiate one. However, I haven't been able to find a way for that to occur in Angular 1.5.1.
Is your issue consistent, or intermittent? Also, can you describe your app in more detail? Are you using ui-router? If you could produce an example app that demonstrates the problem when using Protractor, that would be very helpful. However, a more detailed description of when you're seeing this problem would probably suffice.
I am having an issue where waitForAngular isn't waiting for $http requests in controllers.
browser.sleep
was used as an quick in-test fix initially.I was able to identify a possible cause within angular.js where $http requests were not registering themselves synchronously with the $browser service as an outstanding request which caused
$browser.notifyWhenNoOutstandingRequests
(viaangular.getTestability(el).whenStable(callback)
) to return immediately and not wait for requests.The change would be to register the $http request as an outstanding request immediately by moving that code from $httpBackend to $http.
In the project where I was having these issues this resolved them.
There is a pull request outstanding and would hope to get input from those on the protractor side as to whether this is an appropriate fix.
Should $http requests register as an outstanding request with the $browser service immediately?
This is the initial issue: angular/angular.js#13782
This is the pull request: angular/angular.js#13862
This is a fiddle showcasing that $http isn't registering synchronously: http://jsfiddle.net/awtwff3x/
Please ask questions if more explanation is needed; either here or on the pull request itself.
Thanks for your time.
The text was updated successfully, but these errors were encountered: