ember.js - Called stop() outside of a test context in Ember acceptance test -
i made first acceptance test ember cli. use ember mirage mock server.
test('create file', function(assert){ visit('/login'); fillin('input[name=username]', 'joe'); fillin('input[name=password]', 'foo'); click('button'); andthen(function() { visit('/projects/files'); }); andthen(function(){ assert.ok(true); }) });
the test runs successfully, hangs, , getting following error
uncaught (in promise) error: called stop() outside of test context
at object.stop (http://localhost:4200/assets/test-support.js:2469:10) @ class.asyncstart (http://localhost:4200/assets/vendor.js:49507:13) @ asyncstart (http://localhost:4200/assets/vendor.js:41446:44) @ object.async (http://localhost:4200/assets/vendor.js:41460:7) @ fulfill (http://localhost:4200/assets/vendor.js:61624:26) @ handlemaybethenable (http://localhost:4200/assets/vendor.js:61584:9) @ resolve (http://localhost:4200/assets/vendor.js:61597:7) @ sealed (http://localhost:4200/assets/vendor.js:61536:11)
ajax service
i use ajax service, makes calls custom api endpoints. can see uses standard jsonapiserializer. still problem ? existing app, , there no easy way turn off service, test without it.
export default ember.service.extend({ // http://stackoverflow.com/questions/9705773/non-crud-actions-with-ember-data call: function(method, type, id, action, hash = null){ var owner = ember.getowner(this); var adapter = owner.lookup('adapter:application'); var url = adapter.buildurl(type, id) + '/' + action; if (hash) { hash.data = $.extend({}, hash); } return adapter.ajax(url, method, hash); } });
edit 1
i have changed test + turned on env.app.log_transitions_internal , env.app.log_transitions see better whats going on:
$.velocity.mock = true var done = assert.async(); visit('/login'); fillin('input[name=username]', 'joe'); fillin('input[name=password]', 'foo'); click('button'); andthen(function() { visit('/projects/files/new/overview'); settimeout(function() { assert.equal( find('.btn-primary').length, 2,"button found" ); done(); }, 20000); });
it looks login works fine,
transition #2: projects.files.new.overview.index: calling deserialize hook ember.debug.js:51061 transition #2: projects.files.new.overview.index: calling aftermodel hook ember.debug.js:51061 transition #2: resolved models on destination route; finalizing transition. ember.debug.js:6520 generated -> controller:projects object {fullname: "controller:projects"}
tells me, transition ok, , can see new page in qunit's container.
sometimes receive
uncaught error: assertion failed: have turned on testing mode, disabled run-loop's autorun. need wrap code asynchronous side-effects in run
Comments
Post a Comment