Map unexpected error to response
[sdc/sdc-workflow-designer.git] / workflow-bdd / features / VersionState.feature
1 # Copyright © 2018 European Support Limited
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 Feature: Workflow Version State
16
17   Background: Create workflow and first version
18     Given I want to create a Workflow
19     And I want to update the input property "description" with value "workflow version description"
20     And I want to create for path "/workflows/{item.id}/versions" with the input data from the context
21     And I want to copy to property "item.versionId" from response data path "id"
22
23   Scenario: Get state after creation
24     When I want to get path "/workflows/{item.id}/versions/{item.versionId}/state"
25     Then I want to check property "name" for value "DRAFT"
26     And I want to check property "nextStates[0]" for value "CERTIFIED"
27
28   Scenario: Update state to current state - invalid
29     Then I want the following to fail with response status code 422
30     When I want to update the input property "name" with value "DRAFT"
31     And I want to create for path "/workflows/{item.id}/versions/{item.versionId}/state" with the input data from the context
32
33   Scenario: Update state - DRAFT to CERTIFIED
34     When I want to update the input property "name" with value "CERTIFIED"
35     And I want to create for path "/workflows/{item.id}/versions/{item.versionId}/state" with the input data from the context
36     Then I want to get path "/workflows/{item.id}/versions/{item.versionId}/state"
37     And I want to check property "name" for value "CERTIFIED"
38     And I want to check property "nextStates" to have length 0
39
40   Scenario: Update state when CERTIFIED - invalid
41     When I want to update the input property "name" with value "CERTIFIED"
42     And I want to create for path "/workflows/{item.id}/versions/{item.versionId}/state" with the input data from the context
43     When I want the following to fail with response status code 422
44     Then I want to create for path "/workflows/{item.id}/versions/{item.versionId}/state" with the input data from the context
45
46   Scenario: Update when CERTIFIED - invalid
47     When I want to update the input property "name" with value "CERTIFIED"
48     And I want to create for path "/workflows/{item.id}/versions/{item.versionId}/state" with the input data from the context
49     And I want to update the input property "description" with value "workflow version description updated"
50     Then I want the following to fail with response status code 422
51     When I want to update for path "/workflows/{item.id}/versions/{item.versionId}" with the input data from the context
52
53   Scenario: Create second version based on non CERTIFIED one - invalid
54     Then I want the following to fail with response status code 422
55     When I want to create for path "/workflows/{item.id}/versions?baseVersionId={item.versionId}" with the input data from the context