2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 const {Then, When} = require('cucumber');
18 const assert = require('assert');
19 const util = require('../cucumber-common/utils/Utils.js');
20 const _ = require('lodash');
22 When('I want to create an ActivitySpec', function () {
23 let path = '/activity-spec';
24 return util.request(this.context, 'POST', path, this.context.inputData, false, 'activity_spec').then((result)=> {
25 this.context.item = {id : result.data.id, versionId: result.data.versionId};
26 this.context.activityspec = {id : result.data.id, versionId: result.data.versionId};
30 When('I want to list ActivitySpecs with status {string}', function (string) {
31 let path = '/activity-spec?status='+string;
32 return util.request(this.context, 'GET', path, null, false, 'activity_spec').then((result)=> {
33 this.context.listCount = result.data.listCount;
37 When('I want to get the ActivitySpec for the current item', function () {
38 let path = '/activity-spec/'+ this.context.item.id+'/versions/'+this.context.item.versionId ;
39 return util.request(this.context, 'GET', path, null, false, 'activity_spec').then((result)=> {
43 Then('I want to call action {string} on this ActivitySpec item', function(string) {
44 let path = '/activity-spec/'+ this.context.item.id+'/versions/'+this.context.item.versionId+'/actions' ;
45 let inputData = JSON.parse('{"action" : "' +string+ '"}');
46 return util.request(this.context, 'PUT', path, inputData, false, 'activity_spec')