blob: d12421bd902b2755bd18d4dfd9b2ab94fa89f3e8 [file] [log] [blame]
sheetalm65029c32018-03-20 12:25:00 +05301/*
2 * Copyright © 2016-2018 European Support Limited
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17const {Then, When} = require('cucumber');
18const assert = require('assert');
ilanap061ca932019-08-04 10:16:33 +030019const util = require('../cucumber-common/utils/Utils.js');
sheetalm65029c32018-03-20 12:25:00 +053020const _ = require('lodash');
21
22When('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};
27 });
28});
29
30When('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;
34 });
35});
36
37When('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)=> {
40 });
41});
42
43Then('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')
47});