I have the following in my acceptance test:
assert.expect(1);
visit('/signup');
fillIn('#login-account-name', '123@342343.com');
fillIn('#login-username', '123-o');
fillIn('#login-account-password', 'super-hectic-password0921');
click('#login-register');
andThen(function() {
assert.equal(currentURL(), '/');
});
Now - it all seems to be going ok - I can see that the signup posts to my mock api and the session gets authenticated in ember-simple-auth - however the transition to ‘/’ never happens.
In my controller I have:
// i know LoginControllerMixin is being deprecated - i am planning that upgrade work for later
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';
export default Ember.Controller.extend(LoginControllerMixin, {
actions: {
authenticate: function() {
//do some basic validation on the inputs:
this._super()
.then(function() {
_this.transitionToRoute('index');
});
}
}
});
Now, my question is - is the test not waiting for a promise to return because my
authenticate
action doesn’t return anything?
Or am I missing something else? Should/can actions return promises?