Protractor 如何在cucumber+;量角器

Protractor 如何在cucumber+;量角器,protractor,cucumberjs,Protractor,Cucumberjs,我想使用这段代码对所有页面文件进行重用。 我有其他login.page文件,因此如果我根据该功能创建任何其他页面文件,我应该能够重用此代码 /* jshint -W117 */ 'use strict'; var Support = require('./_support'); var $ = new Support(); var LoginPage = require('./login.page'); /** * Collection of basic steps definition

我想使用这段代码对所有页面文件进行重用。 我有其他login.page文件,因此如果我根据该功能创建任何其他页面文件,我应该能够重用此代码

/* jshint -W117 */
'use strict';

var Support = require('./_support');
var $ = new Support();
var LoginPage = require('./login.page');


/**
 * Collection of basic steps definitions reusable across features
 */
var basicSteps = function (page) {
    //var page = new LoginPage();
    this.Then(/^the title should equal "([^"]*)"$/, function (arg1, callback) {
        $.expect(browser.getTitle()).to.eventually.equal(arg1).and.notify(callback);
    });

    this.Then(/^I should see validation message "([^"]*)"$/, function (arg1, callback) {
        $.expect(LoginPage.hasErrors()).to.eventually.equal(arg1).and.notify(callback);
    });

    this.Then(/^the "([^"]*)" button should be disabled$/, function (arg1, callback) {
        $.expect(LoginPage.buttonDisabled.isEnabled()).to.eventually.to.equal(false).and.notify(callback);;

    });

};

module.exports = basicSteps;