@@ -3369,3 +3369,95 @@ Cypress.Commands.add("incrementalAuth", (globalState, data) => {
3369
3369
}
3370
3370
} ) ;
3371
3371
} ) ;
3372
+
3373
+ Cypress . Commands . add ( "createConfigs" , ( globalState , key , value ) => {
3374
+ const base_url = globalState . get ( "baseUrl" ) ;
3375
+ const api_key = globalState . get ( "adminApiKey" ) ;
3376
+
3377
+ cy . request ( {
3378
+ method : "POST" ,
3379
+ url : `${ base_url } /configs/` ,
3380
+ headers : {
3381
+ "Content-Type" : "application/json" ,
3382
+ "api-key" : api_key ,
3383
+ } ,
3384
+ body : {
3385
+ key : key ,
3386
+ value : value ,
3387
+ } ,
3388
+ failOnStatusCode : false ,
3389
+ } ) . then ( ( response ) => {
3390
+ logRequestId ( response . headers [ "x-request-id" ] ) ;
3391
+
3392
+ expect ( response . status ) . to . equal ( 200 ) ;
3393
+ expect ( response . body ) . to . have . property ( "key" ) . to . equal ( key ) ;
3394
+ expect ( response . body ) . to . have . property ( "value" ) . to . equal ( value ) ;
3395
+ } ) ;
3396
+ } ) ;
3397
+
3398
+ Cypress . Commands . add ( "fetchConfigs" , ( globalState , key , value ) => {
3399
+ const base_url = globalState . get ( "baseUrl" ) ;
3400
+ const api_key = globalState . get ( "adminApiKey" ) ;
3401
+
3402
+ cy . request ( {
3403
+ method : "GET" ,
3404
+ url : `${ base_url } /configs/${ key } ` ,
3405
+ headers : {
3406
+ "Content-Type" : "application/json" ,
3407
+ "api-key" : api_key ,
3408
+ } ,
3409
+ failOnStatusCode : false ,
3410
+ } ) . then ( ( response ) => {
3411
+ logRequestId ( response . headers [ "x-request-id" ] ) ;
3412
+
3413
+ expect ( response . status ) . to . equal ( 200 ) ;
3414
+ expect ( response . body ) . to . have . property ( "key" ) . to . equal ( key ) ;
3415
+ expect ( response . body ) . to . have . property ( "value" ) . to . equal ( value ) ;
3416
+ } ) ;
3417
+ } ) ;
3418
+
3419
+ Cypress . Commands . add ( "updateConfigs" , ( globalState , key , value ) => {
3420
+ const base_url = globalState . get ( "baseUrl" ) ;
3421
+ const api_key = globalState . get ( "adminApiKey" ) ;
3422
+
3423
+ cy . request ( {
3424
+ method : "POST" ,
3425
+ url : `${ base_url } /configs/${ key } ` ,
3426
+ headers : {
3427
+ "Content-Type" : "application/json" ,
3428
+ "api-key" : api_key ,
3429
+ } ,
3430
+ body : {
3431
+ key : key ,
3432
+ value : value ,
3433
+ } ,
3434
+ failOnStatusCode : false ,
3435
+ } ) . then ( ( response ) => {
3436
+ logRequestId ( response . headers [ "x-request-id" ] ) ;
3437
+
3438
+ expect ( response . status ) . to . equal ( 200 ) ;
3439
+ expect ( response . body ) . to . have . property ( "key" ) . to . equal ( key ) ;
3440
+ expect ( response . body ) . to . have . property ( "value" ) . to . equal ( value ) ;
3441
+ } ) ;
3442
+ } ) ;
3443
+
3444
+ Cypress . Commands . add ( "deleteConfigs" , ( globalState , key , value ) => {
3445
+ const base_url = globalState . get ( "baseUrl" ) ;
3446
+ const api_key = globalState . get ( "adminApiKey" ) ;
3447
+
3448
+ cy . request ( {
3449
+ method : "DELETE" ,
3450
+ url : `${ base_url } /configs/${ key } ` ,
3451
+ headers : {
3452
+ "Content-Type" : "application/json" ,
3453
+ "api-key" : api_key ,
3454
+ } ,
3455
+ failOnStatusCode : false ,
3456
+ } ) . then ( ( response ) => {
3457
+ logRequestId ( response . headers [ "x-request-id" ] ) ;
3458
+
3459
+ expect ( response . status ) . to . equal ( 200 ) ;
3460
+ expect ( response . body ) . to . have . property ( "key" ) . to . equal ( key ) ;
3461
+ expect ( response . body ) . to . have . property ( "value" ) . to . equal ( value ) ;
3462
+ } ) ;
3463
+ } ) ;
0 commit comments