-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
issue testing page with moment-from-now #80
Comments
Ember.run.cancel to cancel anything outstanding on the run loop queue. It's something you want to get into the habit with testing. |
@jasonmit Perhaps I misunderstood you, or you misunderstood me... test: function() {
visit("/pending-users");
andThen(function() {
assert(...page contains what is expected...);
}
} Where would I place the cancel? The only place that makes sense is between the |
@Iftahh sorry, I do think I misunderstood. Is your project public so I can step through this? @stefanpenner have anything better in mind than replacing the Ember.run.later with setTimeout + Ember.run? |
@jasonmit seems like the timer should be canceled in |
👍 will fix shortly |
that wont help the above issue, as the timerwaiters in the test helpers are not granular enough. The solution in ember will land shortly have async/await is supported in jshint, which will revamp the test helpers. Long story, upside @teddyzeenny and myself spike it was ember conf, it was wonderful and glorious but was blocked on tooling (just jshint) support, and stage 2 TC39 support. In the interim: you should work-around this, by doing both: #80 (comment) and the suggested raw setTimeout + Ember.run trick, which wont insert a test waiter, like run.later will. |
Thank you @jasonmit and @stefanpenner for your quick responses and fix ! @jasonmit my code isn't open source but you should be able to reproduce it very easily - |
3.5.1 published, take it for a spin and report if this issue persists. P.S., I only fixed this because of your avatar photo. |
Thanks @jasonmit |
My acceptance tests stopped working in pages where I added the
moment-from-now
with an interval.The tests start with
visit
to a url, followed byandThen
containing the asserts.Unfortunately the tests fail with a timeout and the
andThen
isn't called.I'm guessing the problem is the endless
Ember.runLater
that the testing framework waiting for all the jobs queue to empty before activating the nextandThen
.Without passing an interval to the moment-from-now the tests work as expected.
This issue isn't specific to ember-moment. It was reported to Ember since 2013 and still is open - see emberjs/ember.js#3008
@teddyzeenny provided a workaround in that thread, ie. instead of
runLater
use:setTimeout(function() { Em.run(function() { //.. code here } });
The text was updated successfully, but these errors were encountered: