1
1
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database' ;
2
- import { BrowserPage , CliPage } from '../../../pageObjects' ;
2
+ import { BrowserPage , CliPage , MyRedisDatabasePage } from '../../../pageObjects' ;
3
3
import {
4
4
commonUrl ,
5
5
ossStandaloneBigConfig ,
@@ -14,6 +14,7 @@ import { verifyKeysDisplayedInTheList } from '../../../helpers/keys';
14
14
const browserPage = new BrowserPage ( ) ;
15
15
const common = new Common ( ) ;
16
16
const cliPage = new CliPage ( ) ;
17
+ const myRedisDatabasePage = new MyRedisDatabasePage ( ) ;
17
18
18
19
const patternModeTooltipText = 'Filter by Key Name or Pattern' ;
19
20
const redisearchModeTooltipText = 'Search by Values of Keys' ;
45
46
`HSET ${ keyNames [ 2 ] } "name" "Gillford School" "description" "Gillford School is a centre" "class" "private" "type" "democratic; waldorf" "address_city" "Goudhurst" "address_street" "Goudhurst" "students" 721 "location" "51.112685, 0.451076"` ,
46
47
`FT.CREATE ${ indexName } ON HASH PREFIX 1 "${ keyName } :" SCHEMA name TEXT NOSTEM description TEXT class TAG type TAG SEPARATOR ";" address_city AS city TAG address_street AS address TEXT NOSTEM students NUMERIC SORTABLE location GEO`
47
48
] ;
49
+ const searchPerValue = '(@name:"Hall School") | (@students:[500, 1000])' ;
48
50
49
51
// Create 3 keys and index
50
52
await cliPage . sendCommandsInCli ( commands ) ;
68
70
await t . expect ( await browserPage . isKeyIsDisplayedInTheList ( keyNames [ 0 ] ) ) . ok ( `The key ${ keyNames [ 0 ] } not found` ) ;
69
71
await t . expect ( await browserPage . isKeyIsDisplayedInTheList ( keyNames [ 1 ] ) ) . notOk ( `Invalid key ${ keyNames [ 1 ] } is displayed after search` ) ;
70
72
// Verify that user can search by index plus multiple key values
71
- await browserPage . searchByKeyName ( '(@name:"Hall School") | (@students:[500, 1000])' ) ;
73
+ await browserPage . searchByKeyName ( searchPerValue ) ;
72
74
await t . expect ( await browserPage . isKeyIsDisplayedInTheList ( keyNames [ 0 ] ) ) . ok ( `The first valid key ${ keyNames [ 0 ] } not found` ) ;
73
75
await t . expect ( await browserPage . isKeyIsDisplayedInTheList ( keyNames [ 2 ] ) ) . ok ( `The second valid key ${ keyNames [ 2 ] } not found` ) ;
74
76
await t . expect ( await browserPage . isKeyIsDisplayedInTheList ( keyNames [ 1 ] ) ) . notOk ( `Invalid key ${ keyNames [ 1 ] } is displayed after search` ) ;
75
77
78
+ // Verify that Redisearch context (inputs, key selected, scroll, key details) saved after switching between pages
79
+ await t
80
+ . click ( myRedisDatabasePage . workbenchButton )
81
+ . click ( myRedisDatabasePage . browserButton )
82
+ . expect ( browserPage . selectIndexDdn . withText ( indexName ) . exists ) . ok ( 'Index selection not saved' )
83
+ . expect ( browserPage . filterByPatterSearchInput . value ) . eql ( searchPerValue , 'Search per Value not saved in input' ) ;
84
+
85
+ // Verify that Redisearch context saved when switching between browser/tree view
86
+ await t
87
+ . click ( browserPage . treeViewButton )
88
+ . expect ( browserPage . selectIndexDdn . withText ( indexName ) . exists ) . ok ( 'Index selection not saved' )
89
+ . expect ( browserPage . filterByPatterSearchInput . value ) . eql ( searchPerValue , 'Search per Value not saved in input' ) ;
90
+ await t
91
+ . click ( browserPage . browserViewButton )
92
+ . expect ( browserPage . selectIndexDdn . withText ( indexName ) . exists ) . ok ( 'Index selection not saved' )
93
+ . expect ( browserPage . filterByPatterSearchInput . value ) . eql ( searchPerValue , 'Search per Value not saved in input' ) ;
94
+
76
95
// Verify that user can clear the search
77
96
await t . click ( browserPage . clearFilterButton ) ;
78
97
await t . expect ( await browserPage . isKeyIsDisplayedInTheList ( keyNames [ 1 ] ) ) . ok ( `The key ${ keyNames [ 1 ] } not found` ) ;
86
105
await verifyKeysDisplayedInTheList ( keyNames ) ;
87
106
await t . expect ( await browserPage . isKeyIsDisplayedInTheList ( keyName ) ) . notOk ( 'Key without index displayed after search' ) ;
88
107
108
+ // Verify that Search control opened after reloading page
109
+ await common . reloadPage ( ) ;
110
+ await t . expect ( browserPage . keyListTable . textContent ) . contains ( notSelectedIndexText , 'Search by Values of Keys section not opened' ) ;
111
+
89
112
// Verify that user see the database scanned when he switch to Pattern search mode
90
113
await t . click ( browserPage . patternModeBtn ) ;
91
114
await t . click ( browserPage . browserViewButton ) ;
0 commit comments