Skip to content

Commit

Permalink
Added a separate appConfiguration folder for storing app config data
Browse files Browse the repository at this point in the history
Signed-off-by: veerendra thakur <veerendrat@proximabiz.com>
  • Loading branch information
thakurveerendras committed Sep 7, 2023
1 parent 355625e commit 90d568b
Show file tree
Hide file tree
Showing 15 changed files with 227 additions and 72 deletions.
3 changes: 2 additions & 1 deletion tests/functional/cypress.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"AUTH0_PASSWORD":"Test@123",
"LFX_API_TOKEN":"gDYBt6VYW6cmXelL/a3wTmHMa9sD37Xo9gsgaIjncbw=",
"AUTH0_CLIENT_SECRET":"eyJuYW1lIjoiYXV0aDAuanMtdWxwIiwidmVyc2lvbiI6IjkuMTIuMiJ9",
"AUTH0_CLIENT_ID":"hquZHO8JNsaIScoayPtCS5VELdn7TnVq"
"AUTH0_CLIENT_ID":"hquZHO8JNsaIScoayPtCS5VELdn7TnVq",
"CYPRESS_ENV" :"dev"
}
37 changes: 37 additions & 0 deletions tests/functional/cypress/appConfig/config.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// config.dev.js
export const appConfig = {
projectSFID: 'a09P000000DsCE5IAN',//project name: SUN

/*Variable for create cla group*/
foundationSFID:'a09P000000DsNGsIAN', //project name: easyAutom foundation & common for foundation.spec.ts
createNewClaGroupSFID:'a09P000000DsNGxIAN', //project name: easyAutom-child1
claGroupName:'CypressDevClaGroup',
gitHubOrgPartialStatus:'Sun-lfxfoundationOrgTest',//For partial Connection
enrollProjectsSFID:'a09P000000DsNHCIA3', //project name: easyAutomChild1-GrandChild1,
child_Project_name:'easyAutomChild1-GrandChild1',

/*company*/
companyName:'Infosys Limited',
user_id:"8f3e52b8-0072-11ee-9def-0ef17207dfe8",//vthakur+lfstaff@contractor.linuxfoundation.org
userEmail: "vthakur+lfstaff@contractor.linuxfoundation.org",
user_id2: "4a4c1dba-407f-11ed-8c58-a6b0f8fb81a9",//vthakur+lfitstaff@contractor.linuxfoundation.org

/*events*/
companyID:"f7c7ac9c-4dbf-4104-ab3f-6b38a26d82dc",
childProjectSFID:'a09P000000DsNH2IAN', //project name: easyAutom-child2

/*github-organizations*/
gitHubOrgUpdate:'ApiAutomStandaloneOrg',
gitHubNewOrg:'cypressioTest',
claGroupId:'1baf67ab-d894-4edf-b6fc-c5f939db59f7',

/*metrics*/
projectID:'01af041c-fa69-4052-a23c-fb8c1d3bef24',

/*cla-manager*/
userIdclaManager:'c5ac2857-c263-11ed-94d1-d2349de32229',//veerendrat
claGroupId_projectSFID:'01af041c-fa69-4052-a23c-fb8c1d3bef24',

/* project */
projectName:'easyAutom-child2',
};
8 changes: 8 additions & 0 deletions tests/functional/cypress/appConfig/config.production.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// config.production.js
export const appConfig = {
projectSFID: 'a09P000000DsCE5IAN',//project name: SUN
//Veriable used in foundation.spec.ts
foundationSFID:'a09P000000DsNGsIAN' //project name: easyAutom foundation
//Variable for create cla group

};
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
import {validateApiResponse,validate_200_Status,getTokenKey} from '../support/commands'

describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on child project", function () {

// Define a variable for the environment
const environment = Cypress.env("CYPRESS_ENV");

// Import the appropriate configuration based on the environment
let appConfig;
if (environment === 'dev') {
appConfig = require('../appConfig/config.dev.ts').appConfig;
} else if (environment === 'production') {
appConfig = require('../appConfig/config.production.ts').appConfig;
}

