Avance de los features Cases Lists, Input Document Case, Output Document Case y creacion de una nueva funcion para contar la cantidad de casos en las listas

This commit is contained in:
Wendy Nestor
2014-03-27 09:40:24 -04:00
parent a9141f16e2
commit 9cf1500fcc
7 changed files with 519 additions and 235 deletions

View File

@@ -12,8 +12,7 @@ Scenario: Returns a list of the cases for the logged in user (Inbox)
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 1 records
Scenario: Get paging of list inbox
Given I request "cases/paged"
@@ -21,8 +20,7 @@ Scenario: Get paging of list inbox
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: Get order type of Descending
Given I request "cases?dir=DESC"
@@ -69,8 +67,7 @@ Scenario: Returns a list of the cases for the logged in user (Draft)
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 1 records
Scenario: Get paging of list Draft
Given I request "cases/draft/paged"
@@ -78,8 +75,7 @@ Scenario: Get paging of list Draft
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: Get order type of Descending
Given I request "cases/draft?dir=DESC"
@@ -126,8 +122,7 @@ Scenario: Returns a list of the cases for the logged in user (Participated)
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
Scenario: Get paging of list Participated
Given I request "cases/participated/paged"
@@ -135,8 +130,7 @@ Scenario: Get paging of list Participated
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: Get order type of Descending
Given I request "cases/participated?dir=DESC"
@@ -183,8 +177,7 @@ Scenario: Returns a list of the cases for the logged in user (Unassigned)
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 1 records
Scenario: Get paging of list Unassigned
Given I request "cases/unassigned/paged"
@@ -192,8 +185,7 @@ Scenario: Get paging of list Unassigned
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: Get order type of Descending
Given I request "cases/unassigned?dir=DESC"
@@ -240,8 +232,7 @@ Scenario: Returns a list of the cases for the logged in user (Paused)
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 1 records
Scenario: Get paging of list Paused
Given I request "cases/paused/paged"
@@ -249,8 +240,7 @@ Scenario: Get paging of list Paused
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: Get order type of Descending
Given I request "cases/paused?dir=DESC"
@@ -297,8 +287,7 @@ Scenario: Returns a list of the cases for the logged in user (Advanced Search)
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 1 records
Scenario: Get paging of list Advanced Search
Given I request "cases/advanced-search/paged"
@@ -306,8 +295,7 @@ Scenario: Get paging of list Advanced Search
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: Get order type of Descending
Given I request "cases/advanced-search?dir=DESC"

View File

@@ -1,37 +1,41 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Input Documents cases
Requirements:
a workspace with three cases of the process "Test Users-Step-Properties End Point"
a workspace with one case of the process "Test Input Document Case"
and there are three Input Document in the process
Background:
Given that I have a valid access_token
Scenario: Returns a list of the uploaded documents for a given case
Given I request "case{uid}/input-documents"
Given I request "cases/3980158475331a1a0288fd3009853776/input-documents"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 5 records
Scenario: Returns an uploaded documents for a given case
Given I request "case/{uid}/input-document/{uid}"
Given I request "cases/3980158475331a1a0288fd3009853776/input-document/6075490825331a1c5eebff9015468244"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the type is "object"
Scenario: Post metadata and then upload documents for a given case
Given POST this data:
Given POST upload an input document "/home/wendy/uploadfiles/test1.html" to "cases/3980158475331a1a0288fd3009853776/input-document"
"""
{
"inp_doc_uid": "inp_doc_uid",
"tas_uid": "tas_uid",
"app_doc_comment": "app_doc_comment"
}
"""
And I request "case/{uid}/input-document"
Then the response status code should be 201
Then the response status code should be 201
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "object"
@@ -40,7 +44,7 @@ Scenario: Post metadata and then upload documents for a given case
Scenario: Delete an uploaded or generated document from a case.
Given that I want to delete a resource with the key "" stored in session array
And I request "case/{uid}/input-document/{uid}"
And I request "cases/3980158475331a1a0288fd3009853776/input-document/{app_doc_uid}"
Then the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"

View File

@@ -0,0 +1,41 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Input Documents cases
Requirements:
a workspace with one case of the process "Test Input Document Case"
and there are three Input Document in the process and the verify in one case
Background:
Given that I have a valid access_token
Scenario: Returns a list of the uploaded documents for a given case
Given I request "cases/3980158475331a1a0288fd3009853776/input-documents"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 5 records
Scenario Outline: Returns an uploaded documents for a given case
Given I request "cases/3980158475331a1a0288fd3009853776/input-document/<input-document>"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "object"
And the "app_doc_uid" property equals "<app_doc_uid>"
And the "app_doc_filename" property equals "<app_doc_filename>"
And the "doc_uid" property equals "<doc_uid>"
And the "app_doc_version" property equals "<app_doc_version>"
And the "app_doc_create_date" property equals "<app_doc_create_date>"
And the "app_doc_create_user" property equals "<app_doc_create_user>"
And the "app_doc_type" property equals "<app_doc_type>"
And the "app_doc_index" property equals "<app_doc_index>"
And the "app_doc_link" property equals "<app_doc_link>"
Examples:
| test_description | input-document | app_doc_uid | app_doc_filename | doc_uid | app_doc_version | app_doc_create_date | app_doc_create_user | app_doc_type | app_doc_index | app_doc_link |
| Get Input "Desert.jpg" | 6075490825331a1c5eebff9015468244 | 6075490825331a1c5eebff9015468244 | Desert.jpg | 68671480353319e5e1dee74089764900 | 1 | 2014-03-25 11:33:25 | , Administrator (admin) | INPUT | 1 | cases/cases_ShowDocument?a=6075490825331a1c5eebff9015468244&v=1 |
| Get Input "Screenshot Case Archive.docx" | 3770386635331a1f49c78e8070071944 | 3770386635331a1f49c78e8070071944 | Screenshot Case Archive.docx | 68671480353319e5e1dee74089764900 | 1 | 2014-03-25 11:34:12 | , Administrator (admin) | INPUT | 2 | cases/cases_ShowDocument?a=3770386635331a1f49c78e8070071944&v=1 |
| Get Input "alert_message.html" | 6382509235331a235b27a82003894796 | 6382509235331a235b27a82003894796 | alert_message.htm | 68588088053319e68d88f67081331478 | 1 | 2014-03-25 11:35:17 | , Administrator (admin) | INPUT | 4 | cases/cases_ShowDocument?a=6382509235331a235b27a82003894796&v=1 |
| Get Input "actionsByEmail-2.5.0.28.tar" | 3548449385331a24a34d273018695729 | 3548449385331a24a34d273018695729 | actionsByEmail-2.5.0.28.tar | 68588088053319e68d88f67081331478 | 1 | 2014-03-25 11:35:38 | , Administrator (admin) | INPUT | 5 | cases/cases_ShowDocument?a=3548449385331a24a34d273018695729&v=1 |
| Get Input "Step_ordenamiento (5).pm" | 3814366275331a21b80d603018480738 | 3814366275331a21b80d603018480738 | Step_ordenamiento (5).pm | 68588088053319e68d88f67081331478 | 2 | 2014-03-25 11:36:11 | , Administrator (admin) | INPUT | 6 | cases/cases_ShowDocument?a=3814366275331a21b80d603018480738&v=2 |

View File

@@ -1,42 +1,42 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Output Documents cases
Requirements:
a workspace with three cases of the process "Test Users-Step-Properties End Point"
a workspace with one case of the process "Test Output Document Case"
and there are six Output Documents in the process
Background:
Given that I have a valid access_token
Scenario: Returns a list of the generated documents for a given case
Given I request "case{uid}/output-documents"
Scenario: Returns a list of the generated documents for a given cases
Given I request "cases/24438110553330068247694030259829/output-documents"
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
Scenario: Returns an uploaded documents for a given case
Given I request "case/{uid}/output-document/{uid}"
Scenario: Returns an generated document for a given case
Given I request "cases/24438110553330068247694030259829/output-document/3000248055333006ab56a01005891659"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the type is "Object"
Scenario: Generate or regenerates an output documents for a given case
Given POST this data:
"""
{
"out_doc_uid": "2087233055331ef4127d238097105696"
}
"""
And I request "case/{uid}/output-document"
And I request "case/24438110553330068247694030259829/output-document"
Then the response status code should be 201
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "object"
And store "" in session array
And the type is "array"
Scenario: Delete an uploaded or generated document from a case.
Given that I want to delete a resource with the key "" stored in session array

View File

@@ -0,0 +1,95 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Output Documents cases Main Tests
Requirements:
a workspace with one case of the process "Test Output Document Case"
and there are six Output Documents in the process
Background:
Given that I have a valid access_token
Scenario Outline: Generate or regenerates an output documents for a given case
Given POST this data:
"""
{
"out_doc_uid": "<out_doc_uid>"
}
"""
And I request "cases/551390121533343ee886813057396196/output-document"
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 store "app_doc_uid" in session array as variable "app_doc_uid_<app_doc_uid_number>"
Examples:
| test_description | app_doc_uid_number | out_doc_uid |
| Generate "output document only doc" | 1 | 2087233055331ef4127d238097105696 |
| Generate "output document with versioning" | 2 | 5961108155331efc976cee7011445347 |
| Generate "output document only pdf" | 3 | 7074907425331ef837aa8b2055964905 |
| Generate "output document old version" | 4 | 7385645355331ee70ea6a87029841722 |
| Generate "output document with pdf security" | 5 | 8594478445331eff2d30767061922215 |
Scenario: Returns a list of the generated documents for a given cases
Given I request "cases/551390121533343ee886813057396196/output-documents"
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 "app_doc_filename" property in row 0 equals "output document new version.pdf"
And the "app_doc_filename" property in row 1 equals "output document with pdf security.pdf"
And the "app_doc_filename" property in row 2 equals "output document only pdf.pdf"
And the "app_doc_filename" property in row 3 equals "output document only doc.doc"
And the "app_doc_filename" property in row 4 equals "output document with versioning.pdf"
And the "app_doc_filename" property in row 5 equals "output document old version.pdf"
Scenario Outline: Returns an generated document for a given case
Given I request "cases/551390121533343ee886813057396196/output-document/app_doc_uid" with the key "app_doc_uid" stored in session array as variable "app_doc_uid_<app_doc_uid_number>"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "Object"
And the "app_doc_uid" property equals "<app_doc_uid>"
And the "app_doc_filename" property equals "<app_doc_filename>"
And the "doc_uid" property equals "<doc_uid>"
And the "app_doc_version" property equals "<app_doc_version>"
And the "app_doc_create_date" property equals "<app_doc_create_date>"
And the "app_doc_create_user" property equals "<app_doc_create_user>"
And the "app_doc_type" property equals "<app_doc_type>"
And the "app_doc_index" property equals "<app_doc_index>"
And the "app_doc_link" property equals "<app_doc_link>"
Examples:
| test_description | app_doc_uid_number | app_doc_filename | doc_uid | app_doc_version | app_doc_create_date | app_doc_create_user | app_doc_type | app_doc_index | app_doc_link |
| Get Output "output document new version.pdf" | 1 | output document new version.pdf | 3391282325331ee81c84715031595672 | 1 | 2014-03-26 12:29:30 | , Administrator (admin) | OUTPUT BOTH | 1 | cases/cases_ShowOutputDocument?a=3000248055333006ab56a01005891659&v=1&ext=pdf&random=1256696859 |
| Get Output "output document old version.pdf" | 2 | output document old version.pdf | 7385645355331ee70ea6a87029841722 | 1 | 2014-03-26 12:29:33 | , Administrator (admin) | OUTPUT BOTH | 2 | cases/cases_ShowOutputDocument?a=8865432395333006d75d824038425476&v=1&ext=pdf&random=1838956992 |
| Get Output "output document only doc.doc" | 3 | output document only doc.doc | 2087233055331ef4127d238097105696 | 1 | 2014-03-26 12:29:35 | , Administrator (admin) | OUTPUT DOC | 3 | cases/cases_ShowOutputDocument?a=4447256265333006fe6fb00061503934&v=1&ext=doc&random=949245639 |
| Get Output "output document only pdf.pdf" | 4 | output document only pdf.pdf | 7074907425331ef837aa8b2055964905 | 1 | 2014-03-26 12:29:38 | , Administrator (admin) | OUTPUT PDF | 4 | cases/cases_ShowOutputDocument?a=828039615533300724fdcb6091842678&v=1&ext=pdf&random=401448562 |
| Get Output "output document with pdf security.pdf" | 5 | output document with pdf security.pdf | 8594478445331eff2d30767061922215 | 1 | 2014-03-26 12:29:40 | , Administrator (admin) | OUTPUT BOTH | 5 | cases/cases_ShowOutputDocument?a=25293137553330074713ab9073501576&v=1&ext=pdf&random=324546362 |
| Get Output "output document with versioning.pdf" | 6 | output document with versioning.pdf | 5961108155331efc976cee7011445347 | 1 | 2014-03-26 12:29:42 | , Administrator (admin) | OUTPUT BOTH | 6 | cases/cases_ShowOutputDocument?a=354826487533300769e65e0027827984&v=1&ext=pdf&random=1682978530 |
Scenario Outline: Delete an uploaded or generated document from a case.
Given that I want to delete a resource with the key "app_doc_uid" stored in session array as variable "app_doc_uid_<app_doc_uid_number>"
And I request "cases/551390121533343ee886813057396196/output-document"
And the response status code should be 200
And the content type is "application/json"
And the response charset is "UTF-8"
And the type is "object"
Examples:
| app_doc_uid_number |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |

View File

@@ -1191,6 +1191,8 @@ class RestContext extends BehatContext
}
$this->_restDeleteQueryStringSuffix = "/" . $varValue;
$this->printDebug("$varName = $varValue\nsessionVarName = $sessionVarName\n");
$this->_restObjectMethod = 'delete';
}
@@ -1259,7 +1261,7 @@ class RestContext extends BehatContext
$pageUrl = str_replace($varName, $varValue, $pageUrl);
//$this->printDebug("URL: $pageUrl\n$varName = $varValue\n");
$this->printDebug("URL: $pageUrl\n$varName = $varValue\nsessionVarName = $sessionVarName\n");
$this->iRequest($pageUrl, $urlType);
@@ -1435,4 +1437,87 @@ class RestContext extends BehatContext
$this->_restObjectMethod = 'delete';
}
/**
* @Given /^store response count in session variable as "([^"]*)"$/
*/
public function storeResponseCountInSessionVariableAs($varName)
{
$data = $this->_data;
$currentRecordsCount=count($data);
if (file_exists("session.data")) {
$sessionData = json_decode(file_get_contents("session.data"));
} else {
$sessionData = new StdClass();
}
$sessionData->$varName = $currentRecordsCount;
file_put_contents("session.data", json_encode($sessionData));
}
/**
* @Given /^the response has (\d+) records more than "([^"]*)"$/
*/
public function theResponseHasRecordsMoreThan($records, $base)
{
if (file_exists("session.data")) {
$sessionData = json_decode(file_get_contents("session.data"));
} else {
$sessionData = array();
}
if (!isset($sessionData->$base) ) {
$varValue = '';
} else {
$varValue = $sessionData->$base;
}
$totalRecords=$varValue + $records;
$this->theResponseHasRecords($totalRecords);
}
/**
* @Given /^POST upload an input document "([^"]*)" to "([^"]*)"$/
*/
public function postUploadAnInputDocumentTo($file, $url, PyStringNode $string)
{
$baseUrl = $this->getParameter('base_url');
$url = $baseUrl.$url;
$accesstoken = $this->getParameter('access_token');
$headr = array();
$headr[] = 'Authorization: Bearer '.$accesstoken;
$postFields = json_decode($string);
$postFields->form ='@'.$file;
//print_r($postFields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
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);
print_r($postResult);
curl_close($ch);
//Save result as usual
$this->_type = 'json';
//$this->_response = json_decode($postResult);
$this->_data = json_decode($postResult);
// $postResult = (array)json_decode($postResult);
}
}