diff --git a/features/backend/project_activity_resources/activity.feature b/features/backend/project_activity_resources/activity.feature index c33a3c958..6c2f856bc 100644 --- a/features/backend/project_activity_resources/activity.feature +++ b/features/backend/project_activity_resources/activity.feature @@ -1,52 +1,119 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Project Activity Resources +Feature: Testing activity + @1: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- + Scenario: Get a activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the "definition" property type is "array" + And that "tas_title" is set to "Task 1" - Background: - Given that I have a valid access_token - Scenario: Get properties & definition of a activity. - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" - - - Scenario: Get BPMN definition of an activity. - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485?filter=definition" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" - - Scenario: Get properties data of the ProcessMaker engine of an activity. - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485?filter=properties" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" - - Scenario: Update definition & properties of an activity - Given PUT data from file "activity_update_properties.json" - And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485" - Then the response status code should be 200 - - Scenario: Get properties & definition of an updated activity. - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" - And the response is equivalent to this json file "activity_update_properties.json" - - Scenario: Delete a project activity - Given that I want to delete "activity" - And I request "project/4224292655297723eb98691001100052/activity/95897010052ccb746c770b6003171032" - Then the response status code should be 200 - - Scenario: Get properties & definition of a activity (subprocess) - Given I request "project/4224292655297723eb98691001100052/activity/68065066252ccb7913b9be6048174072" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "object" + @2: TEST FOR GET PROPERTIES ACTIVITY /--------------------------------------------------------- + Scenario: Get properties of activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=properties" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the response not has a "definition" property + + + @3: TEST FOR GET DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario: Get definition of activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311?filter=definition" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And the response not has a "properties" property + + + @4: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario: Put propertie of activity + Given that I have a valid access_token + And PUT this data: + """ + { + "definition": [], + "properties": { + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": null, + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task Edit", + "tas_description": "", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "" + } + } + """ + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + + @5: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- + Scenario: Get a activity + Given that I have a valid access_token + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "tas_title" is set to "Task Edit" + + + @6: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario: Put propertie of activity + Given that I have a valid access_token + And PUT this data: + """ + { + "definition": [], + "properties": { + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": null, + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task 1", + "tas_description": "", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "" + } + } + """ + And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index b498ca832..258e204b8 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -698,6 +698,23 @@ class RestContext extends BehatContext } } + /** + * @Given /^the response not has a "([^"]*)" property$/ + * @Given /^the response not has an "([^"]*)" property$/ + * @Given /^the response not has a property called "([^"]*)"$/ + * @Given /^the response not has an property called "([^"]*)"$/ + */ + public function theResponseNotHasAProperty($propertyName) + { + $data = $this->_data; + + if (!empty($data)) { + if (isset($data->$propertyName)) { + throw new Exception("Property '$propertyName' is set!\n\n"); + } + } + } + /** * @Then /^the "([^"]*)" property equals "([^"]*)"$/ */