From f3d0dadace99a0238e47546366b06310800a2c96 Mon Sep 17 00:00:00 2001 From: Jordan Beard Date: Wed, 1 Feb 2023 12:22:40 +0000 Subject: [PATCH] remove cypress tests for conversion projects --- .../get-conversion-projects-with-id.js | 39 ------------- .../get-conversion-projects.js | 35 ------------ .../patch-conversion-projects-with-id.js | 56 ------------------- .../conversions/order-project-by-date.js | 26 --------- CypressTests/cypress/support/commands.js | 17 +----- 5 files changed, 1 insertion(+), 172 deletions(-) delete mode 100644 CypressTests/cypress/integration/conversions/GET conversion-projects/get-conversion-projects-with-id.js delete mode 100644 CypressTests/cypress/integration/conversions/GET conversion-projects/get-conversion-projects.js delete mode 100644 CypressTests/cypress/integration/conversions/PATCH conversion-projects/patch-conversion-projects-with-id.js delete mode 100644 CypressTests/cypress/integration/conversions/order-project-by-date.js diff --git a/CypressTests/cypress/integration/conversions/GET conversion-projects/get-conversion-projects-with-id.js b/CypressTests/cypress/integration/conversions/GET conversion-projects/get-conversion-projects-with-id.js deleted file mode 100644 index d58b5d615..000000000 --- a/CypressTests/cypress/integration/conversions/GET conversion-projects/get-conversion-projects-with-id.js +++ /dev/null @@ -1,39 +0,0 @@ -/// -describe("GET conversion-projects", () => { - let apiKey = Cypress.env('apiKey'); - let url = Cypress.env('url') - - it('Should reject invalid parameters - alphabetical chars', () => { - cy.request({ - failOnStatusCode: false, - url: url+"conversion-projects?count=abcdef", - headers: { - ApiKey: apiKey, - } - }) - .its('body.errors.count').should('contain','The value \'abcdef\' is not valid.') - }); - - it('Should reject invalid parameters - negative integer value', () => { - cy.request({ - failOnStatusCode: false, - url: url+"conversion-projects?count=-1", - headers: { - ApiKey: apiKey, - } - }).should((response)=>{ - expect(response.status).to.eq(500) - expect(response.body.Message).to.contain('Internal Server Error: The number of rows provided for a FETCH clause must be greater then zero') - }) - }) - - it('Should reject invalidparameters - negative integer value', () => { - cy.request({ - failOnStatusCode: false, - url: url+"conversion-projects?count=-1", - headers: { - ApiKey: apiKey, - } - }) - }) -}); diff --git a/CypressTests/cypress/integration/conversions/GET conversion-projects/get-conversion-projects.js b/CypressTests/cypress/integration/conversions/GET conversion-projects/get-conversion-projects.js deleted file mode 100644 index b2f26b438..000000000 --- a/CypressTests/cypress/integration/conversions/GET conversion-projects/get-conversion-projects.js +++ /dev/null @@ -1,35 +0,0 @@ -/// -describe("GET conversion-projects", () => { - let apiKey = Cypress.env('apiKey'); - let url = Cypress.env('url') - it("Should return a valid 200 response", () => { - cy.request({ - failOnStatusCode: false, - url: url+"/conversion-projects?", - headers: { - ApiKey: apiKey, - } - }).its('status').should('eq', 200) - }); - - it("Should return a valid 401 response when omitting API key", () => { - cy.request({ - failOnStatusCode: false, - url: url+"conversion-projects?", - headers: { - ApiKey: '', - } - }).its('status').should('eq', 401) - }); - - it('Should reject invalid parameters - alphabetical chars', () => { - cy.request({ - failOnStatusCode: false, - url: url+"conversion-projects?count=abcdef", - headers: { - ApiKey: apiKey, - } - }) - .its('body.errors.count').should('contain','The value \'abcdef\' is not valid.') - }); -}); diff --git a/CypressTests/cypress/integration/conversions/PATCH conversion-projects/patch-conversion-projects-with-id.js b/CypressTests/cypress/integration/conversions/PATCH conversion-projects/patch-conversion-projects-with-id.js deleted file mode 100644 index 63a886460..000000000 --- a/CypressTests/cypress/integration/conversions/PATCH conversion-projects/patch-conversion-projects-with-id.js +++ /dev/null @@ -1,56 +0,0 @@ -/// -describe("GET conversion-projects", () => { - let apiKey = Cypress.env('apiKey'); - let url = Cypress.env('url') - - it('Should reject PATCH request to URI containing invalid project ID with 400 error - alphabetical chars', () => { - cy.request({ - method : 'PATCH', - failOnStatusCode: false, - url: url+"conversion-projects/abcdef", - headers: { - ApiKey: apiKey, - "Content-type" : "application/json" - }, - body: { - - } - }) - .should((response)=>{ - cy.log(response) - expect(response.status).to.eq(404) - }) - }) - - it('Should reject PATCH request to URI containing invalid project Id with 404- non-existant ID', () => { - cy.request({ - method : 'PATCH', - failOnStatusCode: false, - url: url+"conversion-projects/99999999", - headers: { - ApiKey: apiKey, - }, - body:{ - - } - }).should((response)=>{ - expect(response.status).to.eq(404) - }) - }) - - it('Should reject PATCH request to URI containing invalid project Id with 415- negative number ID', () => { - cy.request({ - method : 'PATCH', - failOnStatusCode: false, - url: url+"conversion-projects/-1", - headers: { - ApiKey: apiKey, - }, - body:{ - - } - }).should((response)=>{ - expect(response.status).to.eq(404) - }) - }) -}); diff --git a/CypressTests/cypress/integration/conversions/order-project-by-date.js b/CypressTests/cypress/integration/conversions/order-project-by-date.js deleted file mode 100644 index 59a9f7550..000000000 --- a/CypressTests/cypress/integration/conversions/order-project-by-date.js +++ /dev/null @@ -1,26 +0,0 @@ -/// - -describe('Project Application ordered by date', () => { - - it('TC01: Application ordered by date received', () => { - - cy.beData() - .should((response) => { - - // GET project by random [0][2][1] - const projectDates = ([response.body[1].applicationReceivedDate, response.body[0].applicationReceivedDate, response.body[2].applicationReceivedDate]) - cy.log(projectDates) - - // GET project timestamps - const timestamps = Cypress._.map(projectDates) - .map((str) => new Date(str)) - cy.log(timestamps) - - // GET & sort timestamps ascending order - const sorted = Cypress._.sortBy(timestamps) - cy.log(sorted) - // timestamps[1] === slice i.e.,projectDates([0], [1], [2]) - expect(timestamps[2]).to.deep.equal(sorted[0]) - }) - }) -}) \ No newline at end of file diff --git a/CypressTests/cypress/support/commands.js b/CypressTests/cypress/support/commands.js index 4e900ccf1..1a697e2dc 100644 --- a/CypressTests/cypress/support/commands.js +++ b/CypressTests/cypress/support/commands.js @@ -28,19 +28,4 @@ import { validateSchema } from "./validate-schema-command"; -Cypress.Commands.add("validateSchema", validateSchema); - - -Cypress.Commands.add('beData', () => { - const apiKey = Cypress.env('apiKey') - const url = Cypress.env('url') - - cy.request({ - method:'GET', - url: url + '/conversion-projects?count=4', - headers: { - ApiKey: apiKey, - "Content-type" : "application/json" - } - }) -}) +Cypress.Commands.add("validateSchema", validateSchema); \ No newline at end of file