diff --git a/src/test/resources/features/Sample.feature b/src/test/resources/features/Sample.feature deleted file mode 100644 index 46b64f9..0000000 --- a/src/test/resources/features/Sample.feature +++ /dev/null @@ -1,60 +0,0 @@ -@Sample -Feature: Sample - - Background: - And header Content-Type = application/json - And header Accept = */* - - - @RickAndMorty - Scenario Outline: Get character - Given base url env.base_url_rickAndMorty - And endpoint character/ - When execute method GET - Then the status code should be 200 - And response should be $.name = - And response should be $.status = - And validate schema character.json - - Examples: - | id_character | name | status | - | 1 | Rick Sanchez | Alive | - | 2 | Morty Smith | Alive | - - @petstore - Scenario Outline: Add a new pet to the store - Given base url env.base_url_petstore - And endpoint pet - And header accept = application/json - And header Content-Type = application/json - And body body.json - When execute method POST - Then the status code should be 200 - And response should be name = - And validate schema pet.json - - Examples: - | name | - | doggie | - - @petstore - Scenario Outline: Add a new pet to the store - Given base url env.base_url_petstore - And endpoint pet - And header accept = application/json - And header Content-Type = application/json - And delete keyValue tags[0].id in body body.json - And set value 15 of key tags[1].id in body body.json - And set value "tag2" of key tags[1].name in body body.json - When execute method POST - Then the status code should be 200 - And response should be name = - And validate schema pet.json - - Examples: - | name | - | doggie | - - - - diff --git a/src/test/resources/features/addProject.feature b/src/test/resources/features/addProject.feature new file mode 100644 index 0000000..6efaef5 --- /dev/null +++ b/src/test/resources/features/addProject.feature @@ -0,0 +1,55 @@ +@addProject +Feature: addProject + + Background: + Given header Content-Type = application/json + And header Accept = */* + And header x-api-key = NTZhNWVmN2UtNjI1OS00OGU2LTg1ZDEtYmZkOWM1NzZjNDFk + * define nombreProyecto12 = crow2 + + @ListWorkspace123 + Scenario: + Given base url env.base_url_clockify + And endpoint /v1/workspaces + When execute method GET + Then the status code should be 200 + * define idWorkspace = $[0].id + + @CreateProjectAddProject + Scenario: Create project + Given call addProject.feature@ListWorkspace123 + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{idWorkspace}}/projects + And set value "{{nombreProyecto12}}" of key name in body addProject.json + When execute method POST + Then the status code should be 201 + + + @CreateProject400 + Scenario: Create project Bad Request + Given call addProject.feature@ListWorkspace123 + Given base url env.base_url_clockify + And endpoint /v1/workspaces/{{idWorkspace}}/projects + And set value "{{nombreProyecto12}}" of key name in body addProject214.json + When execute method POST + Then the status code should be 400 + + @CreateProject401 + Scenario: Create project Unauthorized + Given call addProject.feature@ListWorkspace123 + Given header x-api-key = gfgfssfssfsfhhjjjj + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{idWorkspace}}/projects + And set value "{{nombreProyecto12}}" of key name in body addProject.json + When execute method POST + Then the status code should be 401 + + @CreateProject404 + Scenario: Create project Not Found + Given call addProject.feature@ListWorkspace123 + Given base url env.base_url_clockify + And endpoint /v1/workspaces/{{idWorkspace}}/4356465 + And set value "{{nombreProyecto12}}" of key name in body addProject.json + When execute method POST + Then the status code should be 404 + diff --git a/src/test/resources/features/delete.feature b/src/test/resources/features/delete.feature new file mode 100644 index 0000000..2564c4e --- /dev/null +++ b/src/test/resources/features/delete.feature @@ -0,0 +1,63 @@ +Feature: Delete + + Background: + Given header Content-Type = application/json + And header Accept = */* + And header x-api-key = NTZhNWVmN2UtNjI1OS00OGU2LTg1ZDEtYmZkOWM1NzZjNDFk + And base url env.base_url_clockify + * define nombreProyecto = Crowdar2023 + + @ListWorkspaceDelete + Scenario: + Given base url env.base_url_clockify + Given endpoint /v1/workspaces + When execute method GET + Then the status code should be 200 + * define idWorkspace = $[0].id + + + @CreateProjectDelete + Scenario: Crear un proyecto + Given call delete.feature@ListWorkspaceDelete + And endpoint /v1/workspaces/{{idWorkspace}}/projects + And set value "{{nombreProyecto}}" of key name in body addProject.json + When execute method POST + Then the status code should be 201 + * define idProject = $.id + + @UpdateProjectDelete + Scenario: Update Project + Given call delete.feature@CreateProject + And endpoint /v1/workspaces/{{idWorkspace}}/projects/{{idProject}} + And set value "true" of key archived in body updateProjectToArchive.json + When execute method PUT + Then the status code should be 200 + + @DeleteProject + Scenario: Delete Project + Given call delete.feature@UpdateProject + And endpoint /v1/workspaces/{{idWorkspace}}/projects/{{idProject}} + When execute method DELETE + Then the status code should be 200 + + @DeleteProject400 + Scenario: Delete Project Bad Request + Given base url env.base_url_clockify + And endpoint /v1/workspaces/{{idWorkspace}}/projects/cuaqluiera + When execute method DELETE + Then the status code should be 400 + + @DeleteProject401 + Scenario: Delete Project Unauthorized + Given header x-api-key = 32423423423fgdfgaefad + And endpoint /v1/workspaces/{{idWorkspace}}/projects/653568cff202ee63efd5493b + When execute method DELETE + Then the status code should be 401 + + @DeleteProject404 + Scenario: Delete Project Not Found + Given base url env.base_url_clockify + And endpoint /v1/workspaces/{{idWorkspace}}/project51s/653568cff202ee63efd5493b + When execute method DELETE + Then the status code should be 404 + diff --git a/src/test/resources/features/findById.feature b/src/test/resources/features/findById.feature new file mode 100644 index 0000000..bf04ffe --- /dev/null +++ b/src/test/resources/features/findById.feature @@ -0,0 +1,51 @@ +Feature: Find by id + + Background: + Given header Content-Type = application/json + And header Accept = */* + And header x-api-key = NTZhNWVmN2UtNjI1OS00OGU2LTg1ZDEtYmZkOWM1NzZjNDFk + And base url env.base_url_clockify + + @ListWorkspaceFindId + Scenario: Get all workspaces + Given endpoint /v1/workspaces + When execute method GET + Then the status code should be 200 + * define idWorkspace = $[0].id + + @ListProjectsFindById + Scenario: get all projects + Given call findById.feature@ListWorkspaceFindId + Given endpoint /v1/workspaces/{{idWorkspace}}/projects + When execute method GET + Then the status code should be 200 + * define idProject = $[0].id + + @FindId + Scenario: get project by id + Given call findById.feature@ListProjectsFindById + And endpoint /v1/workspaces/{{idWorkspace}}/projects/{{idProject}} + When execute method GET + Then the status code should be 200 + + @FindId400 + Scenario: get project Bad Request + Given call findById.feature@ListWorkspaceFindId + And endpoint /v1/workspaces/{{idWorkspace}}/projects/013ty9p1 + When execute method GET + Then the status code should be 400 + + @FindId401 + Scenario: get project Unauthorised + Given header x-api-key = ÑTZhNWVmN2UtNjI1OS00OGU2LTg1ZDEtYmZkOWM1NzZjNDFk + And call findById.feature@ListProjectsFindById + And endpoint /v1/workspaces/{{idWorkspace}}/projects/{{idProject}} + When execute method GET + Then the status code should be 401 + + @FindId404 + Scenario: get project by id Not Found + Given call findById.feature@ListWorkspaceFindId + And endpoint /v1/workspaces/{{idWorkspace}}/projectsgfkghl/6535738fc64c131fb4e8f984 + When execute method GET + Then the status code should be 404 \ No newline at end of file diff --git a/src/test/resources/features/getProject.feature b/src/test/resources/features/getProject.feature new file mode 100644 index 0000000..21b0294 --- /dev/null +++ b/src/test/resources/features/getProject.feature @@ -0,0 +1,48 @@ +@Workspaces +Feature: getProjects + + Background: + Given header Content-Type = application/json + And header Accept = */* + And header x-api-key = NTZhNWVmN2UtNjI1OS00OGU2LTg1ZDEtYmZkOWM1NzZjNDFk + + @getWorkspacesGetProjetc + Scenario: Get all workspaces + Given base url env.base_url_clockify + Given endpoint /v1/workspaces + When execute method GET + Then the status code should be 200 + * define idWorkspace = $[0].id + + @ListProjectsGetProjetc + Scenario: get all projects + Given call getProject.feature@getWorkspacesGetProjetc + And base url env.base_url_clockify + Given endpoint /v1/workspaces/{{idWorkspace}}/projects + When execute method GET + Then the status code should be 200 + + @ListProjectsGetProjetc400 + Scenario: get all projects Bad request + Given call getProject.feature@getWorkspacesGetProjetc + And base url env.base_url_clockify + Given endpoint /v1/workspaces/{{idWorkspace}}/projects/xdd + When execute method GET + Then the status code should be 400 + + @ListProjectsGetProjetc401 + Scenario: get all projects Unauthorised + Given call getProject.feature@getWorkspacesGetProjetc + And header x-api-key = 32423423423fgdfgaefad + And base url env.base_url_clockify + Given endpoint /v1/workspaces/{{idWorkspace}}/projects + When execute method GET + Then the status code should be 401 + + @ListProjectsGetProjetc404 + Scenario: get all projects Not found + Given call getProject.feature@getWorkspacesGetProjetc + And base url env.base_url_clockify + Given endpoint /v1/workspaces/{{idWorkspace}}/projects514 + When execute method GET + Then the status code should be 404 \ No newline at end of file diff --git a/src/test/resources/features/updateProjectEstimate.feature b/src/test/resources/features/updateProjectEstimate.feature new file mode 100644 index 0000000..2b2693e --- /dev/null +++ b/src/test/resources/features/updateProjectEstimate.feature @@ -0,0 +1,57 @@ +Feature: updateProjectEstimate + + Background: + Given header Content-Type = application/json + And header Accept = */* + And header x-api-key = NTZhNWVmN2UtNjI1OS00OGU2LTg1ZDEtYmZkOWM1NzZjNDFk + And base url env.base_url_clockify + * define nombreProyecto = Crowdar2023Estimate + + @ListWorkspaceEstimate + Scenario: + Given base url env.base_url_clockify + Given endpoint /v1/workspaces + When execute method GET + Then the status code should be 200 + * define idWorkspace = $[0].id + + + @CreateProjectEstimate + Scenario: Crear un proyecto + Given call updateProjectEstimate.feature@ListWorkspaceEstimate + And endpoint /v1/workspaces/{{idWorkspace}}/projects + And set value "{{nombreProyecto}}" of key name in body addProjectUpdate.json + When execute method POST + Then the status code should be 201 + * define idProject = $.id + + @UpdateEstimate + Scenario: Update estimate project + Given call updateProjectEstimate.feature@CreateProjectEstimate + And endpoint /v1/workspaces/{{idWorkspace}}/projects/{{idProject}}/estimate + And set value "MANUAL" of key type in body updateEstimate.json + When execute method PATCH + Then the status code should be 200 + + @UpdateEstimate400 + Scenario: Estimate Project Bad Request + Given call updateProjectEstimate.feature@ListWorkspaceEstimate + And endpoint /v1/workspaces/{{idWorkspace}}/projects/$$$$/estimate + And set value "MANUAL" of key type in body updateEstimate.json + When execute method PATCH + Then the status code should be 400 + + @UpdateEstimate401 + Scenario: Estimate Project Unauthorized + Given header x-api-key = 32423423423fgdfgaefad + And call updateProjectEstimate.feature@ListWorkspaceEstimate + And endpoint /v1/workspaces/{{idWorkspace}}/projects/mandinga + When execute method PATCH + Then the status code should be 401 + + @UpdateEstimate404 + Scenario: Estimate Project Not Found + Given call updateProjectEstimate.feature@ListWorkspaceEstimate + And endpoint /v1/workspaces/{{idWorkspace}}/project51s/mandinga + When execute method PATCH + Then the status code should be 404 \ No newline at end of file diff --git a/src/test/resources/features/updateProjectMembership.feature b/src/test/resources/features/updateProjectMembership.feature new file mode 100644 index 0000000..a17622d --- /dev/null +++ b/src/test/resources/features/updateProjectMembership.feature @@ -0,0 +1,61 @@ +Feature: updateProjectEstimate + + Background: + Given header Content-Type = application/json + And header Accept = */* + And header x-api-key = NTZhNWVmN2UtNjI1OS00OGU2LTg1ZDEtYmZkOWM1NzZjNDFk + And base url env.base_url_clockify + * define nombreProyectoMembership = Crowdar2023Membership + + @ListWorkspaceMembership + Scenario: + Given base url env.base_url_clockify + Given endpoint /v1/workspaces + When execute method GET + Then the status code should be 200 + * define idWorkspace = $[0].id + + + @CreateProjectMembership + Scenario: Create project + Given call updateProjectMembership.feature@ListWorkspaceMembership + And endpoint /v1/workspaces/{{idWorkspace}}/projects + And set value "{{nombreProyectoMembership}}" of key name in body addProject.json + When execute method POST + Then the status code should be 201 + * define idProject = $.id + + @UpdateMembership + Scenario: Update Membership project + Given call updateProjectMembership.feature@CreateProjectMembership + And endpoint /v1/workspaces/{{idWorkspace}}/projects/{{idProject}}/memberships + And set value "110" of key amount in body membership.json + When execute method PATCH + Then the status code should be 200 + + + @UpdateMembership400 + Scenario: Membership Project 400 Bad Request + Given call updateProjectMembership.feature@ListWorkspaceMembership + And endpoint /v1/workspaces/{{idWorkspace}}/projects/$$/memberships + And set value "110" of key amount in body membership.json + When execute method PATCH + Then the status code should be 400 + + + @UpdateMembership401 + Scenario: Membership Project 401 Unauthorized + Given call updateProjectMembership.feature@ListWorkspaceMembership + And header x-api-key = 32423423423fgdfgaefad + And endpoint /v1/workspaces/{{idWorkspace}}/projects/6535738fc64c131fb4e8f984/memberships + And set value "200" of key amount in body membership.json + When execute method PATCH + Then the status code should be 401 + + @UpdateMembership404 + Scenario: Membership Project 404 Not Found + Given call updateProjectMembership.feature@ListWorkspaceMembership + And endpoint /v1/workspaces/{{idWorkspace}}/projects/$$$/4444 + And set value "200" of key amount in body membership.json + When execute method PATCH + Then the status code should be 404 \ No newline at end of file diff --git a/src/test/resources/features/updateProjects.feature b/src/test/resources/features/updateProjects.feature new file mode 100644 index 0000000..ef323e6 --- /dev/null +++ b/src/test/resources/features/updateProjects.feature @@ -0,0 +1,59 @@ +Feature: Update Projects + + Background: + Given header Content-Type = application/json + And header Accept = */* + And header x-api-key = NTZhNWVmN2UtNjI1OS00OGU2LTg1ZDEtYmZkOWM1NzZjNDFk + And base url env.base_url_clockify + * define nombreProyectoUpdate = Crowdar2023Update + + @ListWorkspaceUpdateProjects + Scenario: Get all workspaces + Given base url env.base_url_clockify + Given endpoint /v1/workspaces + When execute method GET + Then the status code should be 200 + * define idWorkspace = $[0].id + + + @CreateProjectForUpdate + Scenario: Create project for update + Given call updateProjects.feature@ListWorkspaceUpdateProjects + And endpoint v1/workspaces/{{idWorkspace}}/projects + And set value "{{nombreProyectoUpdate}}" of key name in body addProjectUpdate.json + When execute method POST + Then the status code should be 201 + * define idProject = $.id + + @UpdateProject + Scenario: Update Project + Given call updateProjects.feature@CreateProjectUpdate + And endpoint /v1/workspaces/{{idWorkspace}}/projects/{{idProject}} + And set value "true" of key archived in body updateProjectToArchive.json + When execute method PUT + Then the status code should be 200 + + @UpdateProject400 + Scenario: Update Project Bad Request + Given call updateProjects.feature@ListWorkspaceUpdateProjects + And endpoint /v1/workspaces/{{idWorkspace}}/projects/hhhjjj + And set value "true" of key archived in body updateProjectToArchive.json + When execute method PUT + Then the status code should be 400 + + @UpdateProject401 + Scenario: Update Project Unauthorised + Given header x-api-key = 32423423423fgdfgaefad + And call updateProjects.feature@ListWorkspaceUpdateProjects + And endpoint /v1/workspaces/{{idWorkspace}}/projects/6535738fc64c131fb4e8f984 + And set value "true" of key archived in body updateProjectToArchive.json + When execute method PUT + Then the status code should be 401 + + @UpdateProject404 + Scenario: Update Project Not Found + Given call updateProjects.feature@ListWorkspaceUpdateProjects + And endpoint /v1/workspaces/{{idWorkspace}}/projects1234/6535738fc64c131fb4e8f984 + And set value "true" of key archived in body updateProjectToArchive.json + When execute method PUT + Then the status code should be 404 \ No newline at end of file diff --git a/src/test/resources/jsons/bodies/addProject.json b/src/test/resources/jsons/bodies/addProject.json new file mode 100644 index 0000000..528d523 --- /dev/null +++ b/src/test/resources/jsons/bodies/addProject.json @@ -0,0 +1,41 @@ +{ + "id": "6525d566fe961b435921cad4", + "name": "projecto1", + "hourlyRate": { + "amount": 0, + "currency": "USD" + }, + "clientId": "", + "workspaceId": "651f3817894cd94491a90671", + "billable": true, + "memberships": [ + { + "userId": "651f3817894cd94491a90670", + "hourlyRate": null, + "costRate": null, + "targetId": "6525d566fe961b435921cad4", + "membershipType": "PROJECT", + "membershipStatus": "ACTIVE" + } + ], + "color": "#009688", + "estimate": { + "estimate": "PT0S", + "type": "AUTO" + }, + "archived": false, + "duration": "PT0S", + "clientName": "", + "note": "", + "costRate": null, + "timeEstimate": { + "estimate": "PT0S", + "type": "AUTO", + "resetOption": null, + "active": false, + "includeNonBillable": true + }, + "budgetEstimate": null, + "template": false, + "public": true +} \ No newline at end of file diff --git a/src/test/resources/jsons/bodies/addProjectDelete.json b/src/test/resources/jsons/bodies/addProjectDelete.json new file mode 100644 index 0000000..528d523 --- /dev/null +++ b/src/test/resources/jsons/bodies/addProjectDelete.json @@ -0,0 +1,41 @@ +{ + "id": "6525d566fe961b435921cad4", + "name": "projecto1", + "hourlyRate": { + "amount": 0, + "currency": "USD" + }, + "clientId": "", + "workspaceId": "651f3817894cd94491a90671", + "billable": true, + "memberships": [ + { + "userId": "651f3817894cd94491a90670", + "hourlyRate": null, + "costRate": null, + "targetId": "6525d566fe961b435921cad4", + "membershipType": "PROJECT", + "membershipStatus": "ACTIVE" + } + ], + "color": "#009688", + "estimate": { + "estimate": "PT0S", + "type": "AUTO" + }, + "archived": false, + "duration": "PT0S", + "clientName": "", + "note": "", + "costRate": null, + "timeEstimate": { + "estimate": "PT0S", + "type": "AUTO", + "resetOption": null, + "active": false, + "includeNonBillable": true + }, + "budgetEstimate": null, + "template": false, + "public": true +} \ No newline at end of file diff --git a/src/test/resources/jsons/bodies/addProjectUpdate.json b/src/test/resources/jsons/bodies/addProjectUpdate.json new file mode 100644 index 0000000..3ed1633 --- /dev/null +++ b/src/test/resources/jsons/bodies/addProjectUpdate.json @@ -0,0 +1,3 @@ +{ + "name" : "Proje123114" +} \ No newline at end of file diff --git a/src/test/resources/jsons/bodies/membership.json b/src/test/resources/jsons/bodies/membership.json new file mode 100644 index 0000000..accd398 --- /dev/null +++ b/src/test/resources/jsons/bodies/membership.json @@ -0,0 +1,11 @@ +{ + "memberships": [ + { + "hourlyRate": { + "amount": 110, + "since": "2018-11-29T13:00:46Z" + }, + "userId": "65318f8cfd01ef6f99eb2bfb" + } + ] +} diff --git a/src/test/resources/jsons/bodies/updateEstimate.json b/src/test/resources/jsons/bodies/updateEstimate.json new file mode 100644 index 0000000..9d1f181 --- /dev/null +++ b/src/test/resources/jsons/bodies/updateEstimate.json @@ -0,0 +1,8 @@ +{ + "timeEstimate": { + "active": true, + "estimate": "PT1H", + "includeNonBillable": true, + "type": "MANUAL" + } +} \ No newline at end of file diff --git a/src/test/resources/jsons/bodies/updateProjectToArchive.json b/src/test/resources/jsons/bodies/updateProjectToArchive.json new file mode 100644 index 0000000..65b2e1e --- /dev/null +++ b/src/test/resources/jsons/bodies/updateProjectToArchive.json @@ -0,0 +1,5 @@ +{ + "archived": false, + "billable": true, + "isPublic": true +} \ No newline at end of file diff --git a/src/test/resources/lippia.conf b/src/test/resources/lippia.conf index f072a11..2201ac7 100644 --- a/src/test/resources/lippia.conf +++ b/src/test/resources/lippia.conf @@ -2,7 +2,7 @@ environments { default { "base_url_rickAndMorty" = "https://rickandmortyapi.com/api/" "base_url_petstore" = "https://petstore.swagger.io/v2/" - + "base_url_clockify" = "https://api.clockify.me/api/" } test {