From ba9659cf84871d6dbbaf3201ad7cf8c8b834a730 Mon Sep 17 00:00:00 2001 From: veerendra thakur Date: Thu, 24 Aug 2023 12:43:16 +0530 Subject: [PATCH] add cypress test case for events services Signed-off-by: veerendra thakur --- tests/functional/cypress.env.json | 3 +- tests/functional/cypress/e2e/events.spec.ts | 199 +++++ .../functional/cypress/e2e/foundation.spec.ts | 7 +- .../events/getCompanyProjectEvents.json | 437 ++++++++++ .../fixtures/events/getFoundationEvents.json | 744 ++++++++++++++++++ .../fixtures/events/getProjectEvents.json | 728 +++++++++++++++++ tests/functional/cypress/support/commands.js | 9 +- 7 files changed, 2114 insertions(+), 13 deletions(-) create mode 100644 tests/functional/cypress/e2e/events.spec.ts create mode 100644 tests/functional/cypress/fixtures/events/getCompanyProjectEvents.json create mode 100644 tests/functional/cypress/fixtures/events/getFoundationEvents.json create mode 100644 tests/functional/cypress/fixtures/events/getProjectEvents.json diff --git a/tests/functional/cypress.env.json b/tests/functional/cypress.env.json index 11a8fe7b4..902e02687 100644 --- a/tests/functional/cypress.env.json +++ b/tests/functional/cypress.env.json @@ -3,6 +3,5 @@ "AUTH0_TOKEN_API":"https://linuxfoundation-dev.auth0.com/oauth/token", "AUTH0_USER_NAME":"vthakur", "AUTH0_PASSWORD":"Test@123", - "AUTH0_CLIENT_ID":"hquZHO8JNsaIScoayPtCS5VELdn7TnVq" - + "AUTH0_CLIENT_ID":"hquZHO8JNsaIScoayPtCS5VELdn7TnVq" } \ No newline at end of file diff --git a/tests/functional/cypress/e2e/events.spec.ts b/tests/functional/cypress/e2e/events.spec.ts new file mode 100644 index 000000000..b433999f4 --- /dev/null +++ b/tests/functional/cypress/e2e/events.spec.ts @@ -0,0 +1,199 @@ +describe("To Validate events are properly capture via API call", function () { + //Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/events + const claEndpoint = `${Cypress.env("APP_URL")}cla-service/v4/events`; + let claEndpointForNextKey=""; + let bearerToken: string = ""; + let NextKey: string=""; + const foundationSFID='a09P000000DsNGsIAN'; //project name: easyAutom foundation + const projectSfid='a09P000000DsNH2IAN'; //project name: easyAutom-child2 + const companyID="f7c7ac9c-4dbf-4104-ab3f-6b38a26d82dc"; + const compProjectSFID="a092h000004x5tVAAQ"; + const Ajv = require('ajv'); + +before(() => { + + cy.request({ + method: 'POST', + url: Cypress.env("AUTH0_TOKEN_API"), + + body: { + "grant_type": "http://auth0.com/oauth/grant-type/password-realm", + "realm": "Username-Password-Authentication", + "username":Cypress.env("AUTH0_USER_NAME"), + "password":Cypress.env("AUTH0_PASSWORD"), + "client_id":Cypress.env("AUTH0_CLIENT_ID"), + "audience": "https://api-gw.dev.platform.linuxfoundation.org/", + "scope": "access:api openid profile email" + } + + }).then(response => { + expect(response.status).to.eq(200); + bearerToken = response.body.access_token; + }); +}); + +it("Get recent events of company and project - Record should Returns 200 Response", function () { + claEndpointForNextKey=`${Cypress.env("APP_URL")}cla-service/v4/company/${companyID}/project/${compProjectSFID}/events` + cy.request({ + method: 'GET', + url: `${claEndpointForNextKey}`, + auth: { + 'bearer': bearerToken, + } + }).then((response) => { + expect(response.status).to.eq(200); + expect(response.body).to.not.be.null; + // Validate specific data in the response + let list=response.body; + NextKey=list.NextKey; + expect(list).to.have.property('NextKey'); + expect(list).to.have.property('ResultCount'); + expect(list).to.have.property('Events'); + let Events = list.Events; + // Assert that the response contains an array + expect(Events).to.be.an('array'); + // Assert that the array has at least one item + expect(Events.length).to.be.greaterThan(0); + // schemaValidate("events/getFoundationEvents.json",list); + schemaValidate("events/getCompanyProjectEvents.json",list); + fetchNextRecords(claEndpointForNextKey,NextKey); + }); + }); + +it("Get events of foundation project - Record should Returns 200 Response", function () { + claEndpointForNextKey=`${claEndpoint}/foundation/${foundationSFID}` + cy.request({ + method: 'GET', + url: `${claEndpointForNextKey}`, + auth: { + 'bearer': bearerToken, + } + }).then((response) => { + expect(response.status).to.eq(200); + expect(response.body).to.not.be.null; + // Validate specific data in the response + let list=response.body; + NextKey=list.NextKey; + expect(list).to.have.property('NextKey'); + expect(list).to.have.property('ResultCount'); + expect(list).to.have.property('Events'); + let Events = list.Events; + // Assert that the response contains an array + expect(Events).to.be.an('array'); + // Assert that the array has at least one item + expect(Events.length).to.be.greaterThan(0); + // schemaValidate("events/getFoundationEvents.json",list); + schemaValidate("events/getFoundationEvents.json",list); + fetchNextRecords(claEndpointForNextKey,NextKey); + }); + }); + + it("Get events of child project - Record should Returns 200 Response", function () { + claEndpointForNextKey=`${claEndpoint}/project/${projectSfid}`; + cy.request({ + method: 'GET', + url: `${claEndpointForNextKey}`, + auth: { + 'bearer': bearerToken, + } + }).then((response) => { + expect(response.status).to.eq(200); + expect(response.body).to.not.be.null; + let list=response.body; + // Validate specific data in the response + expect(list).to.have.property('NextKey'); + expect(list).to.have.property('ResultCount'); + expect(list).to.have.property('Events'); + let Events = response.body.Events; + // Assert that the response contains an array + expect(Events).to.be.an('array'); + // Assert that the array has at least one item + expect(Events.length).to.be.greaterThan(0); + //To validate schema of response + schemaValidate("events/getProjectEvents",list) + fetchNextRecords(claEndpointForNextKey,NextKey); + }); + }); + + it.skip("Get List of recent events - requires Admin-level access - Record should Returns 200 Response", function () { + cy.request({ + method: 'GET', + url: `${claEndpoint}/recent?pageSize=2`, + auth: { + 'bearer': bearerToken, + } + }).then((response) => { + expect(response.status).to.eq(200); + expect(response.body).to.not.be.null; + // Validate specific data in the response + let list=response.body; + expect(list).to.have.property('NextKey'); + expect(list).to.have.property('ResultCount'); + expect(list).to.have.property('Events'); + let Events = list.Events; + // Assert that the response contains an array + expect(Events).to.be.an('array'); + // Assert that the array has at least one item + expect(Events.length).to.be.greaterThan(0); + //To validate schema of response + schemaValidate("events/getProjectEvents.json",list) + }); + }); + + it("Download all the events for the foundation as a CSV document - Record should Returns 200 Response", function () { + cy.request({ + method: 'GET', + url: `${claEndpoint}/foundation/${foundationSFID}/csv`, + auth: { + 'bearer': bearerToken, + } + }).then((response) => { + expect(response.status).to.eq(200); + }); + }); + + it("Download all the events for the project as a CSV document - Record should Returns 200 Response", function () { + cy.request({ + method: 'GET', + url: `${claEndpoint}/project/${projectSfid}/csv`, + auth: { + 'bearer': bearerToken, + } + }).then((response) => { + expect(response.status).to.eq(200); + }); + }); + + function fetchNextRecords(URL,NextKey){ + + cy.request({ + method: 'GET', + url: `${URL}?nextKey=${NextKey}&pageSize=50`, + auth: { + 'bearer': bearerToken, + } + }).then((response) => { + expect(response.status).to.eq(200); + expect(response.body).to.not.be.null; + // Validate specific data in the response + let updatedNextKey=response.body.NextKey; + if(updatedNextKey!==undefined){ + fetchNextRecords(URL,updatedNextKey); + } + }); + } + + function schemaValidate(schemaPath,body){ + //To validate schema of response + const ajv = new Ajv(); + // Load the JSON schema + cy.fixture(schemaPath).then( + (schema) => { + const validate = ajv.compile(schema); + const isValid = validate(body); + // Assert that the response matches the schema + expect(isValid, 'API response schema is valid').to.be.true; + }); + } + +}) \ No newline at end of file diff --git a/tests/functional/cypress/e2e/foundation.spec.ts b/tests/functional/cypress/e2e/foundation.spec.ts index 9154ba881..39c3c9683 100644 --- a/tests/functional/cypress/e2e/foundation.spec.ts +++ b/tests/functional/cypress/e2e/foundation.spec.ts @@ -1,13 +1,9 @@ -describe("To Validate github-organizations API call", function () { +describe("To Validate & get list of Foundation ClaGroups via API call", function () { //Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/foundation const claEndpoint = `${Cypress.env("APP_URL")}cla-service/v4/foundation-mapping`; let bearerToken: string = ""; const foundationSFID='a09P000000DsNGsIAN'; //project name: easyAutom foundation const Ajv = require('ajv'); - //Headers - let optionalHeaders: Headers = { - "X-LFX-CACHE": false, - } before(() => { @@ -35,7 +31,6 @@ it("Get CLA Groups under a foundation- Record should Returns 200 Response", func cy.request({ method: 'GET', url: `${claEndpoint}?foundationSFID=${foundationSFID}`, - headers: optionalHeaders, auth: { 'bearer': bearerToken, } diff --git a/tests/functional/cypress/fixtures/events/getCompanyProjectEvents.json b/tests/functional/cypress/fixtures/events/getCompanyProjectEvents.json new file mode 100644 index 000000000..b0be70024 --- /dev/null +++ b/tests/functional/cypress/fixtures/events/getCompanyProjectEvents.json @@ -0,0 +1,437 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Events": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventCompanyID": { + "type": "string" + }, + "EventCompanyName": { + "type": "string" + }, + "EventCompanySFID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventCompanyID", + "EventCompanyName", + "EventCompanySFID", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventCompanyID": { + "type": "string" + }, + "EventCompanyName": { + "type": "string" + }, + "EventCompanySFID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventCompanyID", + "EventCompanyName", + "EventCompanySFID", + "EventData", + "EventID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventCompanyID": { + "type": "string" + }, + "EventCompanyName": { + "type": "string" + }, + "EventCompanySFID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventCompanyID", + "EventCompanyName", + "EventCompanySFID", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventCompanyID": { + "type": "string" + }, + "EventCompanyName": { + "type": "string" + }, + "EventCompanySFID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventCompanyID", + "EventCompanyName", + "EventCompanySFID", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventCompanyID": { + "type": "string" + }, + "EventCompanyName": { + "type": "string" + }, + "EventCompanySFID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventCompanyID", + "EventCompanyName", + "EventCompanySFID", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + } + ] + }, + "NextKey": { + "type": "string" + }, + "ResultCount": { + "type": "integer" + } + }, + "required": [ + "Events", + "NextKey", + "ResultCount" + ] + } \ No newline at end of file diff --git a/tests/functional/cypress/fixtures/events/getFoundationEvents.json b/tests/functional/cypress/fixtures/events/getFoundationEvents.json new file mode 100644 index 000000000..666897d46 --- /dev/null +++ b/tests/functional/cypress/fixtures/events/getFoundationEvents.json @@ -0,0 +1,744 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Events": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + } + ] + }, + "NextKey": { + "type": "string" + }, + "ResultCount": { + "type": "integer" + } + }, + "required": [ + "Events", + "NextKey", + "ResultCount" + ] +} \ No newline at end of file diff --git a/tests/functional/cypress/fixtures/events/getProjectEvents.json b/tests/functional/cypress/fixtures/events/getProjectEvents.json new file mode 100644 index 000000000..e590fcd78 --- /dev/null +++ b/tests/functional/cypress/fixtures/events/getProjectEvents.json @@ -0,0 +1,728 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "Events": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventCLAGroupName": { + "type": "string" + }, + "EventCLAGroupNameLower": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventCLAGroupName", + "EventCLAGroupNameLower", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + }, + { + "type": "object", + "properties": { + "EventCLAGroupID": { + "type": "string" + }, + "EventData": { + "type": "string" + }, + "EventID": { + "type": "string" + }, + "EventParentProjectName": { + "type": "string" + }, + "EventParentProjectSFID": { + "type": "string" + }, + "EventProjectID": { + "type": "string" + }, + "EventProjectName": { + "type": "string" + }, + "EventProjectSFID": { + "type": "string" + }, + "EventSummary": { + "type": "string" + }, + "EventTime": { + "type": "string" + }, + "EventTimeEpoch": { + "type": "integer" + }, + "EventType": { + "type": "string" + }, + "LfUsername": { + "type": "string" + }, + "UserID": { + "type": "string" + }, + "UserName": { + "type": "string" + } + }, + "required": [ + "EventCLAGroupID", + "EventData", + "EventID", + "EventParentProjectName", + "EventParentProjectSFID", + "EventProjectID", + "EventProjectName", + "EventProjectSFID", + "EventSummary", + "EventTime", + "EventTimeEpoch", + "EventType", + "LfUsername", + "UserID", + "UserName" + ] + } + ] + }, + "NextKey": { + "type": "string" + }, + "ResultCount": { + "type": "integer" + } + }, + "required": [ + "Events", + "NextKey", + "ResultCount" + ] +} \ No newline at end of file diff --git a/tests/functional/cypress/support/commands.js b/tests/functional/cypress/support/commands.js index b37158a7d..4075d384a 100644 --- a/tests/functional/cypress/support/commands.js +++ b/tests/functional/cypress/support/commands.js @@ -1,7 +1,6 @@ - - /* -Cypress.Commands.add('schemaValidate', (schemaPath,body) => { +// const Ajv = require('ajv'); +export function schemaValidate(schemaPath,body,ajv){ cy.fixture(schemaPath).then( (schema) => { @@ -10,9 +9,9 @@ Cypress.Commands.add('schemaValidate', (schemaPath,body) => { const isValid = validate(body); // Assert that the response matches the schema expect(isValid, 'API response schema is valid').to.be.true; - + }) -}); +}; */ // let bearerToken={};