diff --git a/features/backend/project_activity_resources/activity.feature b/features/backend/project_activity_resources/activity.feature index cf81cef31..dc65abb98 100644 --- a/features/backend/project_activity_resources/activity.feature +++ b/features/backend/project_activity_resources/activity.feature @@ -1,120 +1,158 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Testing activity - @1: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- - Scenario: Get a activity +Feature: Activity Resources + + Background: Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + + @1: TEST FOR GET PROPERTIES & DEFINITION OF A ACTIVITY /----------------------------------------------------------------------- + Scenario Outline: Get an activity + Given I request "project//activity/" 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 the "properties" property type is "array" - And that "tas_title" is set to "Task 1" + And that "tas_title" is set to "" + Examples: + | project | activity | tas_title | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | Task 1 | + + @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" + Scenario Outline: Get properties of activity + Given I request "project//activity/?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 has not a "definition" property + Examples: + + | project | activity | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | + + @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" + Scenario Outline: Get definition of activity + Given I request "project//activity/?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 has not a "properties" property + Examples: + + | project | activity | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | + + @4: TEST FOR PUT DEFINITION ACTIVITY /--------------------------------------------------------- - Scenario: Put propertie of activity - Given that I have a valid access_token - And PUT this data: - """ + Scenario Outline: Put property of activity + Given 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": "" + + "definition": {}, + "properties": + { + "tas_title": "", + "tas_description": "", + "tas_priority_variable": "@@VAR_PRIORITY", + "tas_derivation_screen_tpl": "template.html", + "tas_start": , + "tas_assign_type" : "", + "tas_assign_variable": "@@USER_LOGGED", + "tas_group_variable": "@@GROUP_UID", + "tas_selfservice_timeout": "", + "tas_selfservice_time": "", + "tas_selfservice_time_unit" : "", + "tas_selfservice_trigger_uid" : "3229227245298e1c5191f95009451434", + "tas_transfer_fly": , + "tas_duration" : "", + "tas_timeunit" : "", + "tas_type_day": "", + "tas_calendar": "00000000000000000000000000000001", + "tas_type": "", + "tas_def_title": "Case Title", + "tas_def_description": "Case Descripction", + "tas_send_last_email": , + "tas_def_subject_message": "", + "tas_def_message_type": "template", + "tas_def_message": "", + "tas_def_message_template": "template.html" } } - """ - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + """ + And I request "project//activity/" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" + + + + Examples: + + | project | activity | tas_title | tas_description | tas_start | tas_assign_type | tas_selfservice_timeout | tas_selfservice_time | tas_selfservice_time_unit | tas_transfer_fly | tas_duration | tas_timeunit | tas_type_day | tas_type | tas_send_last_email | tas_def_subject_message | tas_def_message | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | update activity | update description | true | BALANCED | 0 | 0 | DAYS | true | 4 | DAYS | 1 | NORMAL | true | Email desde tarea | Contenido del email | @5: TEST FOR GET ACTIVITY /----------------------------------------------------------------------- - Scenario: Get a activity - Given that I have a valid access_token - And I request "project/251815090529619a99a2bf4013294414/activity/97192372152a5c78f04a794095806311" + Scenario Outline: Get a activity + Given I request "project//activity/" 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" + And that "tas_title" is set to "" + Examples: - @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 + | project | activity | tas_title | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095806311 | Task Edit | + +@6: TEST FOR GET PROPERTIES & DEFINITION OF A ACTIVITY /----------------------------------------------------------------------- + Scenario Outline: Get an activity + Given I request "project//activity/" + Then the response status code should be And the response charset is "UTF-8" - And the type is "object" \ No newline at end of file + And the type is "object" + + + Examples: + + | project | activity | tas_title | error_code | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095845000 | Task 1 | 400 | + | 251815090529619a99a2bf4013294414 | | Task 1 | 404 | + | | 97192372152a5c78f04a794095806311 | Task 1 | 400 | + + +@7: TEST FOR GET PROPERTIES ACTIVITY /--------------------------------------------------------- + Scenario Outline: Get properties of activity + Given I request "project//activity/?filter=properties" + Then the response status code should be + And the response charset is "UTF-8" + And the type is "object" + + Examples: + + | project | activity | error_code | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095801000 | 400 | + | 251815090529619a99a2bf4013294414 | | 404 | + | | 97192372152a5c78f04a794095806311 | 400 | + +@8: TEST FOR GET DEFINITION ACTIVITY /--------------------------------------------------------- + Scenario Outline: Get definition of activity + Given I request "project//activity/?filter=definition" + Then the response status code should be + And the response charset is "UTF-8" + And the type is "object" + + Examples: + + | project | activity | error_code | + | 251815090529619a99a2bf4013294414 | 97192372152a5c78f04a794095200000 | 400 | + | 251815090529619a99a2bf4013294414 | | 404 | + | | 97192372152a5c78f04a794095806311 | 400 | \ No newline at end of file diff --git a/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature b/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature index cda44c1dd..885a04cc6 100644 --- a/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature +++ b/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature @@ -1,122 +1,162 @@ -@ProcessMakerMichelangelo @RestAPI -Feature: Project Properties - Assignee Resources +@ProcessMakerMichelangelo @RestAPI @assignee +Feature: Project Properties -Adhoc Assignee Resources Background: Given that I have a valid access_token - Scenario: Get a list of available users and groups to be assigned to an activity - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-available-assignee" + Scenario Outline: Get a list of available adhoc users and groups to be assigned to an activity + Given I request "project//activity//adhoc-available-assignee" 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 "array" - And the response has 79 records - And the "aas_uid" property in row 0 equals "35762872152cda4323207c6035916735" - And the "aas_type" property in row 0 equals "group" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" -Scenario: Get a list of available users and groups to be assigned to an activity with filter - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-available-assignee?filter=departa&start=0&limit=50" + Examples: + | project | activity | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 82 | 35762872152cda4323207c6035916735 | group | + +Scenario Outline: Get a list of available adhoc users and groups to be assigned to an activity with filter + Given I request "project//activity//adhoc-available-assignee?filter=&start=&limit=" 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 "array" - And the response has 3 records - And the "aas_uid" property in row 0 equals "90268877852b7b4b9f134b1096735994" - And the "aas_type" property in row 0 equals "group" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" - Scenario: Assign a user or group to an activity + Examples: + | project | activity | filter | start | limit | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | departa | 0 | 50 | 3 | 90268877852b7b4b9f134b1096735994 | group | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | departa | 0 | 1 | 1 | 90268877852b7b4b9f134b1096735994 | group | + + Scenario Outline: Assign a adhoc user or group to an activity Given POST this data: """ { - "ass_uid": "84643774552cda42dabb732033709262", - "ass_type": "user" + "aas_uid": "", + "aas_type": "" } """ - And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" + And I request "project//activity//adhoc-assignee" Then the response status code should be 201 And the type is "object" - Scenario: Assign a user or group to an activity - Given POST this data: -""" -{ - "ass_uid": "95888918452cda41a2b5d11013819411", - "ass_type": "user" -} -""" - And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" - Then the response status code should be 201 - And the type is "object" + Examples: + | project | activity | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 84643774552cda42dabb732033709262 | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 95888918452cda41a2b5d11013819411 | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 16698718252cda431814024050455569 | group | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 90706007452cda42ed1c326093152317 | group | - Scenario: Assign a user or group to an activity - Given POST this data: -""" -{ - "ass_uid": "16698718252cda431814024050455569", - "ass_type": "group" -} -""" - And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" - Then the response status code should be 201 - And the type is "object" - Scenario: Assign a user or group to an activity - Given POST this data: -""" -{ - "ass_uid": "90706007452cda42ed1c326093152317", - "ass_type": "group" -} -""" - And I request "project/4224292655297723eb98691001100052/activity/68911670852a22d93c22c06005808422/adhoc-assignee" - Then the response status code should be 201 - And the type is "object" - Scenario: List assignees of an activity - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" + Scenario Outline: List adhoc assignees of an activity + Given I request "project//activity//adhoc-assignee" 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 "array" - And the response has 7 records - And the "aas_uid" property in row 0 equals "10732248352cda434c43997043577116" - And the "aas_type" property in row 0 equals "group" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" - Scenario: List assignees of an activity with filter - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee?filter=emi" + Examples: + | project | activity | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 7 | 10732248352cda434c43997043577116 | group | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 5 | 90706007452cda42ed1c326093152317 | group | + + + Scenario Outline: After assignation - List adhoc assignees of an activity with filter + Given I request "project//activity//adhoc-assignee?filter=" 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 "array" And the response has 1 record - And the "aas_uid" property in row 0 equals "84643774552cda42dabb732033709262" - And the "aas_type" property in row 0 equals "user" + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" - Scenario: Get a single user or group of an activity - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee/95888918452cda41a2b5d11013819411" + Examples: + | project | activity | records | aas_uid | aas_type | filter | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 1 | 84643774552cda42dabb732033709262 | user | emi | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 1 | 90706007452cda42ed1c326093152317 | group | dep | + + Scenario Outline: Get a single adhoc user or group of an activity + Given I request "project//activity//adhoc-assignee/" 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 "aas_uid" property equals "95888918452cda41a2b5d11013819411" - And the "aas_name" property equals "Mike" - And the "aas_lastname" property equals "Balisi" - And the "aas_username" property equals "mike" + And the "aas_uid" property equals "" + And the "aas_name" property equals "" + And the "aas_lastname" property equals "" + And the "aas_username" property equals "" And the "aas_type" property equals "user" + + Examples: + | project | activity | aas_uid | aas_type | aas_name | aas_lastname | aas_username | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 95888918452cda41a2b5d11013819411 | user | Mike | Balisi | mike | - Scenario: Remove assignee from an activity + Scenario Outline: Remove adhoc 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/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee/91968412052cda4097270a3085279286" + And I request "project//activity//adhoc-assignee/" Then the response status code should be 200 + Examples: + | project | activity | aas_uid | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 84643774552cda42dabb732033709262 | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 95888918452cda41a2b5d11013819411 | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 16698718252cda431814024050455569 | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 90706007452cda42ed1c326093152317 | + Scenario: List assignees of an activity Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" 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 "array" - And the response has 6 records + And the response has 4 records - Scenario: List assignees of an activity - Given I request "project/4224292655297723eb98691001100052/activity/12345/adhoc-assignee" + + + Scenario Outline: List assignees of an activity with bad parameters + Given I request "project//activity//adhoc-assignee" Then the response status code should be 400 + + + Examples: + | project | activity | + | 4224292655297723eb98691001100052 | 1234556 | + | 122134324 | 65496814252977243d57684076211485 | + | 345345345 | 345345345 | + | | | + + +Scenario Outline: Assign a user or group to an activity (Field validation) + Given POST this data: +""" +{ + "ass_uid": "", + "ass_type": "" +} +""" + And I request "project//activity//adhoc-assignee" + Then the response status code should be 400 + And the type is "object" + + # Asignando un user vacio + # Asignando un user inexistente + # Asignando un usuario como grupo + # Asignando un usuario con type inexistente + + Examples: + | project | activity | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | | | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | !@#$%^&*()_+=-[]{};:~, | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 15746307552d00a66624889076110382 | group | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | department | + diff --git a/features/backend/project_property_assignee_resources/activity_assignee.feature b/features/backend/project_property_assignee_resources/activity_assignee.feature index ff357de5c..aeda6ed74 100644 --- a/features/backend/project_property_assignee_resources/activity_assignee.feature +++ b/features/backend/project_property_assignee_resources/activity_assignee.feature @@ -4,123 +4,159 @@ Feature: Project Properties - Assignee Resources Background: Given that I have a valid access_token - Scenario: Get a list of available users and groups to be assigned to an activity - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/available-assignee" + Scenario Outline: Get a list of available users and groups to be assigned to an activity + Given I request "project//activity//available-assignee" 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 "array" - And the response has 79 records - And the "aas_uid" property in row 0 equals "35762872152cda4323207c6035916735" - And the "aas_type" property in row 0 equals "group" - -Scenario: Get a list of available users and groups to be assigned to an activity with filter - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/available-assignee?filter=departa&start=0&limit=50" - 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 "array" - And the response has 3 records - And the "aas_uid" property in row 0 equals "90268877852b7b4b9f134b1096735994" - And the "aas_type" property in row 0 equals "group" - - Scenario: Assign a user or group to an activity - Given POST this data: -""" -{ - "ass_uid": "66386662252cda3f9a63226052377198", - "ass_type": "user" -} -""" - And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" - Then the response status code should be 201 - And the type is "object" - - Scenario: Assign a user or group to an activity - Given POST this data: -""" -{ - "ass_uid": "69191356252cda41acde328048794164", - "ass_type": "user" -} -""" - And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" - Then the response status code should be 201 - And the type is "object" - - Scenario: Assign a user or group to an activity - Given POST this data: -""" -{ - "ass_uid": "35762872152cda4323207c6035916735", - "ass_type": "group" -} -""" - And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" - Then the response status code should be 201 - And the type is "object" - - Scenario: Assign a user or group to an activity - Given POST this data: -""" -{ - "ass_uid": "90706007452cda42ed1c326093152317", - "ass_type": "group" -} -""" - And I request "project/4224292655297723eb98691001100052/activity/68911670852a22d93c22c06005808422/assignee" - Then the response status code should be 201 - And the type is "object" - - Scenario: List assignees of an activity - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" - 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 "array" - And the response has 7 records - And the "aas_uid" property in row 0 equals "35762872152cda4323207c6035916735" - And the "aas_type" property in row 0 equals "group" - -Scenario: List assignees of an activity with filter - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee?filter=oli" - 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 "array" - And the response has 1 record - And the "aas_uid" property in row 0 equals "69191356252cda41acde328048794164" - And the "aas_type" property in row 0 equals "user" - - Scenario: Get a single user or group of an activity - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee/69191356252cda41acde328048794164" - 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 "aas_uid" property equals "69191356252cda41acde328048794164" - And the "aas_name" property equals "Olivia" - And the "aas_lastname" property equals "Austin" - And the "aas_username" property equals "olivia" - And the "aas_type" property equals "user" - - Scenario: 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/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee/69191356252cda41acde328048794164" - Then the response status code should be 200 - - Scenario: List assignees of an activity - Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" - 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 "array" - And the response has 6 records + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + Examples: + | project | activity | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 82 | 35762872152cda4323207c6035916735 | group | + +Scenario Outline: Get a list of available users and groups to be assigned to an activity with 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" + And the content type is "application/json" + And the type is "array" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | filter | start | limit | records | aas_uid | aas_type| + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | departa | 0 | 50 | 3 | 90268877852b7b4b9f134b1096735994 | group | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | departa | 0 | 1 | 1 | 90268877852b7b4b9f134b1096735994 | group | + + Scenario Outline: Assign a user or group to an activity + Given POST this data: +""" +{ + "aas_uid": "", + "aas_type": "" +} +""" + And I request "project//activity//assignee" + Then the response status code should be 201 + And the type is "object" + + Examples: + | project | activity | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 66386662252cda3f9a63226052377198 | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 35762872152cda4323207c6035916735 | group | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 90706007452cda42ed1c326093152317 | group | + + + + + Scenario Outline: After assignation - List assignees of an activity + Given I request "project//activity//assignee" + 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 "array" + And the response has records + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | records | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 7 | 135762872152cda4323207c6035916735 | group | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 5 | 90706007452cda42ed1c326093152317 | group | + + +Scenario Outline: List assignees of an activity with filter + Given I request "project//activity//assignee?filter=" + 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 "array" + And the response has record + And the "aas_uid" property in row 0 equals "" + And the "aas_type" property in row 0 equals "" + + Examples: + | project | activity | records | aas_uid | aas_type | filter | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 1 | 69191356252cda41acde328048794164 | user | oli | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 1 | 90706007452cda42ed1c326093152317 | group | dep | + + 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 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And the "aas_uid" property equals "" + And the "aas_name" property equals "" + And the "aas_lastname" property equals "" + And the "aas_username" property equals "" + And the "aas_type" property equals "" + + Examples: + | project | activity | aas_uid | aas_type | aas_name | aas_lastname | aas_username | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | 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: + | project | activity | aas_uid | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 66386662252cda3f9a63226052377198 | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 35762872152cda4323207c6035916735 | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | 90706007452cda42ed1c326093152317 | + + + Scenario: List assignees of an activity - Given I request "project/4224292655297723eb98691001100052/activity/12345/assignee" + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" + 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 "array" + And the response has 4 records + + Scenario Outline: List assignees of an activity with bad parameters + Given I request "project//activity//assignee" Then the response status code should be 400 - + Examples: + | project | activity | + | 4224292655297723eb98691001100052 | 1234556 | + | 122134324 | 65496814252977243d57684076211485 | + | 345345345 | 345345345 | + | | | + +Scenario Outline: Assign a user or group to an activity (Field validation) + Given POST this data: +""" +{ + "ass_uid": "", + "ass_type": "" +} +""" + And I request "project//activity//assignee" + Then the response status code should be 400 + And the type is "object" + + # Asignando un user inexistente + # Asignando un usuario como grupo + # Asignando un usuario con type inexistente + Examples: + + | project | activity | aas_uid | aas_type | + | 4224292655297723eb98691001100052 | 68911670852a22d93c22c06005808422 | | | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | !@#$%^&*()_+=-[]{};:~, | user | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | group | + | 4224292655297723eb98691001100052 | 65496814252977243d57684076211485 | 69191356252cda41acde328048794164 | department | + \ No newline at end of file diff --git a/features/backend/triggers_resources/triggers.feature b/features/backend/triggers_resources/triggers.feature index c137e9be4..55bfca62c 100644 --- a/features/backend/triggers_resources/triggers.feature +++ b/features/backend/triggers_resources/triggers.feature @@ -1,55 +1,126 @@ @ProcessMakerMichelangelo @RestAPI Feature: Testing triggers - + + Background: + Given that I have a valid access_token + @1: TEST FOR POST TRIGGER /-------------------------------------------------------------------- - Scenario: Create a trigger - Given that I have a valid access_token - And POST this data: + Scenario Outline: Get a list of triggers of a project + Given I request "project//triggers" + 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 "array" + And the response has records + + Examples: + | project | records | + | 251815090529619a99a2bf4013294414 | 0 | + + @2: TEST FOR POST TRIGGER /-------------------------------------------------------------------- + Scenario Outline: Create a trigger + + Given POST this data: """ { - "tri_title": "nuevo trigger", - "tri_description": "descripcion" + "tri_title": "", + "tri_description": "", + "tri_type": "", + "tri_webbot": "", + "tri_param": "PRIVATE" } """ - And I request "project/251815090529619a99a2bf4013294414/trigger" + And I request "project//trigger" Then the response status code should be 201 - And store "tri_uid" in session array + And store "tri_uid" in session array as variable "tri_uid_" + Examples: - @2: TEST FOR PUT TRIGGER /----------------------------------------------------------------------- - Scenario: Update a trigger - Given that I have a valid access_token - And PUT this data: + | project | tri_number | tri_title | tri_description |tri_type | tri_webbot | + | 251815090529619a99a2bf4013294414 | 1 | nuevo trigger 2 | descripcion |SCRIPT | @@user1 = @@USER_LOGGED; \n $x = rand();| + | 251815090529619a99a2bf4013294414 | 2 | otro trigger 2 | descripcion de otro trigger |SCRIPT | //Trigger with comments | + + + @3: TEST FOR PUT TRIGGER /----------------------------------------------------------------------- + Scenario Outline: Update a trigger + + Given PUT this data: """ { - "tri_title": "trigger editado", - "tri_description": "descripcion editada" + "tri_title": "", + "tri_description": "" } """ - And that I want to update a resource with the key "tri_uid" stored in session array - And I request "project/251815090529619a99a2bf4013294414/trigger" + And that I want to update a resource with the key "tri_uid" stored in session array as variable "tri_uid_" + And I request "project//trigger" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" + Examples: - @3: TEST FOR GET TRIGGER /----------------------------------------------------------------------- - Scenario: Get a trigger - Given that I have a valid access_token - And that I want to get a resource with the key "tri_uid" stored in session array - And I request "project/251815090529619a99a2bf4013294414/trigger" + | project | tri_number | tri_title | tri_description | + | 251815090529619a99a2bf4013294414 | 1 | trigger editado 2 | descripcion editada | + | 251815090529619a99a2bf4013294414 | 2 | otro trigger editado 2 | descripcion de otro trigger editado | + + + @4: TEST FOR GET TRIGGER /----------------------------------------------------------------------- + Scenario Outline: Get a trigger + + Given that I want to get a resource with the key "tri_uid" stored in session array as variable "tri_uid_" + And I request "project//trigger" Then the response status code should be 200 And the response charset is "UTF-8" And the type is "object" - And that "tri_title" is set to "trigger editado" - And that "tri_description" is set to "descripcion editada" + And that "tri_title" is set to "" + And that "tri_description" is set to "" + + Examples: + + | project | tri_number | tri_title | tri_description | + | 251815090529619a99a2bf4013294414 | 1 | trigger editado 2 | descripcion editada | + | 251815090529619a99a2bf4013294414 | 2 | otro trigger editado 2 | descripcion de otro trigger editado | - @4: TEST FOR DELETE TRIGGER /----------------------------------------------------------------------- - Scenario: Get a trigger - Given that I have a valid access_token - And that I want to delete a resource with the key "tri_uid" stored in session array - And I request "project/251815090529619a99a2bf4013294414/trigger" + + @5: TEST FOR DELETE TRIGGER /----------------------------------------------------------------------- + Scenario Outline: Get a trigger + + Given that I want to delete a resource with the key "tri_uid" stored in session array as variable "tri_uid_" + And I request "project//trigger" 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 + And the type is "object" + + Examples: + + | project | tri_number | + | 251815090529619a99a2bf4013294414 | 1 | + | 251815090529619a99a2bf4013294414 | 2 | + + + + + @6: TEST FOR POST TRIGGER /-------------------------------------------------------------------- + Scenario Outline: Create a trigger + + Given POST this data: + """ + { + "tri_title": "", + "tri_description": "" + "tri_type": "", + "tri_webbot": "", + "tri_param": "PRIVATE" + } + """ + And I request "project//trigger" + Then the response status code should be 400 + + Examples: + + | project | tri_title | tri_description |tri_type | + | 251815090529619a99a2bf4013294414 | Especial !@#$%^&*(){[/½‘€¤@ | Trigger con caracteres especiales |SCRIPT | + | 251815090529619a99a2bf4013294414 | | Trigger con nombre en blanco |SCRIPT | + | 251815090529619a99a2bf4013294414 | Trigger 3 | Descripcion con caracteres especiales !@#$%^&*(){[/½‘€¤@ |SCRIPT | + | 251815090529619a99a2bf4013294414 | Trigger 4 | descripcion |SCRI123%@$| \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index faa40a073..5910fe55b 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1109,4 +1109,66 @@ class RestContext extends BehatContext } } -} + /** + * @Given /^that I want to update a resource with the key "([^"]*)" stored in session array as variable "([^"]*)"$/ + */ + public function thatIWantToUpdateAResourceWithTheKeyStoredInSessionArrayAsVariable($varName, $sessionVarName) + { + if (file_exists("session.data")) { + $sessionData = json_decode(file_get_contents("session.data")); + } else { + $sessionData = array(); + } + if (!isset($sessionData->$sessionVarName) ) { + $varValue = ''; + } else { + $varValue = $sessionData->$sessionVarName; + } + + $this->_restUpdateQueryStringSuffix = "/" . $varValue; + $this->_restObjectMethod = 'put'; + } + + /** + * @Given /^that I want to get a resource with the key "([^"]*)" stored in session array as variable "([^"]*)"$/ + */ + public function thatIWantToGetAResourceWithTheKeyStoredInSessionArrayAsVariable($varName, $sessionVarName) + { + if (file_exists("session.data")) { + $sessionData = json_decode(file_get_contents("session.data")); + } else { + $sessionData = array(); + } + if (!isset($sessionData->$sessionVarName) ) { + $varValue = ''; + } else { + $varValue = $sessionData->$sessionVarName; + } + + $this->_restGetQueryStringSuffix = "/" . $varValue; + $this->_restObjectMethod = 'get'; + } + + /** + * @Given /^that I want to delete a resource with the key "([^"]*)" stored in session array as variable "([^"]*)"$/ + */ + public function thatIWantToDeleteAResourceWithTheKeyStoredInSessionArrayAsVariable($varName, $sessionVarName) + { + if (file_exists("session.data")) { + $sessionData = json_decode(file_get_contents("session.data")); + } else { + $sessionData = array(); + } + if (!isset($sessionData->$varName) ) { + $varValue = ''; + } else { + $varValue = $sessionData->$sessionVarName; + } + + $this->_restDeleteQueryStringSuffix = "/" . $varValue; + $this->_restObjectMethod = 'delete'; + } + + + +} \ No newline at end of file