Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions tests/e2e/tests/critical-path/workbench/command-results.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { env, rte } from '../../../helpers/constants';
import { rte } from '../../../helpers/constants';
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
import { MyRedisDatabasePage, WorkbenchPage } from '../../../pageObjects';
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
Expand Down Expand Up @@ -61,26 +61,25 @@ test('Verify that user can see the results found in the table view by default fo
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssTableViewTypeOption).visible).ok(`The table view is not selected by default for command ${command}`);
}
});
test
.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 => {
indexName = common.generateWord(5);
const commands = [
'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"',
`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`,
`FT.SEARCH ${indexName} * limit 0 10000`
];
test('Verify that user can switches between views and see results according to the view rules in Workbench in results', async t => {
indexName = common.generateWord(5);
const commands = [
'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"',
`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`,
`FT.SEARCH ${indexName} * limit 0 10000`
];
// Send commands and check table view is default for Search command
for (const command of commands) {
await workbenchPage.sendCommandInWorkbench(command);
}
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');
await t.switchToIframe(workbenchPage.iframe);
await t.expect(await workbenchPage.queryTableResult.visible).ok('The table result is not displayed for command FT.SEARCH');
// Select Text view and check result
await t.switchToMainWindow();
await workbenchPage.selectViewTypeText();
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).visible).ok('The result is not displayed in Text view');
});
for (const command of commands) {
await workbenchPage.sendCommandInWorkbench(command);
}
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');
await t.switchToIframe(workbenchPage.iframe);
await t.expect(await workbenchPage.queryTableResult.visible).ok('The table result is not displayed for command FT.SEARCH');
// Select Text view and check result
await t.switchToMainWindow();
await workbenchPage.selectViewTypeText();
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).visible).ok('The result is not displayed in Text view');
});
// Skipped due to issue https://redislabs.atlassian.net/browse/RI-3524
test.skip('Verify that user can switches between Table and Text for Client List and see results corresponding to their views', async t => {
const command = 'CLIENT LIST';
Expand Down
149 changes: 73 additions & 76 deletions tests/e2e/tests/critical-path/workbench/default-scripts-area.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Chance } from 'chance';
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
import { WorkbenchPage, MyRedisDatabasePage } from '../../../pageObjects';
import { rte, env } from '../../../helpers/constants';
import { rte } from '../../../helpers/constants';
import { commonUrl, ossStandaloneRedisearch } from '../../../helpers/conf';
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';

Expand All @@ -26,82 +26,79 @@ fixture `Default scripts area at Workbench`
await workbenchPage.sendCommandInWorkbench(`FT.DROPINDEX ${indexName} DD`);
await deleteStandaloneDatabaseApi(ossStandaloneRedisearch);
});
test
.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 => {
indexName = chance.word({ length: 5 });
keyName = chance.word({ length: 5 });
const commandsForSend = [
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
`HMSET product:1 name "${keyName}"`,
`HMSET product:2 name "${keyName}"`
];
// Send commands
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'));
// Run automatically added "FT._LIST" and "FT.INFO {index}" scripts
await t.click(workbenchPage.documentButtonInQuickGuides);
await t.click(workbenchPage.internalLinkWorkingWithHashes);
await t.click(workbenchPage.preselectIndexInformation);
// Replace the {index} with indexName value in script and send
let addedScript = await workbenchPage.queryInputScriptArea.nth(2).textContent;
addedScript = addedScript.replace('"idx:schools"', indexName);
addedScript = addedScript.replace(/\s/g, ' ');
await t.click(workbenchPage.submitCommandButton);
await t.pressKey('ctrl+a delete');
await workbenchPage.sendCommandInWorkbench(addedScript);
// Check the FT._LIST result
await t.expect(workbenchPage.queryTextResult.textContent).contains(indexName, 'The result of the FT._LIST command not found');
// Check the FT.INFO result
await t.switchToIframe(workbenchPage.iframe);
await t.expect(workbenchPage.queryColumns.textContent).contains('name', 'The result of the FT.INFO command not found');
});
test
.meta({ env: env.desktop })('Verify that user can edit and run automatically added "Search" script in Workbench and see the results', async t => {
indexName = chance.word({ length: 5 });
keyName = chance.word({ length: 5 });
const commandsForSend = [
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
`HMSET product:1 name "${keyName}"`,
`HMSET product:2 name "${keyName}"`
];
const searchCommand = `FT.SEARCH ${indexName} "${keyName}"`;
// Send commands
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'));
// Run automatically added FT.SEARCH script with edits
await t.click(workbenchPage.documentButtonInQuickGuides);
await t.click(workbenchPage.internalLinkWorkingWithHashes);
await t.click(workbenchPage.preselectExactSearch);
await t.pressKey('ctrl+a delete');
await workbenchPage.sendCommandInWorkbench(searchCommand);
// Check the FT.SEARCH result
await t.switchToIframe(workbenchPage.iframe);
const key = workbenchPage.queryTableResult.withText('product:1');
const name = workbenchPage.queryTableResult.withText(keyName);
await t.expect(key.exists).ok('The added key is not in the Search result');
await t.expect(name.exists).ok('The added key name field is not in the Search result');
});
test
.meta({ env: env.desktop })('Verify that user can edit and run automatically added "Aggregate" script in Workbench and see the results', async t => {
indexName = chance.word({ length: 5 });
const aggregationResultField = 'max_price';
const commandsForSend = [
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA price NUMERIC SORTABLE`,
'HMSET product:1 price 20',
'HMSET product:2 price 100'
];
const searchCommand = `FT.Aggregate ${indexName} * GROUPBY 0 REDUCE MAX 1 @price AS ${aggregationResultField}`;
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 => {
indexName = chance.word({ length: 5 });
keyName = chance.word({ length: 5 });
const commandsForSend = [
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
`HMSET product:1 name "${keyName}"`,
`HMSET product:2 name "${keyName}"`
];
// Send commands
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'), 0.5);
// Run automatically added FT.Aggregate script with edits
await t.click(workbenchPage.documentButtonInQuickGuides);
await t.click(workbenchPage.internalLinkWorkingWithHashes);
await t.click(workbenchPage.preselectGroupBy);
await t.pressKey('ctrl+a delete');
await workbenchPage.sendCommandInWorkbench(searchCommand);
// Check the FT.Aggregate result
await t.switchToIframe(workbenchPage.iframe);
await t.expect(workbenchPage.queryTableResult.textContent).contains(aggregationResultField, 'The aggregation field name is not in the Search result');
await t.expect(workbenchPage.queryTableResult.textContent).contains('100', 'The aggregation max value is in not the Search result');
});
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'));
// Run automatically added "FT._LIST" and "FT.INFO {index}" scripts
await t.click(workbenchPage.documentButtonInQuickGuides);
await t.click(workbenchPage.internalLinkWorkingWithHashes);
await t.click(workbenchPage.preselectIndexInformation);
// Replace the {index} with indexName value in script and send
let addedScript = await workbenchPage.queryInputScriptArea.nth(2).textContent;
addedScript = addedScript.replace('"idx:schools"', indexName);
addedScript = addedScript.replace(/\s/g, ' ');
await t.click(workbenchPage.submitCommandButton);
await t.pressKey('ctrl+a delete');
await workbenchPage.sendCommandInWorkbench(addedScript);
// Check the FT._LIST result
await t.expect(workbenchPage.queryTextResult.textContent).contains(indexName, 'The result of the FT._LIST command not found');
// Check the FT.INFO result
await t.switchToIframe(workbenchPage.iframe);
await t.expect(workbenchPage.queryColumns.textContent).contains('name', 'The result of the FT.INFO command not found');
});
test('Verify that user can edit and run automatically added "Search" script in Workbench and see the results', async t => {
indexName = chance.word({ length: 5 });
keyName = chance.word({ length: 5 });
const commandsForSend = [
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
`HMSET product:1 name "${keyName}"`,
`HMSET product:2 name "${keyName}"`
];
const searchCommand = `FT.SEARCH ${indexName} "${keyName}"`;
// Send commands
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'));
// Run automatically added FT.SEARCH script with edits
await t.click(workbenchPage.documentButtonInQuickGuides);
await t.click(workbenchPage.internalLinkWorkingWithHashes);
await t.click(workbenchPage.preselectExactSearch);
await t.pressKey('ctrl+a delete');
await workbenchPage.sendCommandInWorkbench(searchCommand);
// Check the FT.SEARCH result
await t.switchToIframe(workbenchPage.iframe);
const key = workbenchPage.queryTableResult.withText('product:1');
const name = workbenchPage.queryTableResult.withText(keyName);
await t.expect(key.exists).ok('The added key is not in the Search result');
await t.expect(name.exists).ok('The added key name field is not in the Search result');
});
test('Verify that user can edit and run automatically added "Aggregate" script in Workbench and see the results', async t => {
indexName = chance.word({ length: 5 });
const aggregationResultField = 'max_price';
const commandsForSend = [
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA price NUMERIC SORTABLE`,
'HMSET product:1 price 20',
'HMSET product:2 price 100'
];
const searchCommand = `FT.Aggregate ${indexName} * GROUPBY 0 REDUCE MAX 1 @price AS ${aggregationResultField}`;
// Send commands
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'), 0.5);
// Run automatically added FT.Aggregate script with edits
await t.click(workbenchPage.documentButtonInQuickGuides);
await t.click(workbenchPage.internalLinkWorkingWithHashes);
await t.click(workbenchPage.preselectGroupBy);
await t.pressKey('ctrl+a delete');
await workbenchPage.sendCommandInWorkbench(searchCommand);
// Check the FT.Aggregate result
await t.switchToIframe(workbenchPage.iframe);
await t.expect(workbenchPage.queryTableResult.textContent).contains(aggregationResultField, 'The aggregation field name is not in the Search result');
await t.expect(workbenchPage.queryTableResult.textContent).contains('100', 'The aggregation max value is in not the Search result');
});
test('Verify that when the “Manual” option clicked, user can see the Editor is automatically prepopulated with the information', async t => {
const information = [
'// Workbench is the advanced Redis command-line interface that allows to send commands to Redis, read and visualize the replies sent by the server.',
Expand Down
Loading