1- /*
2- * Comprehensive test suite for all CLA Manager APIs in V3 (tagged with 'cla-manager' in swagger)
3- *
4- * Covers all HTTP methods for CLA Manager endpoints:
5- * - POST /company/{companyID}/project/{projectID}/cla-manager (authenticated)
6- * - DELETE /company/{companyID}/project/{projectID}/cla-manager/{userLFID} (authenticated)
7- * - GET /company/{companyID}/project/{projectID}/cla-manager/requests (authenticated)
8- * - POST /company/{companyID}/project/{projectID}/cla-manager/requests (authenticated)
9- * - GET /company/{companyID}/project/{projectID}/cla-manager/requests/{requestID} (authenticated)
10- * - DELETE /company/{companyID}/project/{projectID}/cla-manager/requests/{requestID} (authenticated)
11- * - PUT /company/{companyID}/project/{projectID}/cla-manager/requests/{requestID}/approve (authenticated)
12- * - PUT /company/{companyID}/project/{projectID}/cla-manager/requests/{requestID}/deny (authenticated)
13- *
14- * Includes comprehensive negative testing:
15- * - 401 Unauthorized tests for all endpoints
16- * - 4xx validation error tests for malformed parameters
17- * - Invalid UUID and parameter format tests
18- *
19- * Uses flexible status code assertions to handle various valid API responses
20- * All responses are logged via cy.logJson() for debugging purposes
21- */
1+ // Copyright The Linux Foundation and each contributor to LFX.
2+ // SPDX-License-Identifier: MIT
3+
224import {
235 validate_200_Status ,
246 validate_204_Status ,
@@ -129,11 +111,11 @@ describe('To Validate & test CLA Manager APIs via API call (V3)', function () {
129111 // POSITIVE TEST CASES - EXPECT ONLY 2xx STATUS CODES
130112 // ============================================================================
131113
132- it . skip ( 'GET /company/{companyID}/project/{projectID}/cla-manager/requests - Get CLA Manager Requests (consistent connection issues)' , function ( ) {
114+ it . skip ( 'GET /company/{companyID}/project/{projectID}/cla-manager/requests - Get CLA Manager Requests (connection issues)' , function ( ) {
133115 cy . request ( {
134116 method : 'GET' ,
135117 url : `${ claEndpoint } company/${ validCompanyID } /project/${ validProjectID } /cla-manager/requests` ,
136- timeout : 60000 , // Shorter timeout to detect connection issues faster
118+ timeout : 30000 , // Shorter timeout for problematic endpoints
137119 failOnStatusCode : false ,
138120 headers : getXACLHeaders ( ) ,
139121 auth : {
@@ -143,11 +125,7 @@ describe('To Validate & test CLA Manager APIs via API call (V3)', function () {
143125 return cy . logJson ( 'GET CLA manager requests response' , response ) . then ( ( ) => {
144126 cy . task ( 'log' , `CLA manager requests status: ${ response . status } ` ) ;
145127
146- if ( response . status >= 500 ) {
147- // If consistently returns 5xx, skip the test
148- cy . task ( 'log' , 'Skipping due to consistent 5xx server errors - API may not be implemented' ) ;
149- this . skip ( ) ;
150- } else if ( response . status >= 200 && response . status <= 299 ) {
128+ if ( response . status >= 200 && response . status <= 299 ) {
151129 validate_expected_status ( response , 200 ) ;
152130 expect ( response . body ) . to . be . an ( 'object' ) ;
153131
@@ -157,7 +135,7 @@ describe('To Validate & test CLA Manager APIs via API call (V3)', function () {
157135
158136 validateApiResponse ( 'cla-manager/getClaManagerRequests.json' , response ) ;
159137 } else {
160- // Expect 4xx errors for access denied, not found, etc
138+ // Expect 4xx errors for access denied, not found, etc - Never 5xx
161139 expect ( response . status ) . to . be . within ( 400 , 499 ) ;
162140 validate_expected_status ( response , response . status ) ;
163141 }
@@ -241,13 +219,13 @@ describe('To Validate & test CLA Manager APIs via API call (V3)', function () {
241219 } ) ;
242220 } ) ;
243221
244- it . skip ( 'PUT /company/{companyID}/project/{projectID}/cla-manager/requests/{requestID}/approve - Approve Request (consistent connection issues)' , function ( ) {
222+ it . skip ( 'PUT /company/{companyID}/project/{projectID}/cla-manager/requests/{requestID}/approve - Approve Request (connection issues)' , function ( ) {
245223 const testRequestID = createdRequestID || 'd9428888-122b-4b20-8c4a-0c9a1a6f9b8e' ; // Use created or dummy ID
246224
247225 cy . request ( {
248226 method : 'PUT' ,
249227 url : `${ claEndpoint } company/${ validCompanyID } /project/${ validProjectID } /cla-manager/requests/${ testRequestID } /approve` ,
250- timeout : 60000 , // Shorter timeout to detect connection issues faster
228+ timeout : 30000 , // Shorter timeout for problematic endpoints
251229 failOnStatusCode : false ,
252230 headers : getXACLHeaders ( ) ,
253231 auth : {
@@ -257,30 +235,26 @@ describe('To Validate & test CLA Manager APIs via API call (V3)', function () {
257235 return cy . logJson ( 'PUT approve CLA manager request response' , response ) . then ( ( ) => {
258236 cy . task ( 'log' , `Approve CLA manager request status: ${ response . status } ` ) ;
259237
260- if ( response . status >= 500 ) {
261- // If consistently returns 5xx, skip the test
262- cy . task ( 'log' , 'Skipping due to consistent 5xx server errors - API may not be implemented' ) ;
263- this . skip ( ) ;
264- } else if ( response . status >= 200 && response . status <= 299 ) {
238+ if ( response . status >= 200 && response . status <= 299 ) {
265239 validate_expected_status ( response , 200 ) ;
266240 expect ( response . body ) . to . be . an ( 'object' ) ;
267241 validateApiResponse ( 'cla-manager/getClaManagerRequest.json' , response ) ;
268242 } else {
269- // Expect 4xx errors if request doesn't exist or permission issues
243+ // Expect 4xx errors if request doesn't exist or permission issues - Never 5xx
270244 expect ( response . status ) . to . be . within ( 400 , 499 ) ;
271245 validate_expected_status ( response , response . status ) ;
272246 }
273247 } ) ;
274248 } ) ;
275249 } ) ;
276250
277- it . skip ( 'PUT /company/{companyID}/project/{projectID}/cla-manager/requests/{requestID}/deny - Deny Request (consistent connection issues)' , function ( ) {
251+ it . skip ( 'PUT /company/{companyID}/project/{projectID}/cla-manager/requests/{requestID}/deny - Deny Request (connection issues)' , function ( ) {
278252 const testRequestID = createdRequestID || 'd9428888-122b-4b20-8c4a-0c9a1a6f9b8e' ; // Use created or dummy ID
279253
280254 cy . request ( {
281255 method : 'PUT' ,
282256 url : `${ claEndpoint } company/${ validCompanyID } /project/${ validProjectID } /cla-manager/requests/${ testRequestID } /deny` ,
283- timeout : 60000 , // Shorter timeout to detect connection issues faster
257+ timeout : 30000 , // Shorter timeout for problematic endpoints
284258 failOnStatusCode : false ,
285259 headers : getXACLHeaders ( ) ,
286260 auth : {
@@ -290,16 +264,12 @@ describe('To Validate & test CLA Manager APIs via API call (V3)', function () {
290264 return cy . logJson ( 'PUT deny CLA manager request response' , response ) . then ( ( ) => {
291265 cy . task ( 'log' , `Deny CLA manager request status: ${ response . status } ` ) ;
292266
293- if ( response . status >= 500 ) {
294- // If consistently returns 5xx, skip the test
295- cy . task ( 'log' , 'Skipping due to consistent 5xx server errors - API may not be implemented' ) ;
296- this . skip ( ) ;
297- } else if ( response . status >= 200 && response . status <= 299 ) {
267+ if ( response . status >= 200 && response . status <= 299 ) {
298268 validate_expected_status ( response , 200 ) ;
299269 expect ( response . body ) . to . be . an ( 'object' ) ;
300270 validateApiResponse ( 'cla-manager/getClaManagerRequest.json' , response ) ;
301271 } else {
302- // Expect 4xx errors if request doesn't exist or permission issues
272+ // Expect 4xx errors if request doesn't exist or permission issues - Never 5xx
303273 expect ( response . status ) . to . be . within ( 400 , 499 ) ;
304274 validate_expected_status ( response , response . status ) ;
305275 }
0 commit comments