Skip to content

Commit a74c4ce

Browse files
committed
add tests for redisearch context
1 parent 1c4510b commit a74c4ce

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

tests/e2e/tests/critical-path/browser/search-capabilities.e2e.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
2-
import { BrowserPage, CliPage } from '../../../pageObjects';
2+
import { BrowserPage, CliPage, MyRedisDatabasePage } from '../../../pageObjects';
33
import {
44
commonUrl,
55
ossStandaloneBigConfig,
@@ -14,6 +14,7 @@ import { verifyKeysDisplayedInTheList } from '../../../helpers/keys';
1414
const browserPage = new BrowserPage();
1515
const common = new Common();
1616
const cliPage = new CliPage();
17+
const myRedisDatabasePage = new MyRedisDatabasePage();
1718

1819
const patternModeTooltipText = 'Filter by Key Name or Pattern';
1920
const redisearchModeTooltipText = 'Search by Values of Keys';
@@ -45,6 +46,7 @@ test
4546
`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"`,
4647
`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`
4748
];
49+
const searchPerValue = '(@name:"Hall School") | (@students:[500, 1000])';
4850

4951
// Create 3 keys and index
5052
await cliPage.sendCommandsInCli(commands);
@@ -68,11 +70,28 @@ test
6870
await t.expect(await browserPage.isKeyIsDisplayedInTheList(keyNames[0])).ok(`The key ${keyNames[0]} not found`);
6971
await t.expect(await browserPage.isKeyIsDisplayedInTheList(keyNames[1])).notOk(`Invalid key ${keyNames[1]} is displayed after search`);
7072
// 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);
7274
await t.expect(await browserPage.isKeyIsDisplayedInTheList(keyNames[0])).ok(`The first valid key ${keyNames[0]} not found`);
7375
await t.expect(await browserPage.isKeyIsDisplayedInTheList(keyNames[2])).ok(`The second valid key ${keyNames[2]} not found`);
7476
await t.expect(await browserPage.isKeyIsDisplayedInTheList(keyNames[1])).notOk(`Invalid key ${keyNames[1]} is displayed after search`);
7577

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+
7695
// Verify that user can clear the search
7796
await t.click(browserPage.clearFilterButton);
7897
await t.expect(await browserPage.isKeyIsDisplayedInTheList(keyNames[1])).ok(`The key ${keyNames[1]} not found`);
@@ -86,6 +105,10 @@ test
86105
await verifyKeysDisplayedInTheList(keyNames);
87106
await t.expect(await browserPage.isKeyIsDisplayedInTheList(keyName)).notOk('Key without index displayed after search');
88107

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+
89112
// Verify that user see the database scanned when he switch to Pattern search mode
90113
await t.click(browserPage.patternModeBtn);
91114
await t.click(browserPage.browserViewButton);

0 commit comments

Comments
 (0)