sheetalm | 65029c3 | 2018-03-20 12:25:00 +0530 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | const {Then, When} = require('cucumber'); |
| 18 | const assert = require('assert'); |
ilanap | 061ca93 | 2019-08-04 10:16:33 +0300 | [diff] [blame] | 19 | const util = require('../cucumber-common/utils/Utils.js'); |
sheetalm | 65029c3 | 2018-03-20 12:25:00 +0530 | [diff] [blame] | 20 | const _ = require('lodash'); |
| 21 | |
| 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}; |
| 27 | }); |
| 28 | }); |
| 29 | |
| 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; |
| 34 | }); |
| 35 | }); |
| 36 | |
| 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)=> { |
| 40 | }); |
| 41 | }); |
| 42 | |
| 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') |
| 47 | }); |