diff --git a/behat.yml b/behat.yml index a2cb99c8c..c22acdb95 100644 --- a/behat.yml +++ b/behat.yml @@ -2,5 +2,5 @@ default: context: parameters: - base_url: http://192.168.0.55/api/1.0/workflow/ - access_token: 5e312aab4c5b9342ce9ac12861f08f020e4e359e + base_url: http://192.168.11.181/api/1.0/michelangelo/ + access_token: ff4bdec9e8e2e3b2fa3fb03bc3a7d287fd0dcf26 diff --git a/features/abc/_001_projects.feature b/features/abc/_001_projects.feature index e7a2050fd..49a60bbd7 100644 --- a/features/abc/_001_projects.feature +++ b/features/abc/_001_projects.feature @@ -7,21 +7,25 @@ Feature: Testing Oauth And the response charset is "UTF-8" And the content type is "application/json" And the type is "array" - And the "prj_uid" property in row 0 equals "8061532405176da5242da84006421863" - And the "prj_name" property in row 0 equals "Sample Project" - And the "prj_description" property in row 0 equals "description" - And the "diagrams" property in row 0 equals "diagrams" + And the "prj_uid" property in row 0 equals "31034744752a5d007364d93044509065" + And the "prj_name" property in row 0 equals "Sample Project #1" + And the "prj_create_date" property in row 0 equals "2013-12-09 09:13:27" + #And the "diagrams" property in row 0 equals "diagrams" - Scenario: GET project SLA Process Entire process... + Scenario: GET project Sample Project #1 process... Given that I have a valid access_token - And I request "project/725511159507f70b01942b3002493938" + And I request "project/31034744752a5d007364d93044509065" 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 response has a "diagrams" property And the "diagrams" property type is "array" - #And the "lanesets" property in row 0 of property "diagrams" equals "xx" + And the "dia_uid" property in row 0 of property "diagrams" equals "23643663952a5d0073a6133086723956" + And the "prj_uid" property in row 0 of property "diagrams" equals "31034744752a5d007364d93044509065" + And the "dia_name" property in row 0 of property "diagrams" equals "Sample Project #1" + And the "dia_is_closable" property in row 0 of property "diagrams" equals "0" + And the "lanesets" property in row 0 of property "diagrams" is "array" And the "lanes" property in row 0 of property "diagrams" is "array" And the "activities" property in row 0 of property "diagrams" is "array" @@ -30,25 +34,62 @@ Feature: Testing Oauth And the "flows" property in row 0 of property "diagrams" is "array" And the "artifacts" property in row 0 of property "diagrams" is "array" - Scenario: Creating new Project with API - Given that I want to make a new "Process" with: - | name | followers | - | everzet | 147 | - | avalanche123 | 142 | - | kriswallsmith | 274 | - | fabpot | 962 | - And I want to Insert a new "Process" with: - """ - { - "id" : 123, - "name" : "john", - "age" : 12 - } - """ -# And "prj_name" is "my test process" -# And "prj_description" is "test for gizzle" -# And the request is sent as JSON -# When I request "project" - Then the response status code should be 201 -# And the response should be JSON -# And the response has a "prj_id" property + Scenario: get an activity from process Sample Project #1 + Given that I have a valid access_token + And I request "project/31034744752a5d007364d93044509065/activity/72845150252a5d718be4df5092655350" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the response is equivalent to this json file "task_72845150252a5d718be4df5092655350.json" + + Scenario: get an activity from process Sample Project #1 + Given that I have a valid access_token + And I request "project/31034744752a5d007364d93044509065/activity/13508932952a5d718ef56f6044945775" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the response is equivalent to this json file "task_13508932952a5d718ef56f6044945775.json" + + Scenario: get an activity from process Sample Project #1 + Given that I have a valid access_token + And I request "project/31034744752a5d007364d93044509065/activity/58163453252a5d719253ff9069893664" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the response is equivalent to this json file "task_58163453252a5d719253ff9069893664.json" + + Scenario: get a list of input documents + Given that I have a valid access_token + And I request "project/31034744752a5d007364d93044509065/input-documents" + Then the response status code should be 200 + And the content type is "application/json" + And the response is equivalent to this json file "task_58163453252a5d719253ff9069893664.json" + +# Scenario: post an activity +# Given that I send "data" +# And I request "project/31034744752a5d007364d93044509065/activity" +# Then the response status code should be 200 +# And the response charset is "UTF-8" + +# Scenario: Creating new Activity with API +# Given that I want to make a new "Process" with: +# | name | followers | +# | everzet | 147 | +# | avalanche123 | 142 | +# | kriswallsmith | 274 | +# | fabpot | 962 | +# And I want to Insert a new "Process" with: +# """ +# { +# "id" : 123, +# "name" : "john", +# "age" : 12 +# } +# """ +## And "prj_name" is "my test process" +## And "prj_description" is "test for gizzle" +## And the request is sent as JSON +## When I request "project" +# Then the response status code should be 201 +## And the response should be JSON +## And the response has a "prj_id" property diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 3669efa42..41bd9f125 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -853,6 +853,20 @@ class RestContext extends BehatContext } } + /** + * @Then /^the response is equivalent to this json file "([^"]*)"$/ + */ + public function theResponseIsEquivalentToThisJsonFile($jsonFile) + { + //$this->_data; + $fileData = file_get_contents(__DIR__ . "/../json/" . $jsonFile); + $fileJson = json_decode($fileData); + if ($this->_data != $fileJson) { + throw new \Exception("JSON Response does not match json file: $jsonFile\n\n" + . $this->echoLastResponse()); + } + } + /** * @Given /^that I want to make a new "([^"]*)" with:$/ */ diff --git a/features/json/task_13508932952a5d718ef56f6044945775.json b/features/json/task_13508932952a5d718ef56f6044945775.json new file mode 100644 index 000000000..5b4022883 --- /dev/null +++ b/features/json/task_13508932952a5d718ef56f6044945775.json @@ -0,0 +1,29 @@ +{ + "definition": [ + + ], + "properties": { + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": "", + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task", + "tas_description": "Task", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "" + } +} diff --git a/features/json/task_58163453252a5d719253ff9069893664.json b/features/json/task_58163453252a5d719253ff9069893664.json new file mode 100644 index 000000000..5b4022883 --- /dev/null +++ b/features/json/task_58163453252a5d719253ff9069893664.json @@ -0,0 +1,29 @@ +{ + "definition": [ + + ], + "properties": { + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": "", + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task", + "tas_description": "Task", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "" + } +} diff --git a/features/json/task_72845150252a5d718be4df5092655350.json b/features/json/task_72845150252a5d718be4df5092655350.json new file mode 100644 index 000000000..5b4022883 --- /dev/null +++ b/features/json/task_72845150252a5d718be4df5092655350.json @@ -0,0 +1,29 @@ +{ + "definition": [ + + ], + "properties": { + "tas_type": "NORMAL", + "tas_duration": 1, + "tas_type_day": "", + "tas_timeunit": "DAYS", + "tas_priority_variable": "", + "tas_assign_type": "BALANCED", + "tas_assign_variable": "@@SYS_NEXT_USER_TO_BE_ASSIGNED", + "tas_group_variable": "", + "tas_transfer_fly": "FALSE", + "tas_send_last_email": "FALSE", + "tas_derivation_screen_tpl": "", + "tas_selfservice_timeout": 0, + "tas_selfservice_time": "", + "tas_selfservice_time_unit": "", + "tas_selfservice_trigger_uid": "", + "tas_title": "Task", + "tas_description": "Task", + "tas_def_title": "", + "tas_def_description": "", + "tas_def_message": "", + "tas_def_subject_message": "", + "tas_calendar": "" + } +}