diff --git a/features/backend/activity/main_tests_activity.feature b/features/backend/activity/main_tests_activity.feature index 8dbc01fd4..09e2e7256 100644 --- a/features/backend/activity/main_tests_activity.feature +++ b/features/backend/activity/main_tests_activity.feature @@ -121,7 +121,7 @@ Feature: Activity Resources Main Tests And the property "tas_assign_type" of "properties" is set to "" And the property "tas_assign_variable" of "properties" is set to "" And the property "tas_group_variable" of "properties" is set to "" - And the property "tas_selfservice_timeout" of "properties" is set to "" + And the property "tas_selfservice_timeout" of "properties" is set to And the property "tas_selfservice_time" of "properties" is set to "" And the property "tas_selfservice_time_unit" of "properties" is set to "" And the property "tas_transfer_fly" of "properties" is set to "" diff --git a/features/backend/files_manager/main_test_files_manager.feature b/features/backend/files_manager/main_test_files_manager.feature index ae851cb1c..5b9e54236 100644 --- a/features/backend/files_manager/main_test_files_manager.feature +++ b/features/backend/files_manager/main_test_files_manager.feature @@ -1,7 +1,7 @@ @ProcessMakerMichelangelo @RestAPI Feature: Files Manager Resources Main Tests Requirements: - a workspace with the process 4224292655297723eb98691001100052 ("Test Users-Step-Properties End Point") already loaded + a workspace with the process 1265557095225ff5c688f46031700471 ("Test Michelangelo") already loaded there are two output documents in the process Background: @@ -14,6 +14,8 @@ Feature: Files Manager Resources Main Tests And the response charset is "UTF-8" And the content type is "application/json" And the type is "array" + And the "name" property in row 0 equals "templates" + And the "name" property in row 1 equals "public" Scenario: Get a list public folder of process files manager Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=public" @@ -21,6 +23,7 @@ Feature: Files Manager Resources Main Tests And the response charset is "UTF-8" And the content type is "application/json" And the type is "array" + And the response has 0 records Scenario: Get a list templates folder of process files manager Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=templates" @@ -28,8 +31,9 @@ Feature: Files Manager Resources Main Tests And the response charset is "UTF-8" And the content type is "application/json" And the type is "array" + And the response has 1 records - Scenario Outline: Post files + Scenario Outline: Create files and subfolders Given POST this data: """ { @@ -43,14 +47,14 @@ Feature: Files Manager Resources Main Tests And the response charset is "UTF-8" And the content type is "application/json" And the type is "" - And store "prf_uid" in session array as variable "prf_uid" + And store "prf_uid" in session array as variable "prf_uid_" Examples: - | test_description | file_name | path | content | http_code | type | i | - | into public folder | testbehat1.txt | public/ | test | 200 | object | 0 | - | into mailtemplates folder | testbehat1.txt | templates/ | test | 200 | object | 1 | - | into public subfolder | testbehat1.txt | public/test_folder | test | 200 | object | 2 | - | into mailtemplates subfolder | testbehat1.txt | templates/test_folder | test | 200 | object | 3 | + | test_description | file_name | path | content | http_code | type | prf_number | + | into public folder | file_test_1.txt | public/ | only text | 200 | object | 0 | + | into mailtemplates folder | file_test_2.html | templates/ |

Test

html test

| 200 | object | 1 | + | into public subfolder | file_test_3.txt | public/public_subfolder | test | 200 | object | 2 | + | into mailtemplates subfolder | file_test_4.html | templates/templates_subfolder | test | 200 | object | 3 | Scenario Outline: Post files Given PUT this data: @@ -59,7 +63,7 @@ Feature: Files Manager Resources Main Tests "prf_content": "" } """ - And that I want to update a resource with the key "prf_uid" stored in session array as variable "prf_uid" + And that I want to update a resource with the key "prf_uid" stored in session array as variable "prf_uid_" And I request "project/1265557095225ff5c688f46031700471/file-manager" Then the response status code should be And the response charset is "UTF-8" @@ -67,31 +71,41 @@ Feature: Files Manager Resources Main Tests And the type is "" Examples: - | test_description | content | http_code | type | i | - | put into public folder | put test | 200 | object | 0 | - | put into mailtemplates folder | put test | 200 | object | 1 | - | put into public subfolder | put test | 200 | object | 2 | - | put into mailtemplates subfolder | put test | 200 | object | 3 | + | test_description | content | http_code | type | prf_number | + | put into public folder | only text - modified | 200 | object | 0 | + | put into mailtemplates folder |

Test

html test