//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/cla-group

const claEndpoint = `${Cypress.env("APP_URL")}cla-service/v4`;
let claGroupId: string ="";

//Variable for create cla group
const foundation_sfid='a09P000000DsNGsIAN'; //project name: easyAutom foundation
const projectSfid='a09P000000DsNGxIAN'; //project name: easyAutom-child1
const cla_group_name='CypressClaGroup';
const foundation_sfid=appConfig.foundationSFID; //project name: easyAutom foundation
const projectSfid=appConfig.createNewClaGroupSFID; //project name: easyAutom-child1
const cla_group_name=appConfig.claGroupName;
const cla_group_description='Added via cypress script';

//variable for update cla group
const updated_cla_group_name='Cypress_Updated_ClaGroup1';
const updated_cla_group_name='Cypress_Updated_ClaGroup';
const update_cla_group_description='CLA group created and updated for easy cla automation child project 1'


//Variable for GitHub
const gitHubOrgName='Sun-lfxfoundationOrgTest';
const projectSfidOrg='a09P000000DsCE5IAN'; //project name: sun
const gitHubOrgName=appConfig.gitHubOrgPartialStatus;
const projectSfidOrg=appConfig.projectSFID; //project name: sun


//Enroll /unEnroll projects
const EnrollProjectsSFID='a09P000000DsNHCIA3' //project name: easyAutomChild1-GrandChild1
const child_Project_name='easyAutomChild1-GrandChild1'
const enrollProjectsSFID=appConfig.enrollProjectsSFID //project name: easyAutomChild1-GrandChild1
const child_Project_name=appConfig.child_Project_name


