You can use sinon.useFakeTimers in an acceptance test, or you can use run.later in your application, but doing both causes the acceptance test to time out.
Reproduction: https://ember-twiddle.com/d5f34d97be1e75b8258e654f6a482d70?openFiles=tests.acceptance.my-acceptance-test.js%2C
I think the issue is in Backburner.
I think the problem is that sinon.useFakeTimers() is modifying the environment (the timers of the VM JS, as kind-of-everything depends on setTimeout).
You can put a lot of clock.tick(0); to let run the normal async mechanisms of the acceptance utilities (like visit(xx), andThen, etc).
p.s.: I've fixed your twiddle hard-coding a little bit https://ember-twiddle.com/d5f34d97be1e75b8258e654f6a482d70?openFiles=tests.acceptance.my-acceptance-test.js%2C
p.s.2: I've fixed your twiddle, taking out the 'Date' parameter in sinon.useFakeTimers() https://ember-twiddle.com/f2c762d2bdcb25e7329827bf92c91c68?openFiles=tests.acceptance.my-acceptance-test.js%2C
believe this has been addressed: https://github.com/ebryn/backburner.js/pull/179 (although that was merged yesterday) and it still needs to make its way into ember.
@morhook Not putting a Date in sinon.useFakeTimers() kind of defeats the point, the use case is so that Date.now() returns a predictable value, allowing acceptance tests that use the Date to pass regardless of what date it is.
@stefanpenner so does this need a PR for the Backburner update?
@pixelhandler I'd be happy to make a follow-up PR in Ember if necessary.
@Gaurav0 sounds fair! Thanks for explaining it to me.
Discussed with @turbo87 and we believe this is resolved.
yes, https://github.com/BackburnerJS/backburner.js/pull/179/files resolved it and has found its way into one of the recent Ember releases, though I can't say which one specifically fixed it.
Just fyi for anyone running into this problem, it looks like the Backburner fix is not included in Ember 2.14. It looks like it is shipping in 2.15.
Most helpful comment
Just fyi for anyone running into this problem, it looks like the Backburner fix is not included in Ember 2.14. It looks like it is shipping in 2.15.