Avance del feature file manager y correccion en el archivo rest debido a las variables de la respuesta json no estaban presentes como cuando se hace POST, tambien se hizo modificaciones a los features activity, trigger wizard

This commit is contained in:
Wendy Nestor
2014-03-05 09:58:35 -04:00
parent 2a9097a35c
commit 807cd6fbbc
8 changed files with 421 additions and 36 deletions

View File

@@ -121,7 +121,7 @@ Feature: Activity Resources Main Tests
And the property "tas_assign_type" of "properties" is set to "<tas_assign_type>"
And the property "tas_assign_variable" of "properties" is set to "<tas_assign_variable>"
And the property "tas_group_variable" of "properties" is set to "<tas_group_variable>"
And the property "tas_selfservice_timeout" of "properties" is set to "<tas_selfservice_timeout>"
And the property "tas_selfservice_timeout" of "properties" is set to <tas_selfservice_timeout>
And the property "tas_selfservice_time" of "properties" is set to "<tas_selfservice_time>"
And the property "tas_selfservice_time_unit" of "properties" is set to "<tas_selfservice_time_unit>"
And the property "tas_transfer_fly" of "properties" is set to "<tas_transfer_fly>"

View File

@@ -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 "<type>"
And store "prf_uid" in session array as variable "prf_uid<i>"
And store "prf_uid" in session array as variable "prf_uid_<prf_number>"
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/ | <h1>Test</h1><p>html test</p> | 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": "<content>"
}
"""
And that I want to update a resource with the key "prf_uid" stored in session array as variable "prf_uid<i>"
And that I want to update a resource with the key "prf_uid" stored in session array as variable "prf_uid_<prf_number>"
And I request "project/1265557095225ff5c688f46031700471/file-manager"
Then the response status code should be <http_code>
And the response charset is "UTF-8"
@@ -67,31 +71,41 @@ Feature: Files Manager Resources Main Tests
And the type is "<type>"
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 |
| test_description | content | http_code | type | prf_number |
| put into public folder | only text - modified | 200 | object | 0 |
| put into mailtemplates folder | <h1>Test</h1><p>html test</p><i>modified</i> | 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 "<file>" to path "<path>". Url "project/1265557095225ff5c688f46031700471/file-manager"
And store "prf_uid" in session array as variable "prf_uid_<prf_number>"
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<i>"
Given that I want to delete a resource with the key "prf_uid" stored in session array as variable "prf_uid_<prf_number>"
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 |
| 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"

View File

@@ -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

View File

@@ -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 <i> equals "<lib_name>"
And the "lib_title" property in row <i> equals "<lib_title>"
And the "lib_class_name" property in row <i> equals "<lib_class_name>"
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/<lib_name>"
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 "<lib_name>"
And that "lib_title" is set to "<lib_title>"
And that "lib_class_name" is set to "<lib_class_name>"
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/<lib_name>/<fn_name>"
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 "<fn_name>"
And that "fn_label" is set to "<fn_label>"
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_title>",
"tri_description": "<tri_description>",
"tri_type": "<tri_type>",
"tri_params": {
"input": {
"arrayData": "<tri_params.input.arrayData>",
"index": "<tri_params.input.index>",
"value": "<tri_params.input.value>",
"suffix": "<tri_params.input.suffix>"
},
"output": {
"tri_answer": "<tri_params.output.tri_answer>"
}
}
}
"""
And I request "project/14414793652a5d718b65590036026581/trigger-wizard/<lib_name>/<fn_name>"
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<i>"
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_title>",
"tri_description": "<tri_description>",
"tri_type": "<tri_type>",
"tri_params": {
"input": {
"arrayData": "<tri_params.input.arrayData>",
"index": "<tri_params.input.index>",
"value": "<tri_params.input.value>",
"suffix": "<tri_params.input.suffix>"
},
"output": {
"tri_answer": "<tri_params.output.tri_answer>"
}
}
}
"""
And that I want to update a resource with the key "tri_uid" stored in session array as variable "tri_uid<i>"
And I request "project/14414793652a5d718b65590036026581/trigger-wizard/<lib_name>/<fn_name>"
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<i>"
And I request "project/14414793652a5d718b65590036026581/trigger-wizard/<lib_name>/<fn_name>"
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 "<tri_title>"
And that "tri_description" is set to "<tri_description>"
And that "tri_type" is set to "<tri_type>"
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<i>"
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

View File

@@ -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 <i> equals "<lib_name>"
And the "lib_title" property in row <i> equals "<lib_title>"
And the "lib_class_name" property in row <i> equals "<lib_class_name>"
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/<lib_name>"
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 "<lib_name>"
And that "lib_title" is set to "<lib_title>"
And that "lib_class_name" is set to "<lib_class_name>"
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/<lib_name>/<fn_name>"
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 "<fn_name>"
And that "fn_label" is set to "<fn_label>"
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_title>",
"tri_description": "<tri_description>",
"tri_type": "<tri_type>",
"tri_params": {
"input": {
"arrayData": "<tri_params.input.arrayData>",
"index": "<tri_params.input.index>",
"value": "<tri_params.input.value>",
"suffix": "<tri_params.input.suffix>"
},
"output": {
"tri_answer": "<tri_params.output.tri_answer>"
}
}
}
"""
And I request "project/14414793652a5d718b65590036026581/trigger-wizard/<lib_name>/<fn_name>"
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<i>"
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_title>",
"tri_description": "<tri_description>",
"tri_type": "<tri_type>",
"tri_params": {
"input": {
"arrayData": "<tri_params.input.arrayData>",
"index": "<tri_params.input.index>",
"value": "<tri_params.input.value>",
"suffix": "<tri_params.input.suffix>"
},
"output": {
"tri_answer": "<tri_params.output.tri_answer>"
}
}
}
"""
And that I want to update a resource with the key "tri_uid" stored in session array as variable "tri_uid<i>"
And I request "project/14414793652a5d718b65590036026581/trigger-wizard/<lib_name>/<fn_name>"
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<i>"
And I request "project/14414793652a5d718b65590036026581/trigger-wizard/<lib_name>/<fn_name>"
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 "<tri_title>"
And that "tri_description" is set to "<tri_description>"
And that "tri_type" is set to "<tri_type>"
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<i>"
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

View File

@@ -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