let bearerToken: string = null;
Expand All @@ -45,6 +57,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
auth: {
'bearer': bearerToken,
},
failOnStatusCode: false,
body: {
"icla_enabled": true,
"ccla_enabled": true,
Expand Down Expand Up @@ -81,6 +94,8 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
}
},
}).then((response) => {
const jsonResponse = JSON.stringify(response.body, null, 2);
cy.log(jsonResponse);
// expect(response.duration).to.be.lessThan(20000);
validate_200_Status(response);

Expand Down Expand Up @@ -150,7 +165,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
auth: {
'bearer': bearerToken,
},
body: [EnrollProjectsSFID],
body: [enrollProjectsSFID],
}).then((response) => {
// expect(response.duration).to.be.lessThan(20000);
validate_200_Status(response);
Expand All @@ -169,7 +184,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
expect(secondResponse.body).to.have.property('list');
let list = secondResponse.body.list;
expect(list[0].project_list[1].project_name).to.eql(child_Project_name)
expect(list[0].project_list[1].project_sfid).to.eql(EnrollProjectsSFID)
expect(list[0].project_list[1].project_sfid).to.eql(enrollProjectsSFID)
expect(list[0].project_list[0].project_sfid).to.eql(projectSfid)
});
} else {
Expand All @@ -186,7 +201,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
auth: {
'bearer': bearerToken,
},
body: [EnrollProjectsSFID],
body: [enrollProjectsSFID],
}).then((response) => {
// expect(response.duration).to.be.lessThan(20000);
validate_200_Status(response);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
import {validateApiResponse,validate_200_Status,getTokenKey} from '../support/commands'
describe("To Validate cla-manager API call", function () {
//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/cla-manager

// Define a variable for the environment
const environment = Cypress.env("CYPRESS_ENV");

// Import the appropriate configuration based on the environment
let appConfig;
if (environment === 'dev') {
appConfig = require('../appConfig/config.dev.ts').appConfig;
} else if (environment === 'production') {
appConfig = require('../appConfig/config.production.ts').appConfig;
}

//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/cla-manager
/*
https://api-gw.dev.platform.linuxfoundation.org/acs/v1/api-docs#tag/UserRole
https://api-gw.dev.platform.linuxfoundation.org/acs/v1/api-docs#tag/Role/operation/getRoles
*/
//Variable for GitHub
const companyID="f7c7ac9c-4dbf-4104-ab3f-6b38a26d82dc";//infosys limited
const projectSFID="a09P000000DsCE5IAN";//sun
const projectSFID_Designee="a09P000000DsNH2IAN"
const companyID=appConfig.companyID;//infosys limited
const projectSFID=appConfig.projectSFID;//sun
const projectSFID_Designee=appConfig.childProjectSFID//EASYAUTOM-CHILD2
const claEndpoint = `${Cypress.env("APP_URL")}cla-service/v4/`;
let bearerToken: string = null;
const claGroupID="1baf67ab-d894-4edf-b6fc-c5f939db59f7";
const sun_claGroupID="01af041c-fa69-4052-a23c-fb8c1d3bef24"
const claGroupID=appConfig.claGroupId;
const sun_claGroupID=appConfig.claGroupId_projectSFID //sun
const userEmail="veerendrat@proximabiz.com";
let companyName="Infosys limited";
let organization_id="";
let organization_name="";
let companyName=appConfig.companyName//"Infosys limited";
let companySFID="";
let userLFID="veerendrat";
let userId="c5ac2857-c263-11ed-94d1-d2349de32229";//veerendrat
let userId=appConfig.userIdclaManager//"c5ac2857-c263-11ed-94d1-d2349de32229";//veerendrat

before(() => {

Expand Down Expand Up @@ -81,8 +91,6 @@ https://api-gw.dev.platform.linuxfoundation.org/acs/v1/api-docs#tag/Role/operati
validate_200_Status(response);
// Validate specific data in the response
let list = response.body;
organization_id=list.organization_id;
organization_name=list.organization_name;
expect(list.project_sfid).to.eql(projectSFID)
//To validate schema of response
}else{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
import {validateApiResponse,validate_200_Status,getTokenKey} from '../support/commands'
describe("To Validate & get Company Activity Callback via API call", function () {
//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/company

// Define a variable for the environment
const environment = Cypress.env("CYPRESS_ENV");

// Import the appropriate configuration based on the environment
let appConfig;
if (environment === 'dev') {
appConfig = require('../appConfig/config.dev.ts').appConfig;
} else if (environment === 'production') {
appConfig = require('../appConfig/config.production.ts').appConfig;
}

//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/company
const claBaseEndpoint = `${Cypress.env("APP_URL")}cla-service/v4/`;
const claEndpoint = `${Cypress.env("APP_URL")}cla-service/v4/company/`;
let companyName="Infosys Limited";

let companyExternalID="";
let companyID="fcf59557-9708-4b2f-8200-4e6448761c0a";//Microsoft Corporation

let signingEntityName="";
const projectSFID="a09P000000DsCE5IAN";
let claGroupId="";

const user_id="8f3e52b8-0072-11ee-9def-0ef17207dfe8";//vthakur+lfstaff@contractor.linuxfoundation.org
const userEmail= "vthakur+lfstaff@contractor.linuxfoundation.org";
const user_id2="4a4c1dba-407f-11ed-8c58-a6b0f8fb81a9"//vthakur+lfitstaff@contractor.linuxfoundation.org
let companyID="";
let signingEntityName="";
let claGroupId="";

let companyName=appConfig.companyName;
const projectSFID=appConfig.projectSFID; //project name: sun
const user_id=appConfig.user_id;//vthakur+lfstaff@contractor.linuxfoundation.org
const userEmail=appConfig.userEmail;
const user_id2=appConfig.user_id2//vthakur+lfitstaff@contractor.linuxfoundation.org

let bearerToken: string = null;
before(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import {validateApiResponse,validate_200_Status,getTokenKey} from '../support/commands'
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

// Define a variable for the environment
const environment = Cypress.env("CYPRESS_ENV");

// Import the appropriate configuration based on the environment
let appConfig;
if (environment === 'dev') {
appConfig = require('../appConfig/config.dev.ts').appConfig;
} else if (environment === 'production') {
appConfig = require('../appConfig/config.production.ts').appConfig;
}

//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 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 foundationSFID=appConfig.foundationSFID; //project name: easyAutom foundation
const projectSfid=appConfig.childProjectSFID; //project name: easyAutom-child2
const companyID=appConfig.companyID;//Infosys Limited
const compProjectSFID=appConfig.projectSFID; //sun

let bearerToken: string = null;
before(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import {validateApiResponse,validate_200_Status,getTokenKey} from '../support/commands'
//import {appConfig} from '../support/config.${Cypress.env("CYPRESS_ENV")}'
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

// Define a variable for the environment
const environment = Cypress.env("CYPRESS_ENV");

// Import the appropriate configuration based on the environment
let appConfig;
if (environment === 'dev') {
appConfig = require('../appConfig/config.dev.ts').appConfig;
} else if (environment === 'production') {
appConfig = require('../appConfig/config.production.ts').appConfig;
}

//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`;
const foundationSFID='a09P000000DsNGsIAN'; //project name: easyAutom foundation
const foundationSFID=appConfig.foundationSFID; //project name: easyAutom foundation

let bearerToken: string = null;
before(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import {validateApiResponse,validate_200_Status,getTokenKey} from '../support/commands'
describe("To Validate github-organizations API call", function () {
//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/github-organizations

// Define a variable for the environment
const environment = Cypress.env("CYPRESS_ENV");

//Variable for GitHub
const gitHubOrgName='ApiAutomStandaloneOrg';
const projectSfidOrg='a09P000000DsNH2IAN'; //project name: easyAutom-child2
const gitHubOrg='cypressioTest';
// Import the appropriate configuration based on the environment
let appConfig;
if (environment === 'dev') {
appConfig = require('../appConfig/config.dev.ts').appConfig;
} else if (environment === 'production') {
appConfig = require('../appConfig/config.production.ts').appConfig;
}
//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/github-organizations

//Variable for GitHub
const gitHubOrgName=appConfig.gitHubOrgUpdate;
const projectSfidOrg=appConfig.childProjectSFID; //project name: easyAutom-child2
const gitHubOrg=appConfig.gitHubNewOrg;

const claEndpoint = `${Cypress.env("APP_URL")}cla-service/v4/project/${projectSfidOrg}/github/organizations`;
const claGroupId: string ="1baf67ab-d894-4edf-b6fc-c5f939db59f7";

const claGroupId: string =appConfig.claGroupId;

let bearerToken: string = null;
before(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import {validateApiResponse,validate_200_Status,getTokenKey} from '../support/commands'
describe("To Validate github-organizations API call", function () {
//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/github-repositories

// Define a variable for the environment
const environment = Cypress.env("CYPRESS_ENV");

// Import the appropriate configuration based on the environment
let appConfig;
if (environment === 'dev') {
appConfig = require('../appConfig/config.dev.ts').appConfig;
} else if (environment === 'production') {
appConfig = require('../appConfig/config.production.ts').appConfig;
}

//Reference api doc: https://api-gw.dev.platform.linuxfoundation.org/cla-service/v4/api-docs#tag/github-repositories

const Ajv = require('ajv');
//Variable for GitHub
const projectSfidOrg='a09P000000DsNH2IAN'; //project name: easyAutom-child2
const projectSfidOrg=appConfig.childProjectSFID; //project name: easyAutom-child2

const claEndpoint = `${Cypress.env("APP_URL")}cla-service/v4/project/${projectSfidOrg}/github/repositories`;
let claGroupId: string ="1baf67ab-d894-4edf-b6fc-c5f939db59f7";
let claGroupId: string =appConfig.claGroupId;
let repository_id: string="";
let repository_external_id: string="";
let repository_external_id2: string="";
Expand Down
Loading

0 comments on commit 90d568b

Please sign in to comment.