I've set up some acceptance tests to for my login page but i'm running into an error that I'm finding hard to troubleshoot. The error only occurs when click() is in the test so I have a feeling it might have to do with the action somehow but I'm not sure where to begin looking. There is no issue when I log in to the web app in a browser.
The test that is causing the issue:
tests/acceptance/login-test.js
test('visiting /login', function(assert) {
visit('/companyname/login');
fillIn('input#signin-username', 'testuser');
fillIn('input#signin-password', '123456');
click('button.btn');
andThen(() => assert.equal(currentURL(), '/companyname/i/testuser'));
});
The error that I am getting:
actual: >
null
message: >
TypeError: 'undefined' is not an object (evaluating 'response.responseJSON.error')
Log: |
For sake of space, here's the bones of the login page:
app/login/template.hbs
{{input type="text" value=model.username id='signin-username'}}
{{input type="password" value=model.password id='signin-password'}}
<button {{action 'login' model}} type='submit' id='login-button' class="btn">
Sign in
</button>
app/login/route.js
export default Ember.Route.extend({
model: function(params) {
return {'slug': params.slug};
},
actions: {
login: function(credentials) {
this.get('session').login(credentials)
.then(bind(this, 'authenticationDidSucceed'),
bind(this, 'authenticationDidFail'));
}
},
...
});
Technologies used
qunit1.18.0phantom.js1.9ember1.13.8
Aucun commentaire:
Enregistrer un commentaire