javascript - Ember Error while testing: You will need to wrap any code with asynchronous side-effects in a run -
we have app working working add test cases purpose of ci.
we have small code tries login process , checking happens after possible login states success, failure, invalid account account locked etc.
so tried follwing code.
visit('/login') .fillin('#identification', "testuser") .fillin('#password', "testpass") .click('input[type="submit"]') andthen(function(){ ok(!exists('button:contains(sign in)'), '3. login button not displayed when authenticated'); ok(exists('.dropdownmenuoptions li:contains(logout)'), '4. logout button displayed when authenticated'); });
and gives following error in console.
ember.debug.js:5162 uncaught error: assertion failed: have turned on testing mode, disabled run-loop's autorun. need wrap code asynchronous side-effects in run
this error occurs after click performed. click makes ajax call server , on response route transition made.
for case of successful login, want check if route changed /login
/
not able because of error.
please suggest.
thanks
in controller/component handles form submit must doing set (example)
save: function() { this.get('model').set('name', 'foo'); }
if work done in run loop (async) after ajax event sure wrap w/ ember run so
save: function() { ember.run(function() { this.get('model').set('name', 'foo'); }); }
Comments
Post a Comment