@@ -22,10 +22,13 @@ describe('To Validate & get list of signatures of ClaGroups via API call', funct
2222 const claEndpoint = getAPIBaseURL ( 'v4' ) ;
2323 const claGroupID = appConfig . claGroupId_projectSFID ; //Sun
2424 const lfid = appConfig . lfid ;
25+ const lfid2 = appConfig . lfid2 ;
26+ const lfid3 = appConfig . lfid3 ;
2527 const companyID = appConfig . companyID ; //Infosys Limited
2628 const companyName = appConfig . companyName ; //Infosys Limited
2729 const projectSFID = appConfig . projectSFID ; //sun
2830 const userID = appConfig . userIdclaManager ; //veerendrat
31+ const userID2 = appConfig . userIdclaManager2 ;
2932
3033 //Aprroval list veriable
3134 const emailApprovalList = appConfig . emailApprovalList ;
@@ -51,50 +54,59 @@ describe('To Validate & get list of signatures of ClaGroups via API call', funct
5154 } ) ;
5255
5356 it ( 'Returns a list of corporate contributor for the CLA Group' , function ( ) {
57+ let url = `${ claEndpoint } cla-group/${ claGroupID } /corporate-contributors?companyID=${ companyID } &pageSize=100` ;
58+ cy . task ( 'log' , 'Returns a list of corporate contributor for the CLA Group URL: ' + url ) ;
5459 cy . request ( {
5560 method : 'GET' ,
56- url : ` ${ claEndpoint } cla-group/ ${ claGroupID } /corporate-contributors?companyID= ${ companyID } ` ,
61+ url : url ,
5762 failOnStatusCode : allowFail ,
5863 headers : getXACLHeader ( ) ,
5964 auth : {
6065 bearer : bearerToken ,
6166 } ,
6267 timeout : 180000 ,
6368 } ) . then ( ( response ) => {
64- validate_200_Status ( response ) ;
65- let list = response . body . list ;
66- for ( let i = 0 ; i <= list . length - 1 ; i ++ ) {
67- if ( list [ i ] . linux_foundation_id === lfid ) {
68- if ( list [ i ] . signatureApproved === true ) {
69- expect ( list [ i ] . signatureApproved ) . to . be . true ;
70- signatureApproved = true ;
71- } else if ( list [ i ] . signatureApproved === false ) {
72- expect ( list [ i ] . signatureApproved ) . to . be . false ;
73- signatureApproved = false ;
69+ return cy . logJson ( 'response' , response ) . then ( ( ) => {
70+ validate_200_Status ( response ) ;
71+ let list = response . body . list ;
72+ for ( let i = 0 ; i <= list . length - 1 ; i ++ ) {
73+ if ( list [ i ] . linux_foundation_id === lfid3 ) {
74+ if ( list [ i ] . signatureApproved === true ) {
75+ expect ( list [ i ] . signatureApproved ) . to . be . true ;
76+ signatureApproved = true ;
77+ } else if ( list [ i ] . signatureApproved === false ) {
78+ expect ( list [ i ] . signatureApproved ) . to . be . false ;
79+ signatureApproved = false ;
80+ }
81+ signatureCclaID = list [ i ] . signatureID ;
82+ break ;
7483 }
75- signatureCclaID = list [ i ] . signatureID ;
76- break ;
7784 }
78- }
79- validateApiResponse ( 'signatures/listClaGroupCorporateContributors.json' , response ) ;
85+ cy . task ( 'log' , 'Signature ID: ' + signatureCclaID + ' and Approved: ' + signatureApproved ) ;
86+ validateApiResponse ( 'signatures/listClaGroupCorporateContributors.json' , response ) ;
87+ } ) ;
8088 } ) ;
8189 } ) ;
8290
8391 it ( 'Returns the signature when provided the signature ID, ecla records' , function ( ) {
92+ let url = `${ claEndpoint } signatures/id/${ signatureCclaID } ` ;
93+ cy . task ( 'log' , 'Returns the signature when provided the signature ID, ecla records URL: ' + url ) ;
8494 cy . request ( {
8595 method : 'GET' ,
86- url : ` ${ claEndpoint } signatures/id/ ${ signatureCclaID } ` ,
96+ url : url ,
8797 timeout : 180000 ,
8898 failOnStatusCode : allowFail ,
8999 headers : getXACLHeader ( ) ,
90100 auth : {
91101 bearer : bearerToken ,
92102 } ,
93103 } ) . then ( ( response ) => {
94- validate_200_Status ( response ) ;
95- let list = response . body ;
96- expect ( list . signatureApproved ) . to . eql ( signatureApproved ) ;
97- expect ( list . signatureType ) . to . eql ( 'ecla' ) ;
104+ return cy . logJson ( 'response' , response ) . then ( ( ) => {
105+ validate_200_Status ( response ) ;
106+ let list = response . body ;
107+ expect ( list . signatureApproved ) . to . eql ( signatureApproved ) ;
108+ expect ( list . signatureType ) . to . eql ( 'ecla' ) ;
109+ } ) ;
98110 } ) ;
99111 } ) ;
100112
@@ -336,24 +348,29 @@ describe('To Validate & get list of signatures of ClaGroups via API call', funct
336348 } ) ;
337349
338350 it ( 'Returns a list of user signatures when provided the user ID' , function ( ) {
351+ let url = `${ claEndpoint } signatures/user/${ userID2 } ` ;
352+ cy . task ( 'log' , 'Returns a list of user signatures when provided the user ID URL: ' + url ) ;
339353 cy . request ( {
340354 method : 'GET' ,
341- url : ` ${ claEndpoint } signatures/user/ ${ userID } ` ,
355+ url : url ,
342356 timeout : 180000 ,
343357 failOnStatusCode : allowFail ,
344358 headers : getXACLHeader ( ) ,
345359 auth : {
346360 bearer : bearerToken ,
347361 } ,
348362 } ) . then ( ( response ) => {
349- validate_200_Status ( response ) ;
350- let signatures = response . body . signatures ;
351- for ( let i = 0 ; i <= signatures . length - 1 ; i ++ ) {
352- expect ( signatures [ i ] . companyName ) . to . eql ( companyName ) ;
353- expect ( signatures [ i ] . signatureReferenceType ) . to . eql ( 'user' ) ;
354- signatureID = signatures [ i ] . signatureID ;
355- }
356- validateApiResponse ( 'signatures/getProjectCompanySignatures.json' , response ) ;
363+ return cy . logJson ( 'response' , response ) . then ( ( ) => {
364+ validate_200_Status ( response ) ;
365+ let signatures = response . body . signatures ;
366+ for ( let i = 0 ; i <= signatures . length - 1 ; i ++ ) {
367+ // LG: API /signatures/user/{userID} internally skips ECLA records, and for ICLA we never have company
368+ expect ( signatures [ i ] . companyName ) . to . be . undefined ;
369+ expect ( signatures [ i ] . signatureReferenceType ) . to . eql ( 'user' ) ;
370+ signatureID = signatures [ i ] . signatureID ;
371+ }
372+ validateApiResponse ( 'signatures/getProjectCompanySignatures.json' , response ) ;
373+ } ) ;
357374 } ) ;
358375 } ) ;
359376
@@ -410,9 +427,11 @@ describe('To Validate & get list of signatures of ClaGroups via API call', funct
410427 /* Below test case for Updates the Project / Organization/Company Approval list */
411428
412429 it ( 'Add Email as Approval List to the Project/Company' , function ( ) {
430+ let url = `${ claEndpoint } signatures/project/${ projectSFID } /company/${ companyID } /clagroup/${ claGroupID } /approval-list` ;
431+ cy . task ( 'log' , 'Add Email as Approval List to the Project/Company URL: ' + url ) ;
413432 cy . request ( {
414433 method : 'PUT' ,
415- url : ` ${ claEndpoint } signatures/project/ ${ projectSFID } /company/ ${ companyID } /clagroup/ ${ claGroupID } /approval-list` ,
434+ url : url ,
416435 timeout : 180000 ,
417436 failOnStatusCode : allowFail ,
418437 headers : getXACLHeader ( ) ,
@@ -423,9 +442,11 @@ describe('To Validate & get list of signatures of ClaGroups via API call', funct
423442 AddEmailApprovalList : [ emailApprovalList ] ,
424443 } ,
425444 } ) . then ( ( response ) => {
426- validate_200_Status ( response ) ;
427- let list = response . body . emailApprovalList ;
428- expect ( list [ 0 ] ) . to . eql ( emailApprovalList ) ;
445+ return cy . logJson ( 'response' , response ) . then ( ( ) => {
446+ validate_200_Status ( response ) ;
447+ let list = response . body . emailApprovalList ;
448+ expect ( list ) . to . include ( emailApprovalList ) ;
449+ } ) ;
429450 } ) ;
430451 } ) ;
431452
@@ -454,9 +475,11 @@ describe('To Validate & get list of signatures of ClaGroups via API call', funct
454475 } ) ;
455476
456477 it ( 'Add GithubOrg as Approval List to the Project/Company' , function ( ) {
478+ let url = `${ claEndpoint } signatures/project/${ projectSFID } /company/${ companyID } /clagroup/${ claGroupID } /approval-list` ;
479+ cy . task ( 'log' , 'Add GithubOrg as Approval List to the Project/Company URL: ' + url ) ;
457480 cy . request ( {
458481 method : 'PUT' ,
459- url : ` ${ claEndpoint } signatures/project/ ${ projectSFID } /company/ ${ companyID } /clagroup/ ${ claGroupID } /approval-list` ,
482+ url : url ,
460483 timeout : 180000 ,
461484 failOnStatusCode : allowFail ,
462485 headers : getXACLHeader ( ) ,
@@ -467,9 +490,11 @@ describe('To Validate & get list of signatures of ClaGroups via API call', funct
467490 AddGithubOrgApprovalList : [ gitOrgApprovalList ] ,
468491 } ,
469492 } ) . then ( ( response ) => {
470- validate_200_Status ( response ) ;
471- let list = response . body . githubOrgApprovalList ;
472- expect ( list [ 0 ] ) . to . eql ( gitOrgApprovalList ) ;
493+ return cy . logJson ( 'response' , response ) . then ( ( ) => {
494+ validate_200_Status ( response ) ;
495+ let list = response . body . githubOrgApprovalList ;
496+ expect ( list ) . to . include ( gitOrgApprovalList ) ;
497+ } ) ;
473498 } ) ;
474499 } ) ;
475500
@@ -774,29 +799,34 @@ describe('To Validate & get list of signatures of ClaGroups via API call', funct
774799 //Invalidates a given ICLA record for a user
775800 //worked only ine time, So skiping this test case, Refer screenshot: https://prnt.sc/ti6ERw8XZur0
776801
777- it ( 'Invalidates a given ICLA record for a user' , function ( ) {
802+ // LG:skip
803+ it . skip ( 'Invalidates a given ICLA record for a user' , function ( ) {
778804 let user_id = '23121f2a-d48b-11ed-b70f-d2f23b35d89e' ;
805+ let url = `${ claEndpoint } cla-group/${ claGroupID } /user/${ user_id } /icla` ;
806+ cy . task ( 'log' , 'Invalidates a given ICLA record for a user URL: ' + url ) ;
779807 cy . request ( {
780808 method : 'PUT' ,
781- url : ` ${ claEndpoint } cla-group/ ${ claGroupID } /user/ ${ user_id } /icla` ,
809+ url : url ,
782810 timeout : 180000 ,
783811 failOnStatusCode : allowFail ,
784812 headers : getXACLHeader ( ) ,
785813 auth : {
786814 bearer : bearerToken ,
787815 } ,
788816 } ) . then ( ( response ) => {
789- if ( response . status === 500 ) {
790- Cypress . on ( 'test:after:run' , ( test , runnable ) => {
791- const testName = `${ test . title } ` ;
792- const jsonResponse = JSON . stringify ( response . body , null , 2 ) ;
793- cy . log ( jsonResponse ) ;
794- console . log ( testName ) ;
795- console . error ( 'User_id not available for invalidate : ' , jsonResponse ) ;
796- } ) ;
797- } else {
798- validate_200_Status ( response ) ;
799- }
817+ return cy . logJson ( 'response' , response ) . then ( ( ) => {
818+ if ( response . status === 500 ) {
819+ Cypress . on ( 'test:after:run' , ( test , runnable ) => {
820+ const testName = `${ test . title } ` ;
821+ const jsonResponse = JSON . stringify ( response . body , null , 2 ) ;
822+ cy . log ( jsonResponse ) ;
823+ console . log ( testName ) ;
824+ console . error ( 'User_id not available for invalidate : ' , jsonResponse ) ;
825+ } ) ;
826+ } else {
827+ validate_200_Status ( response ) ;
828+ }
829+ } ) ;
800830 } ) ;
801831 } ) ;
802832} ) ;
0 commit comments