-
Notifications
You must be signed in to change notification settings - Fork 27.5k
$interval does not get flushed #11912
Comments
Try changing |
I will try this a bit later Plus I noticed that $timeout.flush not documented. |
I have tried $interval.flush(10000) when $interval waiting time is 5000 - it does not work for me |
Is there any progress or thoughts on this? |
The plunkr isn't including the ngMock module, which provides the decorated $interval service with a "flush" method. The ngMock services are intended for unit testing (to enable you to write fast, non-flaky, synchronous unit tests). Your application code should never be calling $interval.flush() itself, and I'm not sure protractor specs can trigger fake timeouts (though WebDriver may have some ability to do this, I wouldn't bet on it). @juliemr would know better about that. |
You have misunderstood me. I had issue with protractor with $timeout so i swithced to $interval witch is ignored by protractor and works as expected. But after switching to $interval i faced problem in my UI tests where I am testing controllers (ngMock included) and $interval.flush does not work there. Do you have any example in plunker with tests included ngMock to try it your self? |
Here is an example of tests using $interval.flush: https://github.com/angular/angular.js/blob/master/test/ngMock/angular-mocksSpec.js#L286 Does that help? |
Hmm I tried once more and now it seems working. Only thing I can think of is some Chrome's super cache when it was $timeout service injected in tests and $interval in code. But it is wired because i have tired it on 3 developers machines. Any way as far as it works the only issue left is protractor browser.wait + $timeout angular/protractor#169 (comment) p.s. thanks |
@vytautas-pranskunas- is this now resolved on the angular side? |
Yes, but it sad that angular/protractor#169 (comment) gets ignored. |
OK, could we take to the protractor, then? @vytautas-pranskunas- could you please open a new issue on the protractor side with the latest details / reproduce scenario? Thnx! |
Hello,
because of protractor some issues i switched from $timeout to $interval but there i have an issue - $interval does not get flushed.
I modified plunker code which was originally created for other purposes but there i cannot get interval flushed too. Can you look at it please?
Just go to: http://plnkr.co/edit/tBth2b?p=preview
to module.js and replace
to
press on button 'Increase shared value' and see that value gets increased after 5 seconds but not immediately. This is basically issue in my ui tests.
any ideas?
Thanks
The text was updated successfully, but these errors were encountered: