Reputation: 767
I have a onprepare function in my global protractor config
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;
}
};
I then have my protractor config extending this like so
var path = require('path');
var globalConf = require('global.protractor.conf.js');
exports.config = globalConf;
However I want to add some more paths to global.__paths.e2e from this protractor.config however I am not sure how to extend the onPrepare function so that I can add couple more paths to it and still keep the original onprepare functionality
Upvotes: 3
Views: 548
Reputation: 4832
Im not sure wheter this will work.can you please try the below method.
globalConf.onPrepare.global [key] = path
Upvotes: -1