diff --git a/tests/e2e/pageObjects/workbench-page.ts b/tests/e2e/pageObjects/workbench-page.ts index 1876712db0..556ec3e1d4 100644 --- a/tests/e2e/pageObjects/workbench-page.ts +++ b/tests/e2e/pageObjects/workbench-page.ts @@ -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 //------------------------------------------------------------------------------------------ @@ -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 @@ -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-]'; //------------------------------------------------------------------------------------------- @@ -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]'); @@ -139,9 +147,9 @@ export class WorkbenchPage { //Select Table view option in Workbench results async selectViewTypeTable(): Promise{ - 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 @@ -158,7 +166,7 @@ export class WorkbenchPage { * @param commands The array of commands to send */ async sendCommandsArrayInWorkbench(commands: string[]): Promise { - for(let command of commands) { + for(const command of commands) { await this.sendCommandInWorkbench(command); } } diff --git a/tests/e2e/tests/critical-path/workbench/command-results.e2e.ts b/tests/e2e/tests/critical-path/workbench/command-results.e2e.ts index 9c5a657dd9..96f5c9578e 100644 --- a/tests/e2e/tests/critical-path/workbench/command-results.e2e.ts +++ b/tests/e2e/tests/critical-path/workbench/command-results.e2e.ts @@ -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 @@ -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'); }); @@ -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}`); } diff --git a/tests/e2e/tests/regression/workbench/default-scripts-area.e2e.ts b/tests/e2e/tests/regression/workbench/default-scripts-area.e2e.ts index 1fc3c9f0b0..2da18df549 100644 --- a/tests/e2e/tests/regression/workbench/default-scripts-area.e2e.ts +++ b/tests/e2e/tests/regression/workbench/default-scripts-area.e2e.ts @@ -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'); +}); diff --git a/tests/e2e/tests/regression/workbench/scripting-area.e2e.ts b/tests/e2e/tests/regression/workbench/scripting-area.e2e.ts index 34c8c9f689..037e1e4ce1 100644 --- a/tests/e2e/tests/regression/workbench/scripting-area.e2e.ts +++ b/tests/e2e/tests/regression/workbench/scripting-area.e2e.ts @@ -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'); + //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'); +});