我的全局量角器配置
中有一个onprepare函数module.exports = {
.....
onPrepare: function() {
// At this point, global 'protractor' object will be set up, and jasmine
// will be available. For example, you can add a Jasmine reporter with:
// jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter(
// 'outputdir/', true, true));
var chai = require('chai'),
chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
global.chai = chai;
global.expect = chai.expect;
// setting up module file paths
var rootPath = path.normalize(__dirname + '/../');
global.__paths = global.__paths || {};
global.__paths.e2e = {
parts: rootPath + 'parts',
lib: rootPath + 'lib',
pages: rootPath + 'pages',
widgets: rootPath + 'widgets',
api: rootPath + 'api',
};
// detect if this is running locally, or in some staging env
global.isLocal = browser.baseUrl.indexOf('localhost') !== -1 ? true : false;
}
};
然后我的量角器配置就像这样扩展了
var path = require('path');
var globalConf = require('global.protractor.conf.js');
exports.config = globalConf;
但是我想从这个protractor.config中添加更多路径到全局.__ paths.e2e但是我不知道如何扩展onPrepare函数以便我可以添加更多的路径并保持原来的onprepare功能
答案 0 :(得分:-1)
我不确定这会起作用。请尝试以下方法。
globalConf.onPrepare.global [key] = path