summaryrefslogtreecommitdiffstats
path: root/openecomp-bdd/stepDefinitions/world.js
diff options
context:
space:
mode:
authorilanap <ilanap@amdocs.com>2018-04-25 13:39:19 +0300
committerilanap <ilanap@amdocs.com>2018-04-25 13:39:19 +0300
commitad3c41b5693b4f0b2a151e9c3221551e24f8264d (patch)
tree61eb7da7c28eb49c79a7df3991cf0e41c67dcf42 /openecomp-bdd/stepDefinitions/world.js
parentc3c481660d3494fccfafcd3bacd3f5b8cd3ecd8e (diff)
Fix for BDD multiple servers
Change-Id: Ibfc9813e471d4ac2509ee5e62828a07661cc704e Issue-ID: SDC-1262 Signed-off-by: ilanap <ilanap@amdocs.com>
Diffstat (limited to 'openecomp-bdd/stepDefinitions/world.js')
-rw-r--r--openecomp-bdd/stepDefinitions/world.js36
1 files changed, 22 insertions, 14 deletions
diff --git a/openecomp-bdd/stepDefinitions/world.js b/openecomp-bdd/stepDefinitions/world.js
index 75f93afb89..0ffcc8e39c 100644
--- a/openecomp-bdd/stepDefinitions/world.js
+++ b/openecomp-bdd/stepDefinitions/world.js
@@ -14,13 +14,24 @@
* limitations under the License.
*/
const { setWorldConstructor } = require('cucumber');
-const config = require('../config.json');
-let localDevConfig = {};
+const _ = require('lodash');
+
+let config = require('../config.json');
+let localConfig = {};
try {
- localDevConfig = require('../devConfig.json');
-} catch (e) {}
+ localConfig = require('../devConfig.json');
+} catch (e) {
+ try {
+ localConfig = require('../jenkinsConfig.json');
+ } catch (e) {
+ console.error("no env configuration was found!");
+ }
+}
+
+config = _.merge(config, localConfig);
var {setDefaultTimeout} = require('cucumber');
+
/**
* @module Context
* @description Context that is used per feature file and can be accessed as 'this.context' in all steps.<Br>
@@ -38,15 +49,12 @@ class CustomWorld {
constructor(options) {
this.context = {};
this.context.headers = {};
- if (localDevConfig.user) {
- this.context.headers['USER_ID'] = localDevConfig.user;
- } else {
- this.context.headers['USER_ID'] = process.env.USER;
- }
- if (localDevConfig.server) {
- this.context.server = localDevConfig.server;
- } else {
- this.context.server = process.env.SERVER;
+ let typeName;
+ for (typeName in config) {
+ this.context.headers[typeName] = {};
+ if (config[typeName].user) {
+ this.context.headers[typeName]['USER_ID'] = config[typeName].user;
+ }
}
this.context.vlm = {id: null, versionId: null};
@@ -69,7 +77,7 @@ class CustomWorld {
return function(type) {
let typeData = _config[type];
let _url = _config.protocol + '://' +
- _server + ':' +
+ typeData.server + ':' +
typeData.port + '/' +
typeData.prefix;
return _url;