Skip to content

Commit baca81a

Browse files
committed
[E2E] Workbench test with placeholder for empty command history is added
1 parent 730ddc5 commit baca81a

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ export class WorkbenchPage {
4949
expandArea: Selector
5050
monacoHintWithArguments: Selector
5151
noCommandHistorySection: Selector
52+
noCommandHistoryIcon: Selector
53+
noCommandHistoryTitle: Selector
54+
noCommandHistoryText: Selector
5255

5356
constructor() {
5457
//CSS selectors
@@ -99,11 +102,13 @@ export class WorkbenchPage {
99102
this.monacoCloseCommandDetails = Selector('span.codicon-close');
100103
this.monacoSuggestion = Selector('span.monaco-icon-name-container');
101104
this.iframe = Selector('.pluginIframe', { timeout: 90000 });
102-
this.monacoHintWithArguments = Selector('[widgetid="editor.widget.parameterHintsWidget"]')
103-
this.noCommandHistorySection = Selector('[data-testid=wb_no-results]')
104-
// Panel
105+
this.monacoHintWithArguments = Selector('[widgetid="editor.widget.parameterHintsWidget"]');
106+
this.noCommandHistorySection = Selector('[data-testid=wb_no-results]');
105107
this.preselectArea = Selector('[data-testid=enablementArea]');
106-
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]');
107112
}
108113

109114
/**

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ test('Verify that user can see static list of arguments is displayed when he ent
5656
//Check that no hints are displayed
5757
await t.expect(workbenchPage.monacoHintWithArguments.visible).notOk('Hints with arguments are not displayed yet')
5858
//Add space after the printed command
59-
const command_hint = 'AI.SCRIPTEXECUTE '
60-
await t.typeText(workbenchPage.queryInput, command_hint, { replace: true })
59+
await t.typeText(workbenchPage.queryInput, `${command} `, { replace: true })
6160
//Check that hint with arguments are displayed
6261
await t.expect(workbenchPage.monacoHintWithArguments.visible).ok('Hints with arguments are displayed')
6362
});
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)