Skip to content

Commit 6878560

Browse files
authored
Merge pull request #146 from RedisInsight/feature/e2e-workbench
[E2E] Command indicator and context saving for Workbench tests added
2 parents ca00d2d + 38f5ccb commit 6878560

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

redisinsight/ui/src/pages/workbench/components/enablament-area/EnablementArea/components/InternalPage/InternalPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ const InternalPage = (props: Props) => {
125125
onScroll={handleScroll}
126126
onClick={handleClick}
127127
role="none"
128+
data-testid="enablement-area__page"
128129
>
129130
{ isLoading && <EuiLoadingContent data-testid="enablement-area__page-loader" lines={3} /> }
130131
{ !isLoading && error && <EmptyPrompt /> }

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class WorkbenchPage {
2929
preselectIndexInfo: Selector
3030
queryColumns: Selector
3131
preselectSearch: Selector
32+
preselectHashCreate: Selector
3233
preselectManual: Selector
3334
scriptsLines: Selector
3435
queryInputScriptArea: Selector
@@ -43,6 +44,7 @@ export class WorkbenchPage {
4344
monacoCommandDetails: Selector
4445
monacoCloseCommandDetails: Selector
4546
monacoSuggestion: Selector
47+
monacoCommandIndicator: Selector
4648
iframe: Selector
4749
internalLinkWorkingWithHashes: Selector
4850
preselectExactSearch: Selector
@@ -55,6 +57,7 @@ export class WorkbenchPage {
5557
noCommandHistoryIcon: Selector
5658
noCommandHistoryTitle: Selector
5759
noCommandHistoryText: Selector
60+
scrolledEnablementArea: Selector
5861

5962
constructor() {
6063
//CSS selectors
@@ -83,6 +86,7 @@ export class WorkbenchPage {
8386
this.textViewTypeOption = Selector('[data-test-subj^=view-type-option-Text]');
8487
this.tableViewTypeOption = Selector('[data-test-subj^=view-type-option-Plugin]');
8588
this.preselectList = Selector('[data-testid*=preselect-List]');
89+
this.preselectHashCreate = Selector('[data-testid=preselect-Create]');
8690
this.preselectIndexInfo = Selector('[data-testid*=preselect-Index]');
8791
this.preselectSearch = Selector('[data-testid=preselect-Search]');
8892
this.preselectExactSearch = Selector('[data-testid="preselect-Exact text search"]');
@@ -115,6 +119,8 @@ export class WorkbenchPage {
115119
this.noCommandHistoryIcon = Selector ('[data-testid=wb_no-results__icon]');
116120
this.noCommandHistoryTitle = Selector ('[data-testid=wb_no-results__title]');
117121
this.noCommandHistoryText = Selector ('[data-testid=wb_no-results__summary]');
122+
this.monacoCommandIndicator = Selector('div.monaco-glyph-run-command');
123+
this.scrolledEnablementArea = Selector('[data-testid=enablement-area__page]')
118124
}
119125

120126
/**

tests/e2e/tests/regression/workbench/default-scripts-area.e2e.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,21 @@ test('Verify that user can see the [Manual] option in the Enablement area', asyn
5454
await t.expect(displayedOptions[i]).eql(optionsForCheck[i], `Option ${optionsForCheck} is in the Enablement area`);
5555
}
5656
});
57+
test('Verify that user can see saved article in Enablement area when he leaves Workbench page and goes back again', async t => {
58+
//Open Working with Hashes section
59+
await t.click(workbenchPage.internalLinkWorkingWithHashes);
60+
//Check the button from Hash page is visible
61+
await t.expect(workbenchPage.preselectHashCreate.visible).ok('The end of the page is visible');
62+
//Go to Browser page
63+
await t.click(myRedisDatabasePage.browserButton);
64+
//Go back to Workbench page
65+
await t.click(myRedisDatabasePage.workbenchButton);
66+
//Verify that the same article is opened in Enablement area
67+
await t.expect(workbenchPage.preselectHashCreate.visible).ok('The end of the page is visible');
68+
//Go to list of DBs page
69+
await t.click(myRedisDatabasePage.myRedisDBButton);
70+
//Go back to active DB again
71+
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
72+
//Check that user is on Workbench page and "Working with Hashes" page is displayed
73+
await t.expect(workbenchPage.preselectHashCreate.visible).ok('The end of the page is visible');
74+
});

tests/e2e/tests/regression/workbench/scripting-area.e2e.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Selector } from 'testcafe';
12
import { addNewStandaloneDatabase } from '../../../helpers/database';
23
import {
34
MyRedisDatabasePage,
@@ -67,3 +68,15 @@ test('Verify that user can use double slashes (//) wrapped in double quotes and
6768
await t.expect(resultCommand).contains(commandsForSend[commandsForSend.length - i], `The command ${commandsForSend[commandsForSend.length - i]} is in the result`);
6869
}
6970
});
71+
test('Verify that user can see an indication (green triangle) of commands from the left side of the line numbers', async t => {
72+
//Open Working with Hashes page
73+
await t.click(workbenchPage.internalLinkWorkingWithHashes);
74+
//Put Create Hash commands into Editing area
75+
await t.click(workbenchPage.preselectHashCreate);
76+
//Maximize Scripting area to see all the commands
77+
await t.drag(workbenchPage.resizeButtonForScriptingAndResults, 0, 300, { speed: 0.4 });
78+
//Get number of commands in scripting area
79+
const numberOfCommands = await Selector('span').withExactText('HSET').count;
80+
//Compare number of indicator displayed and expected value
81+
await t.expect(workbenchPage.monacoCommandIndicator.count).eql(numberOfCommands, 'Number of command indicator');
82+
});

0 commit comments

Comments
 (0)