Skip to content

Commit d7db92b

Browse files
authored
Merge pull request #118 from RedisInsight/feature/e2e-workbench
[E2E] Workbench tests are added
2 parents 19e7664 + baca81a commit d7db92b

File tree

3 files changed

+94
-2
lines changed

3 files changed

+94
-2
lines changed

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ export class WorkbenchPage {
4747
preselectGroupBy: Selector
4848
preselectArea: Selector
4949
expandArea: Selector
50+
monacoHintWithArguments: Selector
51+
noCommandHistorySection: Selector
52+
noCommandHistoryIcon: Selector
53+
noCommandHistoryTitle: Selector
54+
noCommandHistoryText: Selector
5055

5156
constructor() {
5257
//CSS selectors
@@ -97,9 +102,13 @@ export class WorkbenchPage {
97102
this.monacoCloseCommandDetails = Selector('span.codicon-close');
98103
this.monacoSuggestion = Selector('span.monaco-icon-name-container');
99104
this.iframe = Selector('.pluginIframe', { timeout: 90000 });
100-
// Panel
105+
this.monacoHintWithArguments = Selector('[widgetid="editor.widget.parameterHintsWidget"]');
106+
this.noCommandHistorySection = Selector('[data-testid=wb_no-results]');
101107
this.preselectArea = Selector('[data-testid=enablementArea]');
102-
this.expandArea = Selector('[]')
108+
this.expandArea = Selector('[data-testid=enablement-area-container]');
109+
this.noCommandHistoryIcon = Selector ('[data-testid=wb_no-results__icon]');
110+
this.noCommandHistoryTitle = Selector ('[data-testid=wb_no-results__title]');
111+
this.noCommandHistoryText = Selector ('[data-testid=wb_no-results__summary]');
103112
}
104113

105114
/**

tests/e2e/tests/regression/workbench/autocomplete.e2e.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,44 @@ test('Verify that user can open the "read more" about the command by clicking on
4949
await t.pressKey('ctrl+space');
5050
await t.expect(await workbenchPage.monacoCommandDetails.exists).notOk('The "read more" about the command is closed');
5151
});
52+
test('Verify that user can see static list of arguments is displayed when he enters the command in Editor in Workbench', async t => {
53+
const command = 'AI.SCRIPTEXECUTE'
54+
//Type the command in Editing area
55+
await t.typeText(workbenchPage.queryInput, command, { replace: true });
56+
//Check that no hints are displayed
57+
await t.expect(workbenchPage.monacoHintWithArguments.visible).notOk('Hints with arguments are not displayed yet')
58+
//Add space after the printed command
59+
await t.typeText(workbenchPage.queryInput, `${command} `, { replace: true })
60+
//Check that hint with arguments are displayed
61+
await t.expect(workbenchPage.monacoHintWithArguments.visible).ok('Hints with arguments are displayed')
62+
});
63+
test('Verify that user can close the static list of arguments by pressing “ESC”', async t => {
64+
const command = 'TS.DELETERULE '
65+
await t.typeText(workbenchPage.queryInput, command, { replace: true })
66+
//Check that hint with arguments are displayed
67+
await t.expect(workbenchPage.monacoHintWithArguments.visible).ok('Hints with arguments are displayed')
68+
//Remove hints with arguments
69+
await t.pressKey('esc');
70+
//Check no hints are displayed
71+
await t.expect(workbenchPage.monacoHintWithArguments.visible).notOk('Hints with arguments are not displayed')
72+
});
73+
test('Verify that user can see the static list of arguments when he uses “Ctrl+Shift+Space” combination for already entered command for Windows', async t => {
74+
const command = 'JSON.ARRAPPEND'
75+
await t.typeText(workbenchPage.queryInput, command, { replace: true });
76+
//Verify that the list with auto-suggestions is displayed
77+
await t.expect(await workbenchPage.monacoSuggestion.exists).ok('Auto-suggestions are displayed');
78+
//Select the command from suggestion list
79+
await t.pressKey('enter');
80+
//Check that the command is displayed in Editing area after selecting
81+
const script = await workbenchPage.queryInputScriptArea.textContent;
82+
await t.expect(script.replace(/\s/g, ' ')).eql('JSON.ARRAPPEND key value ', 'Result of sent command exists');
83+
//Check that hint with arguments are displayed
84+
await t.expect(workbenchPage.monacoHintWithArguments.visible).ok('Hints with arguments are displayed')
85+
//Remove hints with arguments
86+
await t.pressKey('esc');
87+
//Check no hints are displayed
88+
await t.expect(workbenchPage.monacoHintWithArguments.visible).notOk('Hints with arguments are not displayed')
89+
//Check that using shortcut “Ctrl+Shift+Space” hints are displayed
90+
await t.pressKey('ctrl+shift+space');
91+
await t.expect(workbenchPage.monacoHintWithArguments.visible).ok('Hints with arguments are displayed')
92+
});
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Selector } from 'testcafe';
2+
import { addNewStandaloneDatabase } from '../../../helpers/database';
3+
import { MyRedisDatabasePage, UserAgreementPage, AddRedisDatabasePage, WorkbenchPage } from '../../../pageObjects';
4+
import {
5+
commonUrl,
6+
ossStandaloneConfig
7+
} from '../../../helpers/conf';
8+
9+
const myRedisDatabasePage = new MyRedisDatabasePage();
10+
const userAgreementPage = new UserAgreementPage();
11+
const addRedisDatabasePage = new AddRedisDatabasePage();
12+
const workbenchPage = new WorkbenchPage();
13+
14+
fixture `Empty command history in Workbench`
15+
.meta({type: 'regression'})
16+
.page(commonUrl)
17+
.beforeEach(async t => {
18+
await t.maximizeWindow();
19+
await userAgreementPage.acceptLicenseTerms();
20+
await t.expect(addRedisDatabasePage.addDatabaseButton.exists).ok('The add redis database view', {timeout: 20000});
21+
await addNewStandaloneDatabase(ossStandaloneConfig);
22+
//Connect to DB
23+
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
24+
//Go to Workbench page
25+
await t.click(myRedisDatabasePage.workbenchButton);
26+
})
27+
test('Verify that user can see placeholder text in Workbench history if no commands have not been run yet', async t => {
28+
//Verify that all the elements from empty command history placeholder are displayed
29+
await t.expect(workbenchPage.noCommandHistorySection.visible).ok('No command history section is visible')
30+
await t.expect(workbenchPage.noCommandHistoryIcon.visible).ok('No command history icon is visible')
31+
await t.expect(workbenchPage.noCommandHistoryTitle.visible).ok('No command history title is visible')
32+
await t.expect(workbenchPage.noCommandHistoryText.visible).ok('No command history text is visible')
33+
//Run a command
34+
const commandToSend = 'info server';
35+
await workbenchPage.sendCommandInWorkbench(commandToSend);
36+
//Verify that empty command history placeholder is not displayed
37+
await t.expect(workbenchPage.noCommandHistorySection.visible).notOk('No command history section is not visible')
38+
//Delete the command result
39+
await t.click(Selector(workbenchPage.cssDeleteCommandButton));
40+
//Verify that empty command history placeholder is displayed
41+
await t.expect(workbenchPage.noCommandHistorySection.visible).ok('No command history section is visible')
42+
});

0 commit comments

Comments
 (0)