1- import { validateApiResponse , validate_200_Status , getTokenKey } from '../support/commands' ;
1+ import { validateApiResponse , validate_200_Status , validate_404_Status , getTokenKey } from '../support/commands' ;
22
33describe ( "To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on child project" , function ( ) {
44 // Define a variable for the environment
@@ -34,6 +34,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
3434 //Enroll /unEnroll projects
3535 const enrollProjectsSFID = appConfig . enrollProjectsSFID ; //project name: easyAutomChild1-GrandChild1
3636 const child_Project_name = appConfig . child_Project_name ;
37+ let allowFail : boolean = ! ( Cypress . env ( 'ALLOW_FAIL' ) === 1 ) ;
3738
3839 let bearerToken : string = null ;
3940 before ( ( ) => {
@@ -49,11 +50,11 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
4950 cy . request ( {
5051 method : 'POST' ,
5152 url : `${ claEndpoint } /cla-group` ,
53+ failOnStatusCode : allowFail ,
5254
5355 auth : {
5456 bearer : bearerToken ,
5557 } ,
56- failOnStatusCode : false ,
5758 body : {
5859 icla_enabled : true ,
5960 ccla_enabled : true ,
@@ -106,6 +107,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
106107 cy . request ( {
107108 method : 'GET' ,
108109 url : `${ claEndpoint } /foundation/${ projectSfid } /cla-groups` ,
110+ failOnStatusCode : allowFail ,
109111
110112 auth : {
111113 bearer : bearerToken ,
@@ -125,10 +127,26 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
125127 } ) ;
126128 } ) ;
127129
130+ it ( 'Attempt to get list of cla group associated with project given by wrong SFID - Record should Return 404 Response' , function ( ) {
131+ cy . request ( {
132+ method : 'GET' ,
133+ url : `${ claEndpoint } /foundation/${ projectSfid } -xyz/cla-groups` ,
134+ failOnStatusCode : allowFail ,
135+ auth : {
136+ bearer : bearerToken ,
137+ } ,
138+ } ) . then ( ( response ) => {
139+ // LG:chain log before async status check
140+ // return cy.logJson('404 response', response).then(() => validate_404_Status(response));
141+ validate_404_Status ( response ) ;
142+ } ) ;
143+ } ) ;
144+
128145 it ( 'Updates a CLA Group details - Record should Returns 200 Response' , function ( ) {
129146 cy . request ( {
130147 method : 'PUT' ,
131148 url : `${ claEndpoint } /cla-group/${ claGroupId } ` ,
149+ failOnStatusCode : allowFail ,
132150
133151 auth : {
134152 bearer : bearerToken ,
@@ -154,6 +172,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
154172 cy . request ( {
155173 method : 'PUT' ,
156174 url : `${ claEndpoint } /cla-group/${ claGroupId } /enroll-projects` ,
175+ failOnStatusCode : allowFail ,
157176
158177 auth : {
159178 bearer : bearerToken ,
@@ -168,6 +187,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
168187 cy . request ( {
169188 method : 'GET' ,
170189 url : `${ claEndpoint } /foundation/${ projectSfid } /cla-groups` ,
190+ failOnStatusCode : allowFail ,
171191
172192 auth : {
173193 bearer : bearerToken ,
@@ -186,10 +206,11 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
186206 } ) ;
187207 } ) ;
188208
189- it ( 'unenroll projects in a CLA Group - Record should Returns 200 Response' , function ( ) {
209+ it ( 'Unenroll projects in a CLA Group - Record should Returns 200 Response' , function ( ) {
190210 cy . request ( {
191211 method : 'PUT' ,
192212 url : `${ claEndpoint } /cla-group/${ claGroupId } /unenroll-projects` ,
213+ failOnStatusCode : allowFail ,
193214
194215 auth : {
195216 bearer : bearerToken ,
@@ -205,6 +226,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
205226 cy . request ( {
206227 method : 'GET' ,
207228 url : `${ claEndpoint } /project/${ projectSfidOrg } /github/organizations` ,
229+ failOnStatusCode : allowFail ,
208230
209231 auth : {
210232 bearer : bearerToken ,
@@ -215,15 +237,19 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
215237 // Validate specific data in the response
216238 expect ( response . body ) . to . have . property ( 'list' ) ;
217239 let list = response . body . list ;
218- expect ( list [ 2 ] . github_organization_name ) . to . eql ( 'Sun-lfxfoundationOrgTest' ) ;
219- expect ( list [ 2 ] . connection_status ) . to . eql ( 'partial_connection' ) ;
240+ // LG:
241+ // expect(list[2].github_organization_name).to.eql('Sun-lfxfoundationOrgTest');
242+ // expect(list[2].connection_status).to.eql('partial_connection');
243+ expect ( list [ 2 ] . github_organization_name ) . to . eql ( 'lukaszgryglicki-org' ) ;
244+ expect ( list [ 2 ] . connection_status ) . to . eql ( 'connected' ) ;
220245 } ) ;
221246 } ) ;
222247
223248 it ( 'Update GitHub Organization Configuration - Record should Returns 200 Response' , function ( ) {
224249 cy . request ( {
225250 method : 'PUT' ,
226251 url : `${ claEndpoint } /project/${ projectSfidOrg } /github/organizations/${ gitHubOrgName } /config` ,
252+ failOnStatusCode : allowFail ,
227253
228254 auth : {
229255 bearer : bearerToken ,
@@ -243,6 +269,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
243269 cy . request ( {
244270 method : 'DELETE' ,
245271 url : `${ claEndpoint } /cla-group/${ claGroupId } ` ,
272+ failOnStatusCode : allowFail ,
246273
247274 auth : {
248275 bearer : bearerToken ,
@@ -255,6 +282,7 @@ describe("To Validate 'GET, CREATE, UPDATE and DELETE' CLA groups API call on ch
255282 cy . request ( {
256283 method : 'GET' ,
257284 url : `${ claEndpoint } /foundation/${ projectSfid } /cla-groups` ,
285+ failOnStatusCode : allowFail ,
258286
259287 auth : {
260288 bearer : bearerToken ,
0 commit comments