@ProcessMakerMichelangelo @RestAPI Feature: Testing triggers Main Tests Requirements: a workspace with the process 251815090529619a99a2bf4013294414 already loaded the process name is "Test (Triggers, Activity)" there are two triggers in the process and workspace with the process 1455892245368ebeb11c1a5001393784 - "Process Complete BPMN" already loaded" already loaded Background: Given that I have a valid access_token Scenario Outline: Get the Triggers List when there are exactly two triggers 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: | test_description | project | records | | Get triggers in process .pm | 251815090529619a99a2bf4013294414 | 2 | | Get triggers in process .pmx | 1455892245368ebeb11c1a5001393784 | 3 | Scenario Outline: Get a single trigger of a project the trigger is previously created Given I request "project//trigger/" 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 "tri_title" property equals "" And the "tri_type" property equals "" And the "tri_description" property equals "" Examples: | test_description | project | trigger | tri_title | tri_type | tri_description | | Get triggers in process .pm | 251815090529619a99a2bf4013294414 | 65317729852cf0ce339bfa4020392914 | For event: change description | SCRIPT | Autogenerated For event: change description | | Get triggers in process .pm | 251815090529619a99a2bf4013294414 | 75916963152cc6ab085a704081670580 | para eventos | SCRIPT | | | Get triggers in process .pmx | 1455892245368ebeb11c1a5001393784 | 712197294536bea56a8b4d0014148679 | trigger1 | SCRIPT | | | Get triggers in process .pmx | 1455892245368ebeb11c1a5001393784 | 950769923536bea6a39c833033416052 | trigger2 | SCRIPT | | | Get triggers in process .pmx | 1455892245368ebeb11c1a5001393784 | 350949312536bea73c53791057971272 | trigger3 | SCRIPT | | Scenario Outline: Create 5 new triggers Given POST this data: """ { "tri_title": "", "tri_description": "", "tri_type": "", "tri_webbot": "", "tri_param": "" } """ And I request "project//trigger" Then the response status code should be 201 And store "tri_uid" in session array as variable "tri_uid_" Examples: | test_description | project | tri_number | tri_title | tri_description |tri_type | tri_webbot | tri_param | | Create trigger with title alphabetic and with webbot .pm | 251815090529619a99a2bf4013294414 | 1 | nuevo trigger 1 | descripcion del primer trigger 1 |SCRIPT | @@user1 = @@USER_LOGGED; \n $x = rand(); | PRIVATE | | Create trigger with title alphanumeric and with webbot .pm | 251815090529619a99a2bf4013294414 | 2 | otro trigger 2 | descripcion del segundo trigger 2 |SCRIPT | //Trigger with comments | PRIVATE | | Create trigger without webbot .pm | 251815090529619a99a2bf4013294414 | 3 | otro trigger 3 | descripcion del tercer trigger 3 |SCRIPT | | PRIVATE | | Create trigger without tri type .pm | 251815090529619a99a2bf4013294414 | 4 | otro trigger 4 | descripcion del tercer trigger 4 | | | PRIVATE | | Create trigger without tri param .pm | 251815090529619a99a2bf4013294414 | 5 | otro trigger 5 | descripcion del tercer trigger 5 | | | | | Create trigger with title alphabetic and with webbot .pmx | 1455892245368ebeb11c1a5001393784 | 6 | nuevo trigger 1 | descripcion del primer trigger 1 |SCRIPT | @@user1 = @@USER_LOGGED; \n $x = rand(); | PRIVATE | | Create trigger with title alphanumeric and with webbot .pmx | 1455892245368ebeb11c1a5001393784 | 7 | otro trigger 2 | descripcion del segundo trigger 2 |SCRIPT | //Trigger with comments | PRIVATE | | Create trigger without webbot .pmx | 1455892245368ebeb11c1a5001393784 | 8 | otro trigger 3 | descripcion del tercer trigger 3 |SCRIPT | | PRIVATE | | Create trigger without tri type .pmx | 1455892245368ebeb11c1a5001393784 | 9 | otro trigger 4 | descripcion del tercer trigger 4 | | | PRIVATE | | Create trigger without tri param .pmx | 1455892245368ebeb11c1a5001393784 | 10 | otro trigger 5 | descripcion del tercer trigger 5 | | | | Scenario: Create a new triggers with same name Given POST this data: """ { "tri_title": "nuevo trigger 1", "tri_description": "descripcion del primer trigger 1", "tri_type": "SCRIPT", "tri_webbot": "@@user1 = @@USER_LOGGED; \n $x = rand();", "tri_param": "PRIVATE" } """ And I request "project/251815090529619a99a2bf4013294414/trigger" Then the response status code should be 400 And the response status message should have the following text "same name" Scenario Outline: Get the Triggers List when there are 7 records 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: | test_description | project | records | | Get triggers in process .pm | 251815090529619a99a2bf4013294414 | 7 | | Get triggers in process .pmx | 1455892245368ebeb11c1a5001393784 | 8 | Scenario Outline: Update the Triggers and then check if the values had changed Given PUT this data: """ { "tri_title": "", "tri_description": "", "tri_type": "", "tri_webbot": "", "tri_param": "" } """ 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: | test_description | project | tri_number | tri_title | tri_description |tri_type | tri_webbot | tri_param | | Update title .pm | 251815090529619a99a2bf4013294414 | 1 | Update nuevo trigger 1 @#$%^&*½²³€¼½ | descripcion del primer trigger 1 |SCRIPT | @@user1 = @@USER_LOGGED; \n $x = rand(); | PRIVATE | | Update Description .pm | 251815090529619a99a2bf4013294414 | 2 | otro trigger 2 | Update descripcion del segundo trigger 2 @#$%^&*½²³€¼½ |SCRIPT | //Trigger with comments | PRIVATE | | Update webbot .pm | 251815090529619a99a2bf4013294414 | 3 | otro trigger 3 | descripcion del tercer trigger 3 |SCRIPT | //Trigger with comments update | PRIVATE | | Update title .pmx | 1455892245368ebeb11c1a5001393784 | 6 | Update nuevo trigger 1 @#$%^&*½²³€¼½ | descripcion del primer trigger 1 |SCRIPT | @@user1 = @@USER_LOGGED; \n $x = rand(); | PRIVATE | | Update Description .pmx | 1455892245368ebeb11c1a5001393784 | 7 | otro trigger 2 | Update descripcion del segundo trigger 2 @#$%^&*½²³€¼½ |SCRIPT | //Trigger with comments | PRIVATE | | Update webbot .pmx | 1455892245368ebeb11c1a5001393784 | 8 | otro trigger 3 | descripcion del tercer trigger 3 |SCRIPT | //Trigger with comments update | PRIVATE | Scenario Outline: Get a single triggers and check some properties 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 "" And that "tri_description" is set to "" And that "tri_webbot" is set to "" Examples: | test_description | project | tri_number | tri_title | tri_description | tri_webbot | | Get after update .pm | 251815090529619a99a2bf4013294414 | 1 | Update nuevo trigger 1 @#$%^&*½²³€¼½ | descripcion del primer trigger 1 | @@user1 = @@USER_LOGGED; \n $x = rand(); | | Get after update .pm | 251815090529619a99a2bf4013294414 | 2 | otro trigger 2 | Update descripcion del segundo trigger 2 @#$%^&*½²³€¼½ | //Trigger with comments | | Get after update .pm | 251815090529619a99a2bf4013294414 | 3 | otro trigger 3 | descripcion del tercer trigger 3 | //Trigger with comments update | | Get after update .pmx | 1455892245368ebeb11c1a5001393784 | 6 | Update nuevo trigger 1 @#$%^&*½²³€¼½ | descripcion del primer trigger 1 | @@user1 = @@USER_LOGGED; \n $x = rand(); | | Get after update .pmx | 1455892245368ebeb11c1a5001393784 | 7 | otro trigger 2 | Update descripcion del segundo trigger 2 @#$%^&*½²³€¼½ | //Trigger with comments | | Get after update .pmx | 1455892245368ebeb11c1a5001393784 | 8 | otro trigger 3 | descripcion del tercer trigger 3 | //Trigger with comments update | Scenario Outline: Delete all Triggers created previously in this script 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" Examples: | project | tri_number | | 251815090529619a99a2bf4013294414 | 1 | | 251815090529619a99a2bf4013294414 | 2 | | 251815090529619a99a2bf4013294414 | 3 | | 251815090529619a99a2bf4013294414 | 4 | | 251815090529619a99a2bf4013294414 | 5 | | 1455892245368ebeb11c1a5001393784 | 6 | | 1455892245368ebeb11c1a5001393784 | 7 | | 1455892245368ebeb11c1a5001393784 | 8 | | 1455892245368ebeb11c1a5001393784 | 9 | | 1455892245368ebeb11c1a5001393784 | 10 | Scenario Outline: Get the Triggers List when there are exactly two triggers 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: | test_description | project | records | | Get triggers in process .pm | 251815090529619a99a2bf4013294414 | 2 | | Get triggers in process .pmx | 1455892245368ebeb11c1a5001393784 | 3 |