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
20 changes: 14 additions & 6 deletions tests/e2e/pageObjects/workbench-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ export class WorkbenchPage {
cssSelectorPaginationButtonNext: string
cssReRunCommandButton: string
cssDeleteCommandButton: string
cssQueryCardOutputResponceSuccess: string
cssQueryCardOutputResponseSuccess: string
cssTableViewTypeOption: string
cssMonacoCommandPaletteLine: string
cssQueryTextResult: string
cssQueryTableResult: string
//------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -45,6 +46,9 @@ export class WorkbenchPage {
monacoCloseCommandDetails: Selector
monacoSuggestion: Selector
monacoCommandIndicator: Selector
monacoContextMenu: Selector
monacoShortcutInput: Selector
monacoSuggestionOption: Selector
iframe: Selector
internalLinkWorkingWithHashes: Selector
preselectExactSearch: Selector
Expand All @@ -65,8 +69,9 @@ export class WorkbenchPage {
this.cssSelectorPaginationButtonNext = '[data-test-subj=pagination-button-next]';
this.cssReRunCommandButton = '[data-testid=re-run-command]';
this.cssDeleteCommandButton = '[data-testid=delete-command]';
this.cssQueryCardOutputResponceSuccess = '[data-testid=query-card-output-response-success]';
this.cssQueryCardOutputResponseSuccess = '[data-testid=query-card-output-response-success]';
this.cssTableViewTypeOption = '[data-testid=view-type-selected-Plugin-redisearch__redisearch]';
this.cssMonacoCommandPaletteLine = '[aria-label="Command Palette"]';
this.cssQueryTextResult = '[data-testid=query-cli-result]';
this.cssQueryTableResult = '[data-testid^=query-table-result-]';
//-------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -111,6 +116,9 @@ export class WorkbenchPage {
this.monacoCommandDetails = Selector('div.suggest-details-container');
this.monacoCloseCommandDetails = Selector('span.codicon-close');
this.monacoSuggestion = Selector('span.monaco-icon-name-container');
this.monacoContextMenu = Selector('div.shadow-root-host').shadowRoot();
this.monacoShortcutInput = Selector('input.input');
this.monacoSuggestionOption = Selector('div.monaco-list-row');
this.iframe = Selector('[data-testid=pluginIframe]', { timeout: 60000 });
this.monacoHintWithArguments = Selector('[widgetid="editor.widget.parameterHintsWidget"]');
this.noCommandHistorySection = Selector('[data-testid=wb_no-results]');
Expand Down Expand Up @@ -139,9 +147,9 @@ export class WorkbenchPage {

//Select Table view option in Workbench results
async selectViewTypeTable(): Promise<void>{
await t.click(this.selectViewType);
await t.click(this.tableViewTypeOption);
}
await t.click(this.selectViewType);
await t.click(this.tableViewTypeOption);
}

/**
* Send a command in Workbench
Expand All @@ -158,7 +166,7 @@ export class WorkbenchPage {
* @param commands The array of commands to send
*/
async sendCommandsArrayInWorkbench(commands: string[]): Promise<void> {
for(let command of commands) {
for(const command of commands) {
await this.sendCommandInWorkbench(command);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { addNewStandaloneDatabase } from '../../../helpers/database';
import { WorkbenchPage } from '../../../pageObjects/workbench-page';
import { MyRedisDatabasePage, UserAgreementPage, AddRedisDatabasePage } from '../../../pageObjects';
import { MyRedisDatabasePage, UserAgreementPage, AddRedisDatabasePage, WorkbenchPage } from '../../../pageObjects';
import {
commonUrl,
ossStandaloneConfig
Expand Down Expand Up @@ -51,7 +50,7 @@ test('Verify that user can see expanded result after command re-run at the top o
const containerOfCommand = await workbenchPage.getCardContainerByCommand(commandForSend1);
await t.click(containerOfCommand.find(workbenchPage.cssReRunCommandButton));
//Verify that re-executed command is expanded
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryCardOutputResponceSuccess).visible).ok('Re-executed command is expanded');
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryCardOutputResponseSuccess).visible).ok('Re-executed command is expanded');
//Verify that re-executed command is at the top of results
await t.expect(workbenchPage.queryCardCommand.nth(0).textContent).eql(commandForSend1, 'The re-executed command is at the top of results table');
});
Expand All @@ -71,7 +70,7 @@ test('Verify that user can see the results found in the table view by default fo
'FT.AGGREGATE'
];
//Send commands and check table view is default
for(let command of commands) {
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 selected by default for command ${command}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,26 @@ test('Verify that user can see saved article in Enablement area when he leaves W
//Check that user is on Workbench page and "Working with Hashes" page is displayed
await t.expect(workbenchPage.preselectHashCreate.visible).ok('The end of the page is visible');
});
test('Verify that user can see saved scroll position in Enablement area when he leaves Workbench page and goes back again', async t => {
//Open Working with Hashes section
await t.click(workbenchPage.internalLinkWorkingWithHashes);
//Evaluate the last button in Enablement Area
const buttonsQuantity = await workbenchPage.preselectButtons.count;
const lastButton = workbenchPage.preselectButtons.nth(buttonsQuantity - 1);
//Scroll to the very bottom of the page
await t.scrollIntoView(lastButton);
//Check the scroll position
const scrollPosition = await workbenchPage.scrolledEnablementArea.scrollTop;
//Go to Browser page
await t.click(myRedisDatabasePage.browserButton);
//Go back to Workbench page
await t.click(myRedisDatabasePage.workbenchButton);
//Check that scroll position is saved
await t.expect(workbenchPage.scrolledEnablementArea.scrollTop).eql(scrollPosition, 'The scroll position status');
//Go to list of DBs page
await t.click(myRedisDatabasePage.myRedisDBButton);
//Go back to active DB again
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
//Check that scroll position is saved
await t.expect(workbenchPage.scrolledEnablementArea.scrollTop).eql(scrollPosition, 'Scroll position is correct');
});
16 changes: 16 additions & 0 deletions tests/e2e/tests/regression/workbench/scripting-area.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,19 @@ test('Verify that user can see an indication (green triangle) of commands from t
//Compare number of indicator displayed and expected value
await t.expect(workbenchPage.monacoCommandIndicator.count).eql(numberOfCommands, 'Number of command indicator');
});
test('Verify that user can find (using right click) "Run Commands" custom shortcut option in monaco menu and run a command', async t => {
const command = 'HSET key field value';
//Put a command in Editing Area
await t.typeText(workbenchPage.queryInput, command);
//Right click to get context menu
await t.rightClick(workbenchPage.queryInput);
//Select Command Palette option
await t.click(workbenchPage.monacoContextMenu.find(workbenchPage.cssMonacoCommandPaletteLine));
//Print "Run Commands" shortcut
await t.typeText(workbenchPage.monacoShortcutInput, 'Run Commands');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend using with { replace: true, paste: true } on typeText

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not add replace and paste options because monaco context menu doesn't work with them and test fails. Need "typeahead" behavior in this test

//Select "Run Commands" from menu
await t.click(workbenchPage.monacoSuggestionOption);
//Check the result with sent command
const commandTextInResult = await workbenchPage.queryCardCommand.withExactText(command);
await t.expect(commandTextInResult.exists).ok('The result of sent command');
});