Skip to content

Commit d079e2e

Browse files
committed
e2e/feature/RI-6226_change_sorting_for_ft
1 parent 1f5c53f commit d079e2e

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

tests/e2e/pageObjects/components/monaco-editor.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class MonacoEditor {
2323
async sendTextToMonaco(input: Selector, command: string, clean = true): Promise<void> {
2424

2525
await t.click(input);
26-
if(clean) {
26+
if (clean) {
2727
await t
2828
// remove text since replace doesn't work here
2929
.pressKey('ctrl+a')
@@ -39,10 +39,10 @@ export class MonacoEditor {
3939
* @param depth level of depth of the object
4040
*/
4141
async insertTextByLines(input: Selector, lines: string[], depth: number): Promise<void> {
42-
for(let i = 0; i < lines.length; i++) {
42+
for (let i = 0; i < lines.length; i++) {
4343
const line = lines[i];
4444

45-
for(let j = 0; j < depth; j++) {
45+
for (let j = 0; j < depth; j++) {
4646
await t.pressKey('shift+tab');
4747
}
4848

@@ -61,4 +61,22 @@ export class MonacoEditor {
6161
const textAreaMonaco = Selector('[class^=view-lines ]');
6262
return (await textAreaMonaco.textContent).replace(/\s+/g, ' ');
6363
}
64+
65+
/**
66+
* Get suggestions as ordered array from monaco from the beginning
67+
* @param suggestions number of elements to get
68+
*/
69+
async getSuggestionsArrayFromMonaco(suggestions: number): Promise<string[]> {
70+
const textArray: string[] = [];
71+
const suggestionElements = this.monacoSuggestion;
72+
73+
for (let i = 0; i < suggestions; i++) {
74+
const suggestionItem = suggestionElements.nth(i);
75+
if (await suggestionItem.exists) {
76+
textArray.push(await suggestionItem.textContent);
77+
}
78+
}
79+
80+
return textArray;
81+
}
6482
}

tests/e2e/tests/web/regression/search-and-query/no-indexes-suggestions.e2e.ts renamed to tests/e2e/tests/web/critical-path/workbench/no-indexes-suggestions.e2e.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { DatabaseHelper } from '../../../../helpers/database';
22
import { BrowserPage, WorkbenchPage } from '../../../../pageObjects';
33
import { rte } from '../../../../helpers/constants';
4-
import { commonUrl, ossClusterConfig, ossStandaloneConfig, ossStandaloneRedisearch } from '../../../../helpers/conf';
4+
import { commonUrl, ossClusterConfig } from '../../../../helpers/conf';
55
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
66

77
const browserPage = new BrowserPage();
@@ -14,11 +14,11 @@ fixture `Search and Query Raw mode`
1414
.page(commonUrl);
1515

1616
test
17-
.before(async t => {
17+
.before(async () => {
1818
await databaseHelper.acceptLicenseTermsAndAddOSSClusterDatabase(ossClusterConfig);
1919
await browserPage.Cli.sendCommandInCli('flushdb');
2020
})
21-
.after(async t => {
21+
.after(async () => {
2222
await databaseAPIRequests.deleteOSSClusterDatabaseApi(ossClusterConfig);
2323

2424
})('Verify suggestions when there are no indexes', async t => {

tests/e2e/tests/web/regression/search-and-query/search-and-query-tab.e2e.ts renamed to tests/e2e/tests/web/critical-path/workbench/search-and-query-autocomplete.e2e.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let indexName2: string;
1818
let indexName3: string;
1919

2020
fixture `Autocomplete for entered commands in search and query`
21-
.meta({ type: 'regression', rte: rte.standalone })
21+
.meta({ type: 'critical_path', rte: rte.standalone })
2222
.page(commonUrl)
2323
.beforeEach(async t => {
2424
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig);
@@ -84,8 +84,12 @@ test('Verify full commands suggestions with index and query for FT.AGGREGATE', a
8484
'students',
8585
'type'
8686
];
87+
const ftSortedCommands = ['FT.SEARCH', 'FT.CREATE', 'FT.EXPLAIN', 'FT.PROFILE'];
88+
8789
// Verify basic commands suggestions FT.SEARCH and FT.AGGREGATE
8890
await t.typeText(workbenchPage.queryInput, 'FT', { replace: true });
91+
// Verify custom sorting for FT. commands
92+
await t.expect(await workbenchPage.MonacoEditor.getSuggestionsArrayFromMonaco(4)).eql(ftSortedCommands, 'Wrong order of FT commands');
8993
// Verify that the list with FT.SEARCH and FT.AGGREGATE auto-suggestions is displayed
9094
await t.expect(workbenchPage.MonacoEditor.monacoSuggestion.withText('FT._LIST').exists).ok('FT._LIST auto-suggestions are not displayed');
9195
await t.expect(workbenchPage.MonacoEditor.monacoSuggestion.withText('FT.AGGREGATE').exists).ok('FT.AGGREGATE auto-suggestions are not displayed');

0 commit comments

Comments
 (0)