summaryrefslogtreecommitdiffstats
path: root/workflow-bdd/stepDefinitions
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2018-08-09 13:13:23 +0300
committertalig <talig@amdocs.com>2018-08-09 13:13:23 +0300
commitff78ef472f8e481afb39f24a1d37737ef8dfab60 (patch)
tree2116f2cbc63de2bf82dbf358dbf16268a900a2d0 /workflow-bdd/stepDefinitions
parent923910109f7796aca1263df1a7fa13f7d6bc072c (diff)
Add activity spec code
Move code from sdc repository and: 1. place according to this project structure 2. refactor DTOs and use mapstruct 3. change errorResponse to be a json instead of a string (for all workflow code) Change-Id: Ia85590b53ab59ff7600e05b8a6d52e06b1773220 Issue-ID: SDC-1606 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'workflow-bdd/stepDefinitions')
-rw-r--r--workflow-bdd/stepDefinitions/ActivitySpec_steps.js47
-rw-r--r--workflow-bdd/stepDefinitions/General_Steps.js10
-rw-r--r--workflow-bdd/stepDefinitions/Utils.js4
-rw-r--r--workflow-bdd/stepDefinitions/world.js2
4 files changed, 60 insertions, 3 deletions
diff --git a/workflow-bdd/stepDefinitions/ActivitySpec_steps.js b/workflow-bdd/stepDefinitions/ActivitySpec_steps.js
new file mode 100644
index 00000000..7fe8ddf2
--- /dev/null
+++ b/workflow-bdd/stepDefinitions/ActivitySpec_steps.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const {Then, When} = require('cucumber');
+const assert = require('assert');
+const util = require('./Utils.js');
+const _ = require('lodash');
+
+When('I want to create an ActivitySpec', function () {
+ let path = '/activity-spec';
+ return util.request(this.context, 'POST', path, this.context.inputData, false, 'activity_spec').then((result)=> {
+ this.context.item = {id : result.data.id, versionId: result.data.versionId};
+ this.context.activityspec = {id : result.data.id, versionId: result.data.versionId};
+ });
+});
+
+When('I want to list ActivitySpecs with status {string}', function (string) {
+ let path = '/activity-spec?status='+string;
+ return util.request(this.context, 'GET', path, null, false, 'activity_spec').then((result)=> {
+ this.context.listCount = result.data.listCount;
+ });
+});
+
+When('I want to get the ActivitySpec for the current item', function () {
+ let path = '/activity-spec/'+ this.context.item.id+'/versions/'+this.context.item.versionId ;
+ return util.request(this.context, 'GET', path, null, false, 'activity_spec').then((result)=> {
+ });
+});
+
+Then('I want to call action {string} on this ActivitySpec item', function(string) {
+ let path = '/activity-spec/'+ this.context.item.id+'/versions/'+this.context.item.versionId+'/actions' ;
+ let inputData = JSON.parse('{"action" : "' +string+ '"}');
+ return util.request(this.context, 'PUT', path, inputData, false, 'activity_spec')
+}); \ No newline at end of file
diff --git a/workflow-bdd/stepDefinitions/General_Steps.js b/workflow-bdd/stepDefinitions/General_Steps.js
index 69a703cc..5968d406 100644
--- a/workflow-bdd/stepDefinitions/General_Steps.js
+++ b/workflow-bdd/stepDefinitions/General_Steps.js
@@ -81,6 +81,16 @@ Then('I want to set property {string} to value {string}', function(string, strin
});
/**
+ * @module ContextData
+ * @description sets context property to a random value
+ * @exampleFile Example_Rest_Calls.feature
+ * @step I want to update the input property {string} with a random value
+ **/
+Then('I want to set property {string} with a random value', function (string) {
+ _.set(this.context, string, util.random());
+});
+
+/**
* @module ResponseData
* @description Will check the output data for a property and a value. property can be a path (example: results[0].id)
* @exampleFile ResponseDataChecks.feature
diff --git a/workflow-bdd/stepDefinitions/Utils.js b/workflow-bdd/stepDefinitions/Utils.js
index 6f8a7a5c..9f398169 100644
--- a/workflow-bdd/stepDefinitions/Utils.js
+++ b/workflow-bdd/stepDefinitions/Utils.js
@@ -17,7 +17,7 @@ const request = require('request');
const fs = require('fs');
require('node-zip');
-function _request(context, method, path, data, isBinary=false, type='onboarding') {
+function _request(context, method, path, data, isBinary=false, type='workflow') {
let server = context.getUrlForType(type);
let options = {
@@ -106,7 +106,7 @@ function _request(context, method, path, data, isBinary=false, type='onboarding'
});
}
-function download(context, path, filePath, callback, type='onboarding') {
+function download(context, path, filePath, callback, type='workflow') {
let server = context.getUrlForType(type);
let options = {
method: 'GET',
diff --git a/workflow-bdd/stepDefinitions/world.js b/workflow-bdd/stepDefinitions/world.js
index cf749e66..4c50b0c9 100644
--- a/workflow-bdd/stepDefinitions/world.js
+++ b/workflow-bdd/stepDefinitions/world.js
@@ -70,7 +70,7 @@ class CustomWorld {
var _server = context.server;
var _config = config;
return function(type) {
- let typeData = _config["workflow"];
+ let typeData = _config[type];
let _url = _config.protocol + '://' +
typeData.server + ':' +
typeData.port + '/' +