Behat completo del feature calendar y modificaciones a los features department y process supervisor

This commit is contained in:
Wendy Nestor
2014-04-15 15:40:21 -04:00
parent 1c5504c69a
commit 93475410c3
5 changed files with 514 additions and 14 deletions

View File

@@ -0,0 +1,121 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Calendar
Requirements:
a workspace with two calendar in this workspace "Default Calendar and Test Process"
Background:
Given that I have a valid access_token
Scenario: List of calendar
Given I request "calendars"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 2 records
Scenario: Get a single calendar
Given I request "calendar/14606161052f50839307899033145440"
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 "cal_uid" property equals "14606161052f50839307899033145440"
And the "cal_name" property equals "Test Process"
And the "cal_description" property equals "Calendar para el feature Process"
Scenario Outline: Create a new Calendars
Given POST this data:
"""
{
"cal_name": "<cal_name>",
"cal_description": "<cal_description>",
"cal_work_days": [5, 6, 7],
"cal_work_hour": [
{"day": 0, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 7, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
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 "cal_uid" in session array as variable "cal_uid_<cal_uid_number>"
Examples:
| test_description | cal_uid_number | cal_name | cal_description |
| Create calendar 1 | 1 | Calendar 1 | Prueba de Creacion de Calendario 1 |
| Create calendar 2 | 2 | Calendar 2 | Prueba de Creacion de Calendario 2 |
Scenario Outline: Update the calendars and then check if the values had changed
Given PUT this data:
"""
{
"cal_name": "<cal_name>",
"cal_description": "<cal_description>",
"cal_work_days": [5, 6, 7],
"cal_status": "<cal_status>",
"cal_work_hour": [
{"day": 0, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 7, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And that I want to update a resource with the key "cal_uid" stored in session array as variable "cal_uid_<cal_uid_number>"
And I request "calendar"
And the content type is "application/json"
Then the response status code should be 200
And the response charset is "UTF-8"
Examples:
| test_description | cal_uid_number | cal_name | cal_description | cal_status |
| Update calendar 1 | 1 | Update Calendar 1 | Update Prueba de Creacion de Calendario 1 | ACTIVE |
| Update calendar 2 | 2 | Update Calendar 2 | Update Prueba de Creacion de Calendario 2 | INACTIVE |
Scenario Outline: Get a single calendar
Given that I want to get a resource with the key "cal_uid" stored in session array as variable "cal_uid_<cal_uid_number>"
And I request "calendar"
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 "cal_name" property equals "<cal_name>"
And the "cal_description" property equals "<cal_description>"
And the "cal_status" property equals "<cal_status>"
Examples:
| cal_uid_number | cal_name | cal_description | cal_status |
| 1 | Update Calendar 1 | Update Prueba de Creacion de Calendario 1 | ACTIVE |
| 2 | Update Calendar 2 | Update Prueba de Creacion de Calendario 2 | INACTIVE |
Scenario Outline: Delete all Calendars created previously in this script
Given that I want to delete a resource with the key "cal_uid" stored in session array as variable "cal_uid_<cal_uid_number>"
And I request "calendar"
And the content type is "application/json"
Then the response status code should be 200
Examples:
| cal_uid_number |
| 1 |
| 2 |

View File

@@ -0,0 +1,241 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Calendar Main Tests
Requirements:
a workspace with two calendar in this workspace "Default Calendar and Test Process"
Background:
Given that I have a valid access_token
Scenario: List of calendar
Given I request "calendars"
Then the response status code should be 200
And the response charset is "UTF-8"
And the type is "array"
And the response has 2 records
Scenario: Get a single calendar
Given I request "calendar/14606161052f50839307899033145440"
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 "cal_uid" property equals "14606161052f50839307899033145440"
And the "cal_name" property equals "Test Process"
And the "cal_description" property equals "Calendar para el feature Process"
Scenario Outline: Create a new Calendars
Given POST this data:
"""
{
"cal_name": "<cal_name>",
"cal_description": "<cal_description>",
"cal_work_days": [5, 6, 7],
"cal_work_hour": [
{"day": 0, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 7, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
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 "cal_uid" in session array as variable "cal_uid_<cal_uid_number>"
Examples:
| test_description | cal_uid_number | cal_name | cal_description |
| Create calendar 1 | 1 | Calendar 1 | Prueba de Creacion de Calendario 1 |
| Create calendar 2 | 2 | Calendar 2 | Prueba de Creacion de Calendario 2 |
| Create calendar with name long | 3 | Calendar 3 | Prueba de Creacion de Calendario 3 |
| Create calendar with special character | 4 | Calendar 4 !@#$%^& | Prueba de Creacion de Calendario 4 |
Scenario Outline: Create a new Calendar with parameter cal_work_days diferent
Given POST this data:
"""
{
"cal_name": "Calendar 5",
"cal_description": "Prueba de Creacion de Calendario 5",
"cal_work_days": [1, 2, 3, 4, 5, 6, 7],
"cal_work_hour": [
{"day": 0, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 7, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
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 "cal_uid" in session array as variable "cal_uid_<cal_uid_number>"
Examples:
| cal_uid_number |
| 5 |
Scenario Outline: Create a new Calendar with parameter cal_work_hour diferent
Given POST this data:
"""
{
"cal_name": "Calendar 6",
"cal_description": "Prueba de Creacion de Calendario 6",
"cal_work_days": [3, 4, 5, 6, 7],
"cal_work_hour": [
{"day": 3, "hour_start": "08:00", "hour_end": "20:00"},
{"day": 7, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
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 "cal_uid" in session array as variable "cal_uid_<cal_uid_number>"
Examples:
| cal_uid_number |
| 6 |
Scenario Outline: Create a new Calendar with parameter cal_holiday diferent
Given POST this data:
"""
{
"cal_name": "Calendar 7",
"cal_description": "Prueba de Creacion de Calendario 7",
"cal_work_days": [2, 3, 4, 5, 6],
"cal_work_hour": [
{"day": 2, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 6, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday2", "date_start": "2010-01-01", "date_end": "2010-02-10"},
{"name": "holiday5", "date_start": "2014-05-01", "date_end": "2014-10-04"}
]
}
"""
And I request "calendar"
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 "cal_uid" in session array as variable "cal_uid_<cal_uid_number>"
Examples:
| cal_uid_number |
| 7 |
Scenario: Create a new Calendar with same name
Given POST this data:
"""
{
"cal_name": "Calendar 7",
"cal_description": "Prueba de Creacion de Calendario 5",
"cal_work_days": [2, 3, 4, 5, 6],
"cal_work_hour": [
{"day": 2, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 6, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday2", "date_start": "2010-01-01", "date_end": "2010-02-10"},
{"name": "holiday5", "date_start": "2014-05-01", "date_end": "2014-10-04"}
]
}
"""
And I request "calendar"
Then the response status code should be 400
And the response status message should have the following text "already exists"
Scenario Outline: Update the calendars and then check if the values had changed
Given PUT this data:
"""
{
"cal_name": "<cal_name>",
"cal_description": "<cal_description>",
"cal_work_days": [5, 6, 7],
"cal_status": "<cal_status>",
"cal_work_hour": [
{"day": 0, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 7, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And that I want to update a resource with the key "cal_uid" stored in session array as variable "cal_uid_<cal_uid_number>"
And I request "calendar"
And the content type is "application/json"
Then the response status code should be 200
And the response charset is "UTF-8"
Examples:
| test_description | cal_uid_number | cal_name | cal_description | cal_status |
| Update calendar 1 | 1 | Update Calendar 1 | Update Prueba de Creacion de Calendario 1 | ACTIVE |
| Update calendar 2 | 2 | Update Calendar 2 | Update Prueba de Creacion de Calendario 2 | INACTIVE |
Scenario Outline: Get a single calendar
Given that I want to get a resource with the key "cal_uid" stored in session array as variable "cal_uid_<cal_uid_number>"
And I request "calendar"
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 "cal_name" property equals "<cal_name>"
And the "cal_description" property equals "<cal_description>"
And the "cal_status" property equals "<cal_status>"
Examples:
| cal_uid_number | cal_name | cal_description | cal_status |
| 1 | Update Calendar 1 | Update Prueba de Creacion de Calendario 1 | ACTIVE |
| 2 | Update Calendar 2 | Update Prueba de Creacion de Calendario 2 | INACTIVE |
Scenario Outline: Delete all Calendars created previously in this script
Given that I want to delete a resource with the key "cal_uid" stored in session array as variable "cal_uid_<cal_uid_number>"
And I request "calendar"
And the content type is "application/json"
Then the response status code should be 200
Examples:
| cal_uid_number |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |

View File

@@ -0,0 +1,143 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Calendar Negative Tests
Background:
Given that I have a valid access_token
Scenario Outline: Create a new Calendars (Negative Tests)
Given POST this data:
"""
{
"cal_name": "<cal_name>",
"cal_description": "<cal_description>",
"cal_work_days": [5, 6, 7],
"cal_work_hour": [
{"day": 0, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 7, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
Then the response status code should be <error_code>
And the response status message should have the following text "<error_message>"
Examples:
| test_description | cal_name | cal_description | error_code | error_message |
| Create whitout cal_name | | Prueba de Creacion de Calendario 1 | 400 | cal_name |
Scenario: Create a new Calendars (Wrong cal_work_days)
Given POST this data:
"""
{
"cal_name": "Sample Calendar",
"cal_description": "Creacion de Calendar 400",
"cal_work_days": [9,10.30,56],
"cal_work_hour": [
{"day": 0, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 7, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
Then the response status code should be 400
And the response status message should have the following text "cal_work_days"
Scenario: Create a new Calendars (cal_work_hour . day)
Given POST this data:
"""
{
"cal_name": "Sample Calendar",
"cal_description": "Creacion de Calendar 400",
"cal_work_days": [5, 6, 7],
"cal_work_hour": [
{"day": 10, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 72, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
Then the response status code should be 400
And the response status message should have the following text "day"
Scenario: Create a new Calendars (without cal_work_days)
Given POST this data:
"""
{
"cal_name": "Sample Calendar",
"cal_description": "Creacion de Calendar 400",
"cal_work_hour": [
{"day": 1, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 2, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
Then the response status code should be 400
And the response status message should have the following text "cal_work_days"
Scenario: Create a new Calendars (wrong date_start )
Given POST this data:
"""
{
"cal_name": "Sample Calendar",
"cal_description": "Creacion de Calendar 400",
"cal_work_days": [5, 6, 7],
"cal_work_hour": [
{"day": 1, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 2, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-45-100", "date_end": "2010-01-10"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
Then the response status code should be 400
And the response status message should have the following text "date_start"
Scenario: Create a new Calendars (wrong date_end)
Given POST this data:
"""
{
"cal_name": "Sample Calendar",
"cal_description": "Creacion de Calendar 400",
"cal_work_days": [5, 6, 7],
"cal_work_hour": [
{"day": 1, "hour_start": "00:00", "hour_end": "00:00"},
{"day": 2, "hour_start": "09:00", "hour_end": "17:00"}
],
"cal_holiday": [
{"name": "holiday1", "date_start": "2010-01-01", "date_end": "2010-100-87"},
{"name": "holiday2", "date_start": "2014-04-01", "date_end": "2014-04-04"}
]
}
"""
And I request "calendar"
Then the response status code should be 400
And the response status message should have the following text "date_end"

View File

@@ -98,8 +98,7 @@ Background:
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "object"
And store "dep_uid" in session array
Scenario: Set manager user to department (new supervisor of department: jacob)
Given POST this data: