@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 Background: Given that I have a valid access_token Scenario: Get the Triggers List when there are exactly two triggers Given I request "project/251815090529619a99a2bf4013294414/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 2 records And the "tri_title" property in row 0 equals "For event: change description" And the "tri_title" property in row 1 equals "para eventos" Scenario: Get a single trigger of a project the trigger is previously created Given I request "project/251815090529619a99a2bf4013294414/trigger/65317729852cf0ce339bfa4020392914" 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 "For event: change description" And the "tri_description" property equals "Autogenerated For event: change description" 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 | 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 | 251815090529619a99a2bf4013294414 | 2 | otro trigger 2 | descripcion del segundo trigger 2 |SCRIPT | //Trigger with comments | PRIVATE | | Create trigger without webbot | 251815090529619a99a2bf4013294414 | 3 | otro trigger 3 | descripcion del tercer trigger 3 |SCRIPT | | PRIVATE | | Create trigger without tri type | 251815090529619a99a2bf4013294414 | 4 | otro trigger 4 | descripcion del tercer trigger 4 | | | PRIVATE | | Create trigger without tri param | 251815090529619a99a2bf4013294414 | 5 | otro trigger 5 | descripcion del tercer trigger 5 | | | | Scenario: Get the Triggers List when there are 7 records Given I request "project/251815090529619a99a2bf4013294414/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 7 records 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 | 251815090529619a99a2bf4013294414 | 1 | Update nuevo trigger 1 @#$%^&*½²³€¼½ | descripcion del primer trigger 1 |SCRIPT | @@user1 = @@USER_LOGGED; \n $x = rand(); | PRIVATE | | Update Description | 251815090529619a99a2bf4013294414 | 2 | otro trigger 2 | Update descripcion del segundo trigger 2 @#$%^&*½²³€¼½ |SCRIPT | //Trigger with comments | PRIVATE | | Update webbot | 251815090529619a99a2bf4013294414 | 3 | 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: | project | tri_number | tri_title | tri_description | tri_webbot | | 251815090529619a99a2bf4013294414 | 1 | Update nuevo trigger 1 @#$%^&*½²³€¼½ | descripcion del primer trigger 1 | @@user1 = @@USER_LOGGED; \n $x = rand(); | | 251815090529619a99a2bf4013294414 | 2 | otro trigger 2 | Update descripcion del segundo trigger 2 @#$%^&*½²³€¼½ | //Trigger with comments | | 251815090529619a99a2bf4013294414 | 3 | 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 | Scenario: Get the Triggers List when there are exactly two triggers Given I request "project/251815090529619a99a2bf4013294414/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 2 records And the "tri_title" property in row 0 equals "For event: change description" And the "tri_title" property in row 1 equals "para eventos"