diff --git a/features/backend/output_documents_resources/main_tests.feature b/features/backend/output_documents_resources/main_tests.feature index ad3e67c0f..e00c39f62 100644 --- a/features/backend/output_documents_resources/main_tests.feature +++ b/features/backend/output_documents_resources/main_tests.feature @@ -1,8 +1,7 @@ @ProcessMakerMichelangelo @RestAPI Feature: Output Documents Main Tests Requirements: - a workspace with the process 4224292655297723eb98691001100052 already loaded - the process name is "Test Users-Step-Properties End Point" + a workspace with the process 4224292655297723eb98691001100052 ("Test Users-Step-Properties End Point") already loaded there are two output documents in the process diff --git a/features/backend/project_property_assignee_resources/activity_assignee.feature b/features/backend/project_property_assignee_resources/activity_assignee.feature index 28ec9b60b..2ffdea31d 100644 --- a/features/backend/project_property_assignee_resources/activity_assignee.feature +++ b/features/backend/project_property_assignee_resources/activity_assignee.feature @@ -1,10 +1,13 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Project Properties - Assignee Resources +Feature: Assignee Resources + Requirements: + a workspace with the process 4224292655297723eb98691001100052 ("Test Users-Step-Properties End Point") already loaded Background: Given that I have a valid access_token - Scenario Outline: Get a list of available users and groups to be assigned to an activity + Scenario Outline: Get the list of available users and groups to be assigned to an activity + Check that there are exactly 82 available users for task "Task 1" Given I request "project//activity//available-assignee" Then the response status code should be 200 And the response charset is "UTF-8" @@ -13,12 +16,12 @@ Feature: Project Properties - Assignee Resources And the response has records And the "aas_uid" property in row 0 equals "" And the "aas_type" property in row 0 equals "" - + Examples: | test_description | project | activity | records | aas_uid | aas_type | | check if the list of possible users and groups to be assigned is correct | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 82 | 54731929352d56741de9d42002704749 | group | -Scenario Outline: Get a list of available users and groups to be assigned to an activity using filter +Scenario Outline: Get the list of available users and groups to be assigned to an activity using filter Given I request "project//activity//available-assignee?filter=&start=&limit=" Then the response status code should be 200 And the response charset is "UTF-8" @@ -27,11 +30,14 @@ Scenario Outline: Get a list of available users and groups to be assigned to an And the response has records And the "aas_uid" property in row 0 equals "" And the "aas_type" property in row 0 equals "" - + Examples: - | test_description | project | activity | filter | start | limit | records | aas_uid | aas_type| - | Using filter get available users that match with "fin" | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | fin | 0 | 50 | 2 | 66623507552d56742865613066097298 | group | - | Using filter get 1 available user that match with "fin" | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | fin | 0 | 1 | 1 | 66623507552d56742865613066097298 | group | + | test_description | project | activity | filter | start | limit | records | aas_uid | aas_type| + | Using filter="fin" with no limits should return 2 groups | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | fin | 0 | 50 | 2 | 66623507552d56742865613066097298 | group | + | Using filter="fin", start="1", limit="1" should return 1 group | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | fin | 0 | 1 | 1 | 66623507552d56742865613066097298 | group | + | Using filter="financial" should return 1 available group | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | financial | 0 | 1 | 1 | 62528621852cda436afe755036997717 | group | + | Using filter="finance" should return 1 available group | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | finance | 0 | 1 | 1 | 17707415052cda432dd4774063621869 | group | + Scenario Outline: Assign 2 users and 2 group to an activity Given POST this data: @@ -44,7 +50,7 @@ Scenario Outline: Get a list of available users and groups to be assigned to an And I request "project//activity//assignee" Then the response status code should be 201 And the type is "object" - + Examples: | test_description | project | activity | aas_uid | aas_type | | assign a user to the first task | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 73005191052d56727901138030694610 | user | @@ -53,8 +59,6 @@ Scenario Outline: Get a list of available users and groups to be assigned to an | assign a group to the second task | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 36775342552d5674146d9c2078497230 | group | - - Scenario Outline: After assignation - List assignees of each activity Given I request "project//activity//assignee" Then the response status code should be 200 @@ -64,12 +68,12 @@ Scenario Outline: Get a list of available users and groups to be assigned to an And the response has records And the "aas_uid" property in row 0 equals "" And the "aas_type" property in row 0 equals "" - + Examples: | test_description | project | activity | records | aas_uid | aas_type | | Verify that the activity has expected quantity of asignees | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 7 | 54731929352d56741de9d42002704749 | group | | Verify that the activity has expected quantity of asignees | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 5 | 36775342552d5674146d9c2078497230 | group | - + Scenario Outline: List assignees of an activity using a filter Given I request "project//activity//assignee?filter=" @@ -80,12 +84,13 @@ Scenario Outline: List assignees of an activity using a filter And the response has record And the "aas_uid" property in row 0 equals "" And the "aas_type" property in row 0 equals "" - + Examples: | test_description | project | activity | records | aas_uid | aas_type | filter | | Filtered list should return 1 record | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 1 | 73005191052d56727901138030694610 | user | oli | | Filtered list should return 1 record | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 1 | 36775342552d5674146d9c2078497230 | group | emp | + Scenario Outline: Get a single user or group of an activity Given I request "project//activity//assignee/" Then the response status code should be 200 @@ -97,16 +102,17 @@ Scenario Outline: List assignees of an activity using a filter And the "aas_lastname" property equals "" And the "aas_username" property equals "" And the "aas_type" property equals "" - + Examples: | test_description | project | activity | aas_uid | aas_type | aas_name | aas_lastname | aas_username | - | Obtain details of user assigend to an activity | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 73005191052d56727901138030694610 | user | Olivia | Austin | olivia | - + | Obtain details of user assigned to an activity | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 73005191052d56727901138030694610 | user | Olivia | Austin | olivia | + + Scenario Outline: Remove assignee from an activity Given that I want to delete a resource with the key "aas_uid" stored in session array And I request "project//activity//assignee/" Then the response status code should be 200 - + Examples: | test_description | project | activity | aas_uid | | Remove a user from activity | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 73005191052d56727901138030694610 | @@ -114,7 +120,6 @@ Scenario Outline: List assignees of an activity using a filter | Remove a user from activity | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 54731929352d56741de9d42002704749 | | Remove a user from activity | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 36775342552d5674146d9c2078497230 | - Scenario: List assignees of an activity Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" @@ -123,4 +128,4 @@ Scenario Outline: List assignees of an activity using a filter And the content type is "application/json" And the type is "array" And the response has 4 records - \ No newline at end of file + diff --git a/features/backend/project_property_assignee_resources/negative_tests.feature b/features/backend/project_property_assignee_resources/negative_tests.feature index 725c91d60..84fb84235 100644 --- a/features/backend/project_property_assignee_resources/negative_tests.feature +++ b/features/backend/project_property_assignee_resources/negative_tests.feature @@ -1,9 +1,11 @@ @ProcessMakerMichelangelo @RestAPI @assignee @negative Feature: Project Properties -Assignee Resources - Negative tests + Requirements: + a workspace with the process 4224292655297723eb98691001100052 ("Test Users-Step-Properties End Point") already loaded Background: Given that I have a valid access_token - + Scenario Outline: List assignees of an activity with bad parameters Given I request "project//activity//assignee" @@ -13,27 +15,58 @@ Scenario Outline: List assignees of an activity with bad parameters | test_description | project | activity | | Use an invalid project ID and empty activity | 4224292655297723eb98691001100052 | 1234556 | | Use an invalid project ID | 122134324 | 65496814252977243d57684076211485 | - | Use an invalid activity ID | 345345345 | 345345345 | - + | Use an invalid activity ID | 345345345 | 345345345 | + Scenario Outline: Assign a user or group to an activity (Field validation) Given POST this data: """ { - "ass_uid": "", - "ass_type": "" + "ass_uid": "", + "ass_type": "" } """ And I request "project//activity//assignee" Then the response status code should be 400 And the type is "object" - - + + Examples: | test_description | project | activity | aas_uid | aas_type | - | Asignando un user inexistente | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | | | + | Asignando un user inexistente | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | | | | Asignando un usuario Con tipo inexistente | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | !@#$%^&*()_+=-[]{};:~, | user | - | Asignando un usuario como grupo | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | group | + | Asignando un usuario como grupo | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | group | | Asignando un usuario con type inexistente | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | department | - + + + Scenario Outline: List assignees of an activity using different filters + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee?filter=&start=&limit=" + Then the response status code should be + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "" + And the response has records + + Examples: + | test_description | filter | start | limit | records | http_code | type | + | lowercase | admin | 0 | 1 | 1 | 200 | array | + | uppercase | ADMIN | 0 | 1 | 1 | 200 | array | + | limit=3 | a | 0 | 3 | 3 | 200 | array | + | limit and start | a | 1 | 2 | 2 | 200 | array | + | high number for start | a | 1000 | 1 | 0 | 200 | array | + | high number for start | a | 1000 | 0 | 0 | 200 | array | + | empty result | xyz | 0 | 0 | 0 | 200 | array | + | empty string | | 0 | 10000 | 0 | 200 | array | + | empty string | | 1 | 2 | 0 | 200 | array | + | invalid start | a | b | c | 0 | 400 | string| + | invalid limit | a | 0 | c | 0 | 400 | string| + | search 0 | 0 | 0 | 0 | 0 | 200 | array | + | search 0 | 0 | 0 | 100 | 0 | 200 | array | + | negative numbers | a | -10 | -20 | 0 | 200 | array | + | real numbers | a | 0.0 | 1.0 | 0 | 400 | string| + | real numbers | a | 0.0 | 0.0 | 0 | 400 | string| + | real numbers | a | 0.1 | 1.4599 | 0 | 400 | string| + | real numbers | a | 1.5 | 1.4599 | 0 | 400 | string| + + diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index dcf4dc1f9..72280d612 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1111,7 +1111,12 @@ class RestContext extends BehatContext { $data = $this->_data; if (!is_array($data)) { - throw new Exception("the Response data is not an array!\n\n" ); + if ($quantityOfRecords == 0) { + //if we expect 0 records and the response in fact is not an array, just return as a valid test + return; + } else { + throw new Exception("the Response data is not an array!\n\n" ); + } } $currentRecordsCount=count($data); if($currentRecordsCount!=$quantityOfRecords){ @@ -1184,7 +1189,7 @@ class RestContext extends BehatContext */ public function theResponseStatusMessageShouldHaveTheFollowingText($arg1) { - + $message=""; if($bodyResponse=json_decode($this->_response->getBody(true))){ if(isset($bodyResponse->error->message)){ @@ -1204,8 +1209,8 @@ class RestContext extends BehatContext } - - + + }