Skip to content

Commit f2e5c61

Browse files
committed
[E2E] Command indicator and context saving for Workbench tests added
1 parent 331150e commit f2e5c61

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
@@ -120,6 +120,7 @@ const InternalPage = (props: Props) => {
120120
</div>
121121
</EuiFlyoutHeader>
122122
<div
123+
data-testid="enablement-area__page"
123124
ref={containerRef}
124125
className={cx(styles.content, 'enablement-area__page')}
125126
onScroll={handleScroll}

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class WorkbenchPage {
2727
preselectIndexInfo: Selector
2828
queryColumns: Selector
2929
preselectSearch: Selector
30+
preselectHashCreate: Selector
3031
preselectManual: Selector
3132
scriptsLines: Selector
3233
queryInputScriptArea: Selector
@@ -41,6 +42,7 @@ export class WorkbenchPage {
4142
monacoCommandDetails: Selector
4243
monacoCloseCommandDetails: Selector
4344
monacoSuggestion: Selector
45+
monacoCommandIndicator: Selector
4446
iframe: Selector
4547
internalLinkWorkingWithHashes: Selector
4648
preselectExactSearch: Selector
@@ -52,6 +54,7 @@ export class WorkbenchPage {
5254
noCommandHistoryIcon: Selector
5355
noCommandHistoryTitle: Selector
5456
noCommandHistoryText: Selector
57+
scrolledEnablementArea: Selector
5558

5659
constructor() {
5760
//CSS selectors
@@ -77,6 +80,7 @@ export class WorkbenchPage {
7780
this.selectViewType = Selector('[data-testid=select-view-type]');
7881
this.textViewTypeOption = Selector('[data-test-subj=view-type-option-Text]');
7982
this.preselectList = Selector('[data-testid*=preselect-List]');
83+
this.preselectHashCreate = Selector('[data-testid=preselect-Create]');
8084
this.preselectIndexInfo = Selector('[data-testid*=preselect-Index]');
8185
this.preselectSearch = Selector('[data-testid=preselect-Search]');
8286
this.preselectExactSearch = Selector('[data-testid="preselect-Exact text search"]');
@@ -109,6 +113,8 @@ export class WorkbenchPage {
109113
this.noCommandHistoryIcon = Selector ('[data-testid=wb_no-results__icon]');
110114
this.noCommandHistoryTitle = Selector ('[data-testid=wb_no-results__title]');
111115
this.noCommandHistoryText = Selector ('[data-testid=wb_no-results__summary]');
116+
this.monacoCommandIndicator = Selector('div.monaco-glyph-run-command');
117+
this.scrolledEnablementArea = Selector('[data-testid=enablement-area__page]')
112118
}
113119

114120
/**

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)