Skip to content

Commit fec0f76

Browse files
authored
Merge pull request #1313 from RedisInsight/e2e/bugfix/error-on-ft-search
E2e/bugfix/error on ft search
2 parents a7c4178 + 0387e87 commit fec0f76

File tree

6 files changed

+174
-183
lines changed

6 files changed

+174
-183
lines changed

tests/e2e/tests/critical-path/workbench/command-results.e2e.ts

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { env, rte } from '../../../helpers/constants';
1+
import { rte } from '../../../helpers/constants';
22
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
33
import { MyRedisDatabasePage, WorkbenchPage } from '../../../pageObjects';
44
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
@@ -61,26 +61,25 @@ test('Verify that user can see the results found in the table view by default fo
6161
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssTableViewTypeOption).visible).ok(`The table view is not selected by default for command ${command}`);
6262
}
6363
});
64-
test
65-
.meta({ env: env.desktop })('Verify that user can switches between views and see results according to the view rules in Workbench in results', async t => {
66-
indexName = common.generateWord(5);
67-
const commands = [
68-
'hset doc:10 title "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud" url "redis.io" author "Test" rate "undefined" review "0" comment "Test comment"',
69-
`FT.CREATE ${indexName} ON HASH PREFIX 1 doc: SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT author TEXT rate TEXT review TEXT comment TEXT`,
70-
`FT.SEARCH ${indexName} * limit 0 10000`
71-
];
64+
test('Verify that user can switches between views and see results according to the view rules in Workbench in results', async t => {
65+
indexName = common.generateWord(5);
66+
const commands = [
67+
'hset doc:10 title "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud" url "redis.io" author "Test" rate "undefined" review "0" comment "Test comment"',
68+
`FT.CREATE ${indexName} ON HASH PREFIX 1 doc: SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT author TEXT rate TEXT review TEXT comment TEXT`,
69+
`FT.SEARCH ${indexName} * limit 0 10000`
70+
];
7271
// Send commands and check table view is default for Search command
73-
for (const command of commands) {
74-
await workbenchPage.sendCommandInWorkbench(command);
75-
}
76-
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssTableViewTypeOption).visible).ok('The table view is not selected by default for command FT.SEARCH');
77-
await t.switchToIframe(workbenchPage.iframe);
78-
await t.expect(await workbenchPage.queryTableResult.visible).ok('The table result is not displayed for command FT.SEARCH');
79-
// Select Text view and check result
80-
await t.switchToMainWindow();
81-
await workbenchPage.selectViewTypeText();
82-
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).visible).ok('The result is not displayed in Text view');
83-
});
72+
for (const command of commands) {
73+
await workbenchPage.sendCommandInWorkbench(command);
74+
}
75+
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssTableViewTypeOption).visible).ok('The table view is not selected by default for command FT.SEARCH');
76+
await t.switchToIframe(workbenchPage.iframe);
77+
await t.expect(await workbenchPage.queryTableResult.visible).ok('The table result is not displayed for command FT.SEARCH');
78+
// Select Text view and check result
79+
await t.switchToMainWindow();
80+
await workbenchPage.selectViewTypeText();
81+
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).visible).ok('The result is not displayed in Text view');
82+
});
8483
// Skipped due to issue https://redislabs.atlassian.net/browse/RI-3524
8584
test.skip('Verify that user can switches between Table and Text for Client List and see results corresponding to their views', async t => {
8685
const command = 'CLIENT LIST';

tests/e2e/tests/critical-path/workbench/default-scripts-area.e2e.ts

Lines changed: 73 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Chance } from 'chance';
22
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
33
import { WorkbenchPage, MyRedisDatabasePage } from '../../../pageObjects';
4-
import { rte, env } from '../../../helpers/constants';
4+
import { rte } from '../../../helpers/constants';
55
import { commonUrl, ossStandaloneRedisearch } from '../../../helpers/conf';
66
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
77

@@ -26,82 +26,79 @@ fixture `Default scripts area at Workbench`
2626
await workbenchPage.sendCommandInWorkbench(`FT.DROPINDEX ${indexName} DD`);
2727
await deleteStandaloneDatabaseApi(ossStandaloneRedisearch);
2828
});
29-
test
30-
.meta({ env: env.desktop })('Verify that user can edit and run automatically added "FT._LIST" and "FT.INFO {index}" scripts in Workbench and see the results', async t => {
31-
indexName = chance.word({ length: 5 });
32-
keyName = chance.word({ length: 5 });
33-
const commandsForSend = [
34-
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
35-
`HMSET product:1 name "${keyName}"`,
36-
`HMSET product:2 name "${keyName}"`
37-
];
38-
// Send commands
39-
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'));
40-
// Run automatically added "FT._LIST" and "FT.INFO {index}" scripts
41-
await t.click(workbenchPage.documentButtonInQuickGuides);
42-
await t.click(workbenchPage.internalLinkWorkingWithHashes);
43-
await t.click(workbenchPage.preselectIndexInformation);
44-
// Replace the {index} with indexName value in script and send
45-
let addedScript = await workbenchPage.queryInputScriptArea.nth(2).textContent;
46-
addedScript = addedScript.replace('"idx:schools"', indexName);
47-
addedScript = addedScript.replace(/\s/g, ' ');
48-
await t.click(workbenchPage.submitCommandButton);
49-
await t.pressKey('ctrl+a delete');
50-
await workbenchPage.sendCommandInWorkbench(addedScript);
51-
// Check the FT._LIST result
52-
await t.expect(workbenchPage.queryTextResult.textContent).contains(indexName, 'The result of the FT._LIST command not found');
53-
// Check the FT.INFO result
54-
await t.switchToIframe(workbenchPage.iframe);
55-
await t.expect(workbenchPage.queryColumns.textContent).contains('name', 'The result of the FT.INFO command not found');
56-
});
57-
test
58-
.meta({ env: env.desktop })('Verify that user can edit and run automatically added "Search" script in Workbench and see the results', async t => {
59-
indexName = chance.word({ length: 5 });
60-
keyName = chance.word({ length: 5 });
61-
const commandsForSend = [
62-
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
63-
`HMSET product:1 name "${keyName}"`,
64-
`HMSET product:2 name "${keyName}"`
65-
];
66-
const searchCommand = `FT.SEARCH ${indexName} "${keyName}"`;
67-
// Send commands
68-
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'));
69-
// Run automatically added FT.SEARCH script with edits
70-
await t.click(workbenchPage.documentButtonInQuickGuides);
71-
await t.click(workbenchPage.internalLinkWorkingWithHashes);
72-
await t.click(workbenchPage.preselectExactSearch);
73-
await t.pressKey('ctrl+a delete');
74-
await workbenchPage.sendCommandInWorkbench(searchCommand);
75-
// Check the FT.SEARCH result
76-
await t.switchToIframe(workbenchPage.iframe);
77-
const key = workbenchPage.queryTableResult.withText('product:1');
78-
const name = workbenchPage.queryTableResult.withText(keyName);
79-
await t.expect(key.exists).ok('The added key is not in the Search result');
80-
await t.expect(name.exists).ok('The added key name field is not in the Search result');
81-
});
82-
test
83-
.meta({ env: env.desktop })('Verify that user can edit and run automatically added "Aggregate" script in Workbench and see the results', async t => {
84-
indexName = chance.word({ length: 5 });
85-
const aggregationResultField = 'max_price';
86-
const commandsForSend = [
87-
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA price NUMERIC SORTABLE`,
88-
'HMSET product:1 price 20',
89-
'HMSET product:2 price 100'
90-
];
91-
const searchCommand = `FT.Aggregate ${indexName} * GROUPBY 0 REDUCE MAX 1 @price AS ${aggregationResultField}`;
29+
test('Verify that user can edit and run automatically added "FT._LIST" and "FT.INFO {index}" scripts in Workbench and see the results', async t => {
30+
indexName = chance.word({ length: 5 });
31+
keyName = chance.word({ length: 5 });
32+
const commandsForSend = [
33+
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
34+
`HMSET product:1 name "${keyName}"`,
35+
`HMSET product:2 name "${keyName}"`
36+
];
9237
// Send commands
93-
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'), 0.5);
94-
// Run automatically added FT.Aggregate script with edits
95-
await t.click(workbenchPage.documentButtonInQuickGuides);
96-
await t.click(workbenchPage.internalLinkWorkingWithHashes);
97-
await t.click(workbenchPage.preselectGroupBy);
98-
await t.pressKey('ctrl+a delete');
99-
await workbenchPage.sendCommandInWorkbench(searchCommand);
100-
// Check the FT.Aggregate result
101-
await t.switchToIframe(workbenchPage.iframe);
102-
await t.expect(workbenchPage.queryTableResult.textContent).contains(aggregationResultField, 'The aggregation field name is not in the Search result');
103-
await t.expect(workbenchPage.queryTableResult.textContent).contains('100', 'The aggregation max value is in not the Search result');
104-
});
38+
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'));
39+
// Run automatically added "FT._LIST" and "FT.INFO {index}" scripts
40+
await t.click(workbenchPage.documentButtonInQuickGuides);
41+
await t.click(workbenchPage.internalLinkWorkingWithHashes);
42+
await t.click(workbenchPage.preselectIndexInformation);
43+
// Replace the {index} with indexName value in script and send
44+
let addedScript = await workbenchPage.queryInputScriptArea.nth(2).textContent;
45+
addedScript = addedScript.replace('"idx:schools"', indexName);
46+
addedScript = addedScript.replace(/\s/g, ' ');
47+
await t.click(workbenchPage.submitCommandButton);
48+
await t.pressKey('ctrl+a delete');
49+
await workbenchPage.sendCommandInWorkbench(addedScript);
50+
// Check the FT._LIST result
51+
await t.expect(workbenchPage.queryTextResult.textContent).contains(indexName, 'The result of the FT._LIST command not found');
52+
// Check the FT.INFO result
53+
await t.switchToIframe(workbenchPage.iframe);
54+
await t.expect(workbenchPage.queryColumns.textContent).contains('name', 'The result of the FT.INFO command not found');
55+
});
56+
test('Verify that user can edit and run automatically added "Search" script in Workbench and see the results', async t => {
57+
indexName = chance.word({ length: 5 });
58+
keyName = chance.word({ length: 5 });
59+
const commandsForSend = [
60+
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
61+
`HMSET product:1 name "${keyName}"`,
62+
`HMSET product:2 name "${keyName}"`
63+
];
64+
const searchCommand = `FT.SEARCH ${indexName} "${keyName}"`;
65+
// Send commands
66+
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'));
67+
// Run automatically added FT.SEARCH script with edits
68+
await t.click(workbenchPage.documentButtonInQuickGuides);
69+
await t.click(workbenchPage.internalLinkWorkingWithHashes);
70+
await t.click(workbenchPage.preselectExactSearch);
71+
await t.pressKey('ctrl+a delete');
72+
await workbenchPage.sendCommandInWorkbench(searchCommand);
73+
// Check the FT.SEARCH result
74+
await t.switchToIframe(workbenchPage.iframe);
75+
const key = workbenchPage.queryTableResult.withText('product:1');
76+
const name = workbenchPage.queryTableResult.withText(keyName);
77+
await t.expect(key.exists).ok('The added key is not in the Search result');
78+
await t.expect(name.exists).ok('The added key name field is not in the Search result');
79+
});
80+
test('Verify that user can edit and run automatically added "Aggregate" script in Workbench and see the results', async t => {
81+
indexName = chance.word({ length: 5 });
82+
const aggregationResultField = 'max_price';
83+
const commandsForSend = [
84+
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA price NUMERIC SORTABLE`,
85+
'HMSET product:1 price 20',
86+
'HMSET product:2 price 100'
87+
];
88+
const searchCommand = `FT.Aggregate ${indexName} * GROUPBY 0 REDUCE MAX 1 @price AS ${aggregationResultField}`;
89+
// Send commands
90+
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'), 0.5);
91+
// Run automatically added FT.Aggregate script with edits
92+
await t.click(workbenchPage.documentButtonInQuickGuides);
93+
await t.click(workbenchPage.internalLinkWorkingWithHashes);
94+
await t.click(workbenchPage.preselectGroupBy);
95+
await t.pressKey('ctrl+a delete');
96+
await workbenchPage.sendCommandInWorkbench(searchCommand);
97+
// Check the FT.Aggregate result
98+
await t.switchToIframe(workbenchPage.iframe);
99+
await t.expect(workbenchPage.queryTableResult.textContent).contains(aggregationResultField, 'The aggregation field name is not in the Search result');
100+
await t.expect(workbenchPage.queryTableResult.textContent).contains('100', 'The aggregation max value is in not the Search result');
101+
});
105102
test('Verify that when the “Manual” option clicked, user can see the Editor is automatically prepopulated with the information', async t => {
106103
const information = [
107104
'// Workbench is the advanced Redis command-line interface that allows to send commands to Redis, read and visualize the replies sent by the server.',

0 commit comments

Comments
 (0)