modified | 200 | object | 1 | + | put into public subfolder | put test | 200 | object | 2 | + | put into mailtemplates subfolder | put test | 200 | object | 3 | + + #Para que funcione este test, debe existir el archivo que se quiere subir + Scenario Outline: Upload files to same folders + Given POST I want to upload the file "" to path "". Url "project/1265557095225ff5c688f46031700471/file-manager" + And store "prf_uid" in session array as variable "prf_uid_" + + Examples: + | file | path | prf_number | + |/home/daniel/test1.html | templates | 4 | + |/home/daniel/test2.html | templates | 5 | + |/home/daniel/test.txt | public | 6 | + Scenario Outline: Delete file - Given that I want to delete a resource with the key "prf_uid" stored in session array as variable "prf_uid" - And I request "project/1265557095225ff5c688f46031700471/file-manager" + Given that I want to delete a resource with the key "prf_uid" stored in session array as variable "prf_uid_" + And I request "project/1265557095225ff5c688f46031700471/file-manager" + Then the response status code should be 200 And the response charset is "UTF-8" Examples: - | test_description | i | - | delete public folder | 0 | - | delete mailtemplates folder | 1 | - | delete public subfolder | 2 | - | delete mailtemplates subfolder | 3 | + | test_description | prf_number | + | delete public folder | 0 | + | delete mailtemplates folder | 1 | + | delete public subfolder | 2 | + | delete mailtemplates subfolder | 3 | + | delete mailtemplates subfolder | 4 | + | delete mailtemplates subfolder | 5 | + | delete mailtemplates subfolder | 6 | - #Para que funcione este test, debe existir el archivo que se quiere subir - Scenario: Post files - Given POST I want to upload the file "/home/daniel/test.txt" to path "templates". Url "project/1265557095225ff5c688f46031700471/file-manager" + - Scenario: Delete file - Given that I want to delete a resource with the key "prf_uid" stored in session array as variable "prf_uid" - And I request "project/1265557095225ff5c688f46031700471/file-manager" - Then the response status code should be 200 - And the response charset is "UTF-8" + \ No newline at end of file diff --git a/features/backend/files_manager/negative_tests_files_manager.feature b/features/backend/files_manager/negative_tests_files_manager.feature index e69de29bb..9af8ac0e5 100644 --- a/features/backend/files_manager/negative_tests_files_manager.feature +++ b/features/backend/files_manager/negative_tests_files_manager.feature @@ -0,0 +1,6 @@ +# get a list of an inexistent path +# try to create a file with same name as an existent +# try to upload a file with same name as an existent +# how to get content if a file +# how to delete sub folders +# upload bi files \ No newline at end of file diff --git a/features/backend/process_variables/main_tests_process_variables.feature b/features/backend/process_variables/main_tests_process_variables.feature new file mode 100644 index 000000000..e69de29bb diff --git a/features/backend/process_variables/negative_tests_process_variables.feature b/features/backend/process_variables/negative_tests_process_variables.feature new file mode 100644 index 000000000..e69de29bb diff --git a/features/backend/trigger_wizard/basic_sequence_trigger_wizard.feature b/features/backend/trigger_wizard/basic_sequence_trigger_wizard.feature new file mode 100644 index 000000000..916ffaccf --- /dev/null +++ b/features/backend/trigger_wizard/basic_sequence_trigger_wizard.feature @@ -0,0 +1,173 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Group + Requirements: + a workspace with the process 14414793652a5d718b65590036026581 ("Sample Project #1") already loaded + there are three activities in the process + + Background: + Given that I have a valid access_token + + #GET /api/1.0/{workspace}/project/{prj_uid}/trigger-wizards + # Get list Trigger Wizards + Scenario Outline: Get list Trigger Wizards + And I request "project/14414793652a5d718b65590036026581/trigger-wizards" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the "lib_name" property in row equals "" + And the "lib_title" property in row equals "" + And the "lib_class_name" property in row equals "" + + Examples: + | i | lib_name | lib_title | lib_class_name | + | 0 | pmFunctions | ProcessMaker Functions | class.pmFunctions.php | + + #GET /api/1.0/{workspace}/project/{prj_uid}/trigger-wizard/{lib_name} + # Get a single Library + Scenario Outline: Get a single Library + And I request "project/14414793652a5d718b65590036026581/trigger-wizard/" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "lib_name" is set to "" + And that "lib_title" is set to "" + And that "lib_class_name" is set to "" + + Examples: + | lib_name | lib_title | lib_class_name | + | pmFunctions | ProcessMaker Functions | class.pmFunctions.php | + + #GET /api/1.0/{workspace}/project/{prj_uid}/trigger-wizard/{lib_name}/{fn_name} + # Get a single Function of the Library + Scenario Outline: Get a single Function of the Library + And I request "project/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "fn_name" is set to "" + And that "fn_label" is set to "" + + Examples: + | lib_name | fn_name | fn_label | + | pmFunctions | PMFAddAttachmentToArray | Add Element in Array | + + #GET /api/1.0/{workspace}/project/{prj_uid}/triggers + # Get a List of triggers of a project + Scenario: Get a List of triggers of a project + And I request "project/14414793652a5d718b65590036026581/triggers" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the json data is an empty array + + #POST /api/1.0/{workspace}/project/{prj_uid}/trigger-wizard/{lib_name}/{fn_name} + # Create new Trigger + Scenario Outline: Create new Trigger + Given POST this data: + """ + { + "tri_title": "", + "tri_description": "", + "tri_type": "", + "tri_params": { + "input": { + "arrayData": "", + "index": "", + "value": "", + "suffix": "" + }, + "output": { + "tri_answer": "" + } + } + } + """ + And I request "project/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the type is "object" + And store "tri_uid" in session array as variable "tri_uid" + + Examples: + | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.arrayData | tri_params.input.index | tri_params.input.value | tri_params.input.suffix | tri_params.output.tri_answer | + | 0 | pmFunctions | PMFAddAttachmentToArray | My trigger | | SCRIPT | array(1, 2) | 1 | 2 | My Copy({i}) | $respuesta | + + #PUT /api/1.0/{workspace}/project/{prj_uid}/trigger-wizard/{lib_name}/{fn_name}/{tri_uid} + # Update Trigger + Scenario Outline: Update Trigger + Given PUT this data: + """ + { + "tri_title": "", + "tri_description": "", + "tri_type": "", + "tri_params": { + "input": { + "arrayData": "", + "index": "", + "value": "", + "suffix": "" + }, + "output": { + "tri_answer": "" + } + } + } + """ + 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/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + Examples: + | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.arrayData | tri_params.input.index | tri_params.input.value | tri_params.input.suffix | tri_params.output.tri_answer | + | 0 | pmFunctions | PMFAddAttachmentToArray | My trigger... | ... | SCRIPT | array(1, 2, 3, 4) | 1 | 2 | My Copy2({i}) | $r | + + #GET /api/1.0/{workspace}/project/{prj_uid}/trigger-wizard/{lib_name}/{fn_name}/{tri_uid} + # Get a Trigger that was created with the wizard + Scenario Outline: Get a Trigger that was created with the wizard + 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/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + 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 "" + And that "tri_description" is set to "" + And that "tri_type" is set to "" + + Examples: + | i | lib_name | fn_name | tri_title | tri_description | tri_type | + | 0 | pmFunctions | PMFAddAttachmentToArray | My trigger... | ... | SCRIPT | + + #DELETE /api/1.0/{workspace}/project/{prj_uid}/trigger/{tri_uid} + # Delete a trigger of a project + Scenario Outline: Delete a trigger of a project + 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/14414793652a5d718b65590036026581/trigger" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + Examples: + | i | + | 0 | + + #GET /api/1.0/{workspace}/project/{prj_uid}/triggers + # Get a List of triggers of a project + Scenario: Get a List of triggers of a project + And I request "project/14414793652a5d718b65590036026581/triggers" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the json data is an empty array + diff --git a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature index e69de29bb..d5a1a567f 100644 --- a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature +++ b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature @@ -0,0 +1,176 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Group + Requirements: + a workspace with the process 14414793652a5d718b65590036026581 ("Sample Project #1") already loaded + there are three activities in the process + + Background: + Given that I have a valid access_token + + + Scenario Outline: Get the Trigger Wizards List when there are exactly 6 library + And I request "project/14414793652a5d718b65590036026581/trigger-wizards" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the response has 6 records + And the "lib_name" property in row equals "" + And the "lib_title" property in row equals "" + And the "lib_class_name" property in row equals "" + + Examples: + | i | lib_name | lib_title | lib_class_name | + | 0 | pmFunctions | ProcessMaker Functions | class.pmFunctions.php | + | 1 | pmTalend | Talend ETL Integration | class.pmTalend.pmFunctions.php | + | 2 | pmSugar | Sugar CRM Triggers | class.pmSugar.pmFunctions.php | + + + Scenario Outline: Get a single Library + And I request "project/14414793652a5d718b65590036026581/trigger-wizard/" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "lib_name" is set to "" + And that "lib_title" is set to "" + And that "lib_class_name" is set to "" + + Examples: + | lib_name | lib_title | lib_class_name | + | pmFunctions | ProcessMaker Functions | class.pmFunctions.php | + | pmTrSharepoint | Sharepoint DWS Triggers v. 0.1 | class.pmTrSharepoint.pmFunctions.php | + | pmTrAlfresco | Alfresco DM Triggers v. 0.1 | class.pmTrAlfresco.pmFunctions.php | + | pmZimbra | Zimbra Triggers v. 0.1 | class.pmZimbra.pmFunctions.php | + | pmTalend | Talend ETL Integration | class.pmTalend.pmFunctions.php | + | pmSugar | Sugar CRM Triggers | class.pmSugar.pmFunctions.php | + + + Scenario Outline: Get a single Function of the Library + And I request "project/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + And that "fn_name" is set to "" + And that "fn_label" is set to "" + + Examples: + | lib_name | fn_name | fn_label | + | pmFunctions | PMFAddAttachmentToArray | Add Element in Array | + | pmTrSharepoint | createDWS | Create a DWS in Sharepoint server | + | pmTrAlfresco | Checkin | Checkin document/file | + | pmZimbra | createZimbraAppointment | Create Appointment | + | pmTalend | executeTalendWebservice | Executes a Talend Web Service | + | pmSugar | CreateSugarAccount | Creates SugarCRM entries from the Account module | + + + Scenario: Get a List of triggers of a project + And I request "project/14414793652a5d718b65590036026581/triggers" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the json data is an empty array + + + Scenario Outline: Create new Trigger + Given POST this data: + """ + { + "tri_title": "", + "tri_description": "", + "tri_type": "", + "tri_params": { + "input": { + "arrayData": "", + "index": "", + "value": "", + "suffix": "" + }, + "output": { + "tri_answer": "" + } + } + } + """ + And I request "project/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the type is "object" + And store "tri_uid" in session array as variable "tri_uid" + + Examples: + | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.arrayData | tri_params.input.index | tri_params.input.value | tri_params.input.suffix | tri_params.output.tri_answer | + | 0 | pmFunctions | PMFAddAttachmentToArray | My trigger | | SCRIPT | array(1, 2) | 1 | 2 | My Copy({i}) | $respuesta | + + + Scenario Outline: Update Trigger + Given PUT this data: + """ + { + "tri_title": "", + "tri_description": "", + "tri_type": "", + "tri_params": { + "input": { + "arrayData": "", + "index": "", + "value": "", + "suffix": "" + }, + "output": { + "tri_answer": "" + } + } + } + """ + 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/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + Examples: + | i | lib_name | fn_name | tri_title | tri_description | tri_type | tri_params.input.arrayData | tri_params.input.index | tri_params.input.value | tri_params.input.suffix | tri_params.output.tri_answer | + | 0 | pmFunctions | PMFAddAttachmentToArray | My trigger... | ... | SCRIPT | array(1, 2, 3, 4) | 1 | 2 | My Copy2({i}) | $r | + + + Scenario Outline: Get a Trigger that was created with the wizard + 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/14414793652a5d718b65590036026581/trigger-wizard//" + And the content type is "application/json" + 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 "" + And that "tri_description" is set to "" + And that "tri_type" is set to "" + + Examples: + | i | lib_name | fn_name | tri_title | tri_description | tri_type | + | 0 | pmFunctions | PMFAddAttachmentToArray | My trigger... | ... | SCRIPT | + + + Scenario Outline: Delete a trigger of a project + 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/14414793652a5d718b65590036026581/trigger" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "object" + + Examples: + | i | + | 0 | + + + Scenario: Get a List of triggers of a project + And I request "project/14414793652a5d718b65590036026581/triggers" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the type is "array" + And the json data is an empty array \ No newline at end of file diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 8f0051c5c..c8c00b112 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1186,6 +1186,7 @@ class RestContext extends BehatContext } $this->_restDeleteQueryStringSuffix = "/" . $varValue; + $this->_restObjectMethod = 'delete'; } @@ -1249,7 +1250,7 @@ class RestContext extends BehatContext } else { $varValue = $sessionData->$sessionVarName; } - +print_r($sessionData); $pageUrl = str_replace($varName, $varValue, $pageUrl); @@ -1332,12 +1333,24 @@ class RestContext extends BehatContext curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch); + curl_close($ch); + + //Save result as usual + $this->_type = 'json'; + $this->_data = json_decode($postResult); + $postResult = (array)json_decode($postResult); + + + + + if (sizeof($postResult) > 2) { $prfUid = $postResult["prf_uid"]; } else { - var_dump($postResult["error"]); + throw new Exception($postResult["error"]->message); + //var_dump($postResult["error"]); } $url = $url.'/'.$prfUid."/upload"; $ch = curl_init(); @@ -1350,10 +1363,13 @@ class RestContext extends BehatContext curl_close($ch); //se guarda el prf_uid en una variable - $varName = 'prf_uid'; - $sessionData = new StdClass(); - $sessionData->$varName = $prfUid; - file_put_contents("session.data", json_encode($sessionData)); + + //Wen: Esto borra todo el session data, por favor corregir o no guardar la variable desde aca + + //$varName = 'prf_uid'; + //$sessionData = new StdClass(); + //$sessionData->$varName = $prfUid; + //file_put_contents("session.data", json_encode($sessionData)); } //UPLOAD IMAGE