Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Dealing with very long running $timeout calls #1807

Closed
LoganBarnett opened this issue Feb 12, 2015 · 3 comments
Closed

Dealing with very long running $timeout calls #1807

LoganBarnett opened this issue Feb 12, 2015 · 3 comments

Comments

@LoganBarnett
Copy link

My app has a $timeout call that lasts about an hour and it's legit to use the app while this timeout is running. While my use case might be excessive, I don't think it's far fetched for other apps to have background timers waiting for a long period of time (even as much as 30 seconds would cause issues).

The only workaround I can see is doing browser.ignoreSynchronization = true; but that's not very civilized - in fact I found this out while trying to fix some other issues that are cleanly handled by synchronization.

Is there a known or preferred way I can mark a particular call and say "that $timeout over there, ignore it and sync anyways"?

Thanks for the awesome work all!

@tullmann
Copy link
Contributor

You can use $interval in Angular to get a similar effect to $timeout, without tripping up Protractor. See https://docs.angularjs.org/api/ng/service/$interval and #169 (comment)

@LoganBarnett
Copy link
Author

@tullmann Thanks! My team wound up deciding on having the $timeout call be shut off by a browser.driver.executeScript call. While both solutions are require changes to accommodate the test suite, the team's motivation is that keeping $timeout is less surprising given the intent, and the workaround as it manifests in the runtime code isn't centric to Protractor itself.

That said, if anyone wants to use $interval, it's about a 3 line change.

@wesleycho
Copy link

I noticed this issue, and I don't think this is a valid resolution - it does not make sense for all third party libraries to change their code to $interval usage due to this deficiency.

I just recently closed an issue in UI Bootstrap where a request was made to do this switch, but this should truly be handled by Protractor properly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants