From 42f8e30e35fda9659ffdfbde6ef66d11c9212292 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 6 Mar 2014 09:28:34 -0400 Subject: [PATCH] Mejoras y avance de los feature case scheduler, file manager, trigger wizards --- .../main_tests_case_scheduler.feature | 2 +- .../negative_tests_case_scheduler.feature | 2 +- .../main_test_files_manager.feature | 125 ++++++++++++++---- .../negative_tests_files_manager.feature | 54 +++++++- .../main_tests_trigger_wizards.feature | 7 +- .../negative_tests_triggers_wizards.feature | 8 ++ features/bootstrap/RestContext.php | 1 - 7 files changed, 164 insertions(+), 35 deletions(-) diff --git a/features/backend/case_scheduler/main_tests_case_scheduler.feature b/features/backend/case_scheduler/main_tests_case_scheduler.feature index 8b9a62d11..b6d74f0a0 100644 --- a/features/backend/case_scheduler/main_tests_case_scheduler.feature +++ b/features/backend/case_scheduler/main_tests_case_scheduler.feature @@ -84,7 +84,7 @@ Feature: Case Scheduler Main Tests """ And I request "project/1265557095225ff5c688f46031700471/case-scheduler" Then the response status code should be 400 - And the response status message should have the following text "duplicate" + And the response status message should have the following text "Duplicate Case Scheduler name" Scenario: Get the case schedulers list when there are exactly 13 case schedulers diff --git a/features/backend/case_scheduler/negative_tests_case_scheduler.feature b/features/backend/case_scheduler/negative_tests_case_scheduler.feature index 7b0773b85..87869ff32 100644 --- a/features/backend/case_scheduler/negative_tests_case_scheduler.feature +++ b/features/backend/case_scheduler/negative_tests_case_scheduler.feature @@ -36,7 +36,7 @@ Feature: Output Documents Negative Tests | Invalid sch_option | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Daily 123@#$ 21 | 20 | 2014-01-30 | 2014-02-20 | 12:00 | | | | | | | 400 | sch_option | | Invalid sch_del_user_name | sample | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly monday 345%$# | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 1 | | | | | | 400 | User | | Invalid sch_del_user_pass | admin | sample | 46941969352af5be2ab3f39001216717 | Case Scheduler-Weekly 345%$# 22 | 2 | 2014-02-20 | 2014-03-20 | 08:00 | 2\|3\|5\|6\|7 | | | | | | 400 | password | - | Invalid tas_uid | admin | admin | 00000000000005be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 1 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 400 | task | + | Invalid tas_uid | admin | admin | 00000000000005be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 1 | 3 | 2014-03-21 | 2014-04-18 | 18:00 | | 1 | 15 | 3\|4 | | | 400 | Task not found | | Invalid sch_start_time | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 2 | 3 | 2014-03-21 | 2014-04-18 | 39:00:99 | | 1 | 15 | 1\|2\|5\|6\|7\|8\|9\|10\|11\|12 | | | 400 | sch_start_time | | Invalid sch_start_date | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 3 | 3 | 2014-20-35 | 2014-04-18 | 18:00 | | 2 | | 3\|4\|5 | 1\|7 | | 400 | sch_start_date | | Invalid sch_week_days | admin | admin | 46941969352af5be2ab3f39001216717 | Case Scheduler-Monthly 567&^% 4 | 2 | 2014-03-21 | 2014-04-18 | 18:00 | 8\|9\|10 | | | | | | 400 | sch_week_days | diff --git a/features/backend/files_manager/main_test_files_manager.feature b/features/backend/files_manager/main_test_files_manager.feature index 5b9e54236..75c457463 100644 --- a/features/backend/files_manager/main_test_files_manager.feature +++ b/features/backend/files_manager/main_test_files_manager.feature @@ -37,9 +37,9 @@ Feature: Files Manager Resources Main Tests Given POST this data: """ { - "prf_filename": "", - "prf_path": "", - "prf_content": "" + "prf_filename": "", + "prf_path": "", + "prf_content": "" } """ And I request "project/1265557095225ff5c688f46031700471/file-manager" @@ -50,17 +50,46 @@ Feature: Files Manager Resources Main Tests And store "prf_uid" in session array as variable "prf_uid_" Examples: - | 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 | + | test_description | prf_filename | prf_path | prf_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 | public/public_subfolder | test | 200 | object | 2 | + | into mailtemplates subfolder | file_test_4 | templates/templates_subfolder | test | 200 | object | 3 | - Scenario Outline: Post files + + Scenario: Create files and subfolders with same name in path public + Given POST this data: + """ + { + "prf_filename": "file_test_1.txt", + "prf_path": "public/", + "prf_content": "only text" + } + """ + And I request "project/1265557095225ff5c688f46031700471/file-manager" + Then the response status code should be 400 + And the response status message should have the following text "already exists" + + + Scenario: Create files and subfolders with same name in path templates + Given POST this data: + """ + { + "prf_filename": "file_test_2.html", + "prf_path": "templates/", + "prf_content": "

Test

html test

" + } + """ + And I request "project/1265557095225ff5c688f46031700471/file-manager" + Then the response status code should be 400 + And the response status message should have the following text "already exists" + + + Scenario Outline: Update files by updating the content Given PUT this data: """ { - "prf_content": "" + "prf_content": "" } """ And that I want to update a resource with the key "prf_uid" stored in session array as variable "prf_uid_" @@ -71,24 +100,65 @@ Feature: Files Manager Resources Main Tests And the type is "" Examples: - | 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 | + | test_description | prf_filename | prf_content | http_code | type | prf_number | + | put into public folder | file_test_1.txt | only text - modified | 200 | object | 0 | + | put into mailtemplates folder | file_test_2.html |

Test

html test

modified | 200 | object | 1 | + | put into public subfolder | file_test_3 | put test | 200 | object | 2 | + | put into mailtemplates subfolder | file_test_4 | put test | 200 | object | 3 | - #Para que funcione este test, debe existir el archivo que se quiere subir + + Scenario Outline: Get a single Files Manager and check some properties + Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=" + 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 "prf_filename" property in row equals "" + And the "prf_path" property in row equals "" + And the "prf_content" property in row equals "" + + + Examples: + | test_description | prf_filename | prf_content | http_code | type | prf_number | row | prf_path | + | put into public folder | file_test_1.txt | only text - modified | 200 | object | 0 | 1 | public/ | + | put into mailtemplates folder | file_test_2.html |

Test

html test

modified | 200 | object | 1 | 1 | templates/ | + | put into public subfolder | file_test_3.txt | put test | 200 | object | 2 | 0 | public/public_subfolder | + | put into mailtemplates subfolder | file_test_4.html | put test | 200 | object | 3 | 0 | templates/templates_subfolder | + + Scenario Outline: Upload files to same folders - Given POST I want to upload the file "" to path "". Url "project/1265557095225ff5c688f46031700471/file-manager" + 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 | + | file | prf_path | prf_number | + |/home/wendy/uploadfiles/test1.html | templates | 4 | + |/home/wendy/uploadfiles/test2.html | templates | 5 | + |/home/wendy/uploadfiles/test.txt | public | 6 | + Scenario: Upload files when the file already exists + Given POST I want to upload the file "/home/wendy/uploadfiles/alert_message.html" to path "templates". Url "project/1265557095225ff5c688f46031700471/file-manager" + Then the response status code should be 400 + And the response status message should have the following text "already exists" + + + + Scenario Outline: Download files + Given I request "project/1265557095225ff5c688f46031700471/file-manager/prf_uid/download" with the key "prf_uid" stored in session array as variable "prf_uid_" + 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" + + Examples: + | test_description | prf_number | + | Download file | 0 | + | Download file | 1 | + | Download file | 2 | + | Download file | 4 | + + 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" @@ -106,6 +176,15 @@ Feature: Files Manager Resources Main Tests | delete mailtemplates subfolder | 5 | | delete mailtemplates subfolder | 6 | - - \ No newline at end of file + Scenario Outline: Delete folder + Given that I want to delete the folder + And I request "project/1265557095225ff5c688f46031700471/file-manager/folder?path=" + + Then the response status code should be 200 + And the response charset is "UTF-8" + + Examples: + | test_description | prf_path | + | delete public sub folder | templates/templates_subfolder | + | delete templates sub folder | public/public_subfolder | diff --git a/features/backend/files_manager/negative_tests_files_manager.feature b/features/backend/files_manager/negative_tests_files_manager.feature index 9af8ac0e5..a90a00666 100644 --- a/features/backend/files_manager/negative_tests_files_manager.feature +++ b/features/backend/files_manager/negative_tests_files_manager.feature @@ -1,6 +1,48 @@ -# 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 +@ProcessMakerMichelangelo @RestAPI +Feature: File Manager Negative Tests + + + Background: + Given that I have a valid access_token + + Scenario: Get a list public folder of process files manager with bad parameters (negative tests) + Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=sample" + Then the response status code should be 400 + And the response status message should have the following text "" + + + Scenario: Get a list templates folder of process files manager with bad parameters (negative tests) + Given I request "project/1265557095225ff5c688f46031700471/file-manager?path=sample" + Then the response status code should be 200 + And the response status message should have the following text "" + + + Scenario Outline: Create files and subfolders for a project with bad parameters (negative tests) + Given POST this data: + """ + { + "prf_filename": "", + "prf_path": "", + "prf_content": "" + } + """ + And I request "project//file-manager" + Then the response status code should be + And the response status message should have the following text "" + + Examples: + | test_description | project | prf_filename | prf_path | prf_content | error_code | error_message | + | Invalid path public | 1265557095225ff5c688f46031700471 | file_test_1.txt | file_input_public/ | only text | 400 | prf_path | + | Invalid path template | 1265557095225ff5c688f46031700471 | file_test_2.html | temptes_manager/ |

Test

html test

| 400 | prf_path | + | Field Required prf_filename in public | 1265557095225ff5c688f46031700471 | | public/ | only text | 200 | prf_filename | + | Field Required prf_filename in template | 1265557095225ff5c688f46031700471 | | templates/ |

Test

html test

| 200 | prf_filename | + | Field Required project | | file_test_1.txt | public/ | only text | 200 | prj_uid | + + + + + +# how to get content if a file - revisar si hay el endpoint para poner el contenido del html +# how to delete sub folders +# upload big files - +# actualizar el conteniudo subiendo un archivo nuevo con el mismo nombre... \ No newline at end of file diff --git a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature index d5a1a567f..e4a0787d1 100644 --- a/features/backend/trigger_wizard/main_tests_trigger_wizards.feature +++ b/features/backend/trigger_wizard/main_tests_trigger_wizards.feature @@ -82,7 +82,7 @@ Feature: Group "tri_description": "", "tri_type": "", "tri_params": { - "input": { + "input": { "arrayData": "", "index": "", "value": "", @@ -102,8 +102,9 @@ Feature: Group 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 | + | 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 | + | 1 | pmFunctions | PMFSendMessage | My trigger 1 | Envio de email | SCRIPT | Scenario Outline: Update Trigger diff --git a/features/backend/trigger_wizard/negative_tests_triggers_wizards.feature b/features/backend/trigger_wizard/negative_tests_triggers_wizards.feature index e69de29bb..72ea1727c 100644 --- a/features/backend/trigger_wizard/negative_tests_triggers_wizards.feature +++ b/features/backend/trigger_wizard/negative_tests_triggers_wizards.feature @@ -0,0 +1,8 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Triggers Wizard Negative Tests + + + Background: + Given that I have a valid access_token + + diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 9c82a30ae..e64ef88b0 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1250,7 +1250,6 @@ class RestContext extends BehatContext } else { $varValue = $sessionData->$sessionVarName; } -print_r($sessionData); $pageUrl = str_replace($varName, $varValue, $pageUrl);