1

I have an older Ember-cli app that I've just updated to all the latest dependencies and file formats, I've run ember init with ember-cli@0.2.0-beta.1, but when I try to write an acceptance test with the visit() helper, the internal wait function never resolves.

The furthest I've been able to trace the problem is into the wait function in the bower_components/ember/ember.js file, at the line if (run.hasScheduledTimers() || run.currentRunLoop) { return; }

There is a timer on backburner, but time and time again, the loop returns here, and it never seems to have a chance to clear the timer.

I'm pretty sure the timer is supposed to make sure the wait helper waits after an ajax request, but the ajax request has long since resolved. Heck, if there were still pending requests, we would have exited this function.

Any insights into this process would be greatly appreciated!!

DanF
  • 589
  • 4
  • 23
  • I am using an Ember.run.later() in my application, which looks like I may be duplicating this issue: http://discuss.emberjs.com/t/proper-way-to-handler-timers-w-ember-testing/4693/2 – DanF Feb 19 '15 at 20:27

1 Answers1

4

I had an instance of Em.run.later in my application in a loop, to recursively check for timeouts. This is not uncommon, it turns out!

My solution was to put the run.later block in a conditional check for the current environment, and disable it in testing.

DanF
  • 589
  • 4
  • 23
  • disable as in you are removing app features in test env or do you mean you're having the feature work via a different method in the test env? @DanF – SupaIrish Mar 25 '15 at 01:17
  • Yeah, I removed the timeout feature of the application when in test mode. I confess this probably won't work in every scenario, but I've come up with some other fixes for those scenarios. If you have a situation where you need to keep a promise live, post a link here I'll share solutions. – DanF Mar 25 '15 at 23:06