(ish)
# doSomething.feature
Feature: Do something
    In order to feel good about myself
    As a human
    I want to do something
    Scenario: Do a thing
       When I do something
       Then I should feel good about myself# whenIDoSomething.js
this.When(/^I do something$/, function(done) {
    done.pending();
});
# thenIShouldFeelGoodAboutMyself.js
this.Then(/^I should feel good about myself$/, function(done) {
    done.pending();
});this.When(/^I type in my username$/, function (done) {
    element(by.css('#UserName')).sendKeys('username');
    done();
});
this.When(/^I type in my password$/, function (done) {
    element(by.css('#Password')).sendKeys('secret');
    done();
});
this.When(/^I click the login button$/, function (done) {
    element(by.css('#LoginButton')).click();
    done();
});// UserLogin.component.js
function UserLogin () {
    this.userNameInput = element(by.css('#UserName'));
    this.passwordInput = element(by.css('#Password'));
    this.loginButton = element(by.css('#LoginButton'));
}
UserLogin.prototype.login = function (username, password) {
    this.userNameInput.sendKeys(username);
    this.passwordInput.sendKeys(password);
    this.loginButton.click();
};
// WhenILogIn.step.js
this.When(/^I log in$/, function (done) {
    var UserLogin = new UserLogin();
    UserLogin.login('username', 'secret');
});