This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Polling with $timeout prevents scenario step from completing #2402
Labels
Comments
+1 |
My workaround was to create an 'interval' service that I can disable using a query parameter when the application loads:
It's actually kind of nice to have this wrapped in a service, instead of having the polling setup mixed in with other code. 'environment' is just a 'constant' (in angular terms) that I have for global config. I do this in a run block at startup:
when I call browseTo to start a scenario, I add |
Closed
2 tasks
@pa3zo6 you could find some ideas in this commit lucassus/angular-coffee-seed@445f55c |
juliemr
added a commit
to juliemr/angular.js
that referenced
this issue
Oct 7, 2013
The $interval service simplifies creating and testing recurring tasks. This service does not increment $browser's outstanding request count, which means that scenario tests and Protractor tests will not timeout when a site uses a polling function registered by $interval. Provides a workaround for angular#2402. For unit tests, repeated tasks can be controlled using ngMock$interval's tick(), tickNext(), and tickAll() functions.
vojtajina
pushed a commit
to vojtajina/angular.js
that referenced
this issue
Oct 7, 2013
The $interval service simplifies creating and testing recurring tasks. This service does not increment $browser's outstanding request count, which means that scenario tests and Protractor tests will not timeout when a site uses a polling function registered by $interval. Provides a workaround for angular#2402. For unit tests, repeated tasks can be controlled using ngMock$interval's tick(), tickNext(), and tickAll() functions.
Should be fixed by $interval service |
jamesdaily
pushed a commit
to jamesdaily/angular.js
that referenced
this issue
Jan 27, 2014
The $interval service simplifies creating and testing recurring tasks. This service does not increment $browser's outstanding request count, which means that scenario tests and Protractor tests will not timeout when a site uses a polling function registered by $interval. Provides a workaround for angular#2402. For unit tests, repeated tasks can be controlled using ngMock$interval's tick(), tickNext(), and tickAll() functions.
jamesdaily
pushed a commit
to jamesdaily/angular.js
that referenced
this issue
Jan 27, 2014
The $interval service simplifies creating and testing recurring tasks. This service does not increment $browser's outstanding request count, which means that scenario tests and Protractor tests will not timeout when a site uses a polling function registered by $interval. Provides a workaround for angular#2402. For unit tests, repeated tasks can be controlled using ngMock$interval's tick(), tickNext(), and tickAll() functions.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If you use $timeout to perform any operation on a set interval in your application, then the 'browseTo' step never completes.
Minimal demonstration here:
http://plnkr.co/edit/iW3dHM?p=preview
Note that the test application is not hung in the scenario runner iframe, it's just that browseTo never completes.
Problem seems to be with the way that the scenario runner tries to make sure that all async operations are complete before advancing to the next step. outstandingRequestCount never decrements to zero because the $timeout callback reschedules itself.
The text was updated successfully, but these errors were encountered: