@@ -94,6 +94,7 @@ export class BrowserPage extends InstancePage {
94
94
saveButton = Selector ( '[data-testid=save-btn]' ) ;
95
95
bulkActionsButton = Selector ( '[data-testid=btn-bulk-actions]' ) ;
96
96
editHashButton = Selector ( '[data-testid^=hash_edit-btn-]' ) ;
97
+ editHashFieldTtlButton = Selector ( '[data-testid^=hash-ttl_edit-btn-]' , { timeout : 500 } ) ;
97
98
editZsetButton = Selector ( '[data-testid^=zset_edit-btn-]' ) ;
98
99
editListButton = Selector ( '[data-testid^=list_edit-btn-]' ) ;
99
100
cancelStreamGroupBtn = Selector ( '[data-testid=cancel-stream-groups-btn]' ) ;
@@ -161,6 +162,7 @@ export class BrowserPage extends InstancePage {
161
162
hashFieldValueInput = Selector ( '[data-testid=field-value]' ) ;
162
163
hashFieldNameInput = Selector ( '[data-testid=field-name]' ) ;
163
164
hashFieldValueEditor = Selector ( '[data-testid^=hash_value-editor]' ) ;
165
+ hashTtlFieldInput = Selector ( '[data-testid=hash-ttl]' ) ;
164
166
listKeyElementInput = Selector ( '[data-testid=element]' ) ;
165
167
listKeyElementEditorInput = Selector ( '[data-testid^=list_value-editor-]' ) ;
166
168
stringKeyValueInput = Selector ( '[data-testid=string-value]' ) ;
@@ -265,6 +267,10 @@ export class BrowserPage extends InstancePage {
265
267
noReadySearchDialogTitle = Selector ( '[data-testid=welcome-page-title]' ) ;
266
268
closeDialogButton = Selector ( '[class*=euiModal__closeIcon]' ) ;
267
269
270
+ //Get Hash key field ttl value
271
+ //for Redis databases 7.4 and higher
272
+ getHashTtlFieldInput = ( fieldName : string ) : Selector => ( Selector ( `[data-testid=hash-ttl_content-value-${ fieldName } ]` ) ) ;
273
+
268
274
/**
269
275
* Common part for Add any new key
270
276
* @param keyName The name of the key
@@ -399,8 +405,9 @@ export class BrowserPage extends InstancePage {
399
405
* @param TTL The Time to live value of the key
400
406
* @param field The field name of the key
401
407
* @param value The value of the key
408
+ * @param ttl The ttl of the field for Redis databases 7.4 and higher
402
409
*/
403
- async addHashKey ( keyName : string , TTL = ' ' , field = ' ' , value = ' ' ) : Promise < void > {
410
+ async addHashKey ( keyName : string , TTL = ' ' , field = ' ' , value = ' ' , ttl = '' ) : Promise < void > {
404
411
if ( await this . Toast . toastCloseButton . exists ) {
405
412
await t . click ( this . Toast . toastCloseButton ) ;
406
413
}
@@ -415,6 +422,9 @@ export class BrowserPage extends InstancePage {
415
422
await t . typeText ( this . keyTTLInput , TTL , { replace : true , paste : true } ) ;
416
423
await t . typeText ( this . hashFieldNameInput , field , { replace : true , paste : true } ) ;
417
424
await t . typeText ( this . hashFieldValueInput , value , { replace : true , paste : true } ) ;
425
+ if ( ttl !== '' ) {
426
+ await t . typeText ( this . hashTtlFieldInput , ttl , { replace : true , paste : true } ) ;
427
+ }
418
428
await t . click ( this . addKeyButton ) ;
419
429
}
420
430
@@ -634,14 +644,18 @@ export class BrowserPage extends InstancePage {
634
644
* Add field to hash key
635
645
* @param keyFieldValue The value of the hash field
636
646
* @param keyValue The hash value
647
+ * @param tll The hash field ttl value for Redis databases 7.4 and higher
637
648
*/
638
- async addFieldToHash ( keyFieldValue : string , keyValue : string ) : Promise < void > {
649
+ async addFieldToHash ( keyFieldValue : string , keyValue : string , ttl = '' ) : Promise < void > {
639
650
if ( await this . Toast . toastCloseButton . exists ) {
640
651
await t . click ( this . Toast . toastCloseButton ) ;
641
652
}
642
653
await t . click ( this . addKeyValueItemsButton ) ;
643
654
await t . typeText ( this . hashFieldInput , keyFieldValue , { replace : true , paste : true } ) ;
644
655
await t . typeText ( this . hashValueInput , keyValue , { replace : true , paste : true } ) ;
656
+ if ( ttl !== ' ' ) {
657
+ await t . typeText ( this . hashTtlFieldInput , ttl , { replace : true , paste : true } ) ;
658
+ }
645
659
await t . click ( this . saveHashFieldButton ) ;
646
660
}
647
661
@@ -657,6 +671,19 @@ export class BrowserPage extends InstancePage {
657
671
. click ( this . applyButton ) ;
658
672
}
659
673
674
+ /**
675
+ * Edit Hash field ttl value
676
+ * @param fieldName The field name
677
+ * @param tll The hash field ttl value for Redis databases 7.4 and higher
678
+ */
679
+ async editHashFieldTtlValue ( fieldName : string , ttl : string ) : Promise < void > {
680
+ await t
681
+ . hover ( this . getHashTtlFieldInput ( fieldName ) )
682
+ . click ( this . editHashFieldTtlButton )
683
+ . typeText ( this . inlineItemEditor , ttl , { replace : true , paste : true } )
684
+ . click ( this . applyButton ) ;
685
+ }
686
+
660
687
//Get Hash key value from details
661
688
async getHashKeyValue ( ) : Promise < string > {
662
689
return this . hashFieldValue . textContent ;
0 commit comments