in ember-cli
ember g test-helper sign-in
test("I can program a computer", function(){
visit('/login');
andThen(function(){
fillIn('#email-address', 'tony@starkindustries.com');
fillIn('#password', 'i<3ultron');
click('#log-in');
});
andThen(function(){
visit('/programming');
});
andThen(function(){
equal($('#jarvis').text(), 'Greetings, Mr. Stark');
});
});
test("I can fly an iron suit", function(){
visit('/login');
andThen(function(){
fillIn('#email-address', 'tony@starkindustries.com');
fillIn('#password', 'i<3ultron');
click('#log-in');
});
andThen(function(){
click('#suit-up');
});
andThen(function(){
equal($('#iron-man').text(), 'Stark');
});
});
ember g test-helper sign-in
test("I can program a computer", function(){
signIn();
andThen(function(){
visit('/programming');
});
andThen(function(){
equal($('#jarvis').text(), 'Greetings, Mr. Stark');
});
});
test("I can fly an iron suit", function(){
signIn();
andThen(function(){
click('#suit-up');
});
andThen(function(){
equal($('#iron-man').text(), 'Stark');
});
});
import Ember from 'ember';
export default Ember.Test.registerAsyncHelper('signIn',
function(app) {
}
);
ember g test-helper sign-in
import Ember from 'ember';
export default Ember.Test.registerAsyncHelper('signIn',
function(app) {
visit('/login');
andThen(function(){
fillIn('#email-address', 'tony@starkindustries.com');
fillIn('#password', 'i<3ultron');
click('#log-in');
});
}
);
import Ember from 'ember';
export default Ember.Test.registerAsyncHelper('signIn',
function(app, username, password) {
visit('/login');
andThen(function(){
fillIn('#email-address', username);
fillIn('#password', password);
click('#log-in');
});
}
);
signIn('tony@starkindustries.com', 'i<3ultron')
//start-app.js
import signIn from './sign-in';
//tests/.jshintrc
{
predef: [
'signIn',
...
]
}