Skip to content

Commit 6607338

Browse files
test.skip
1 parent 64f4edf commit 6607338

File tree

4 files changed

+169
-0
lines changed

4 files changed

+169
-0
lines changed

redisinsight/ui/src/utils/monacoUtils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export const createSyntaxWidget = (text: string, shortcutText: string) => {
187187

188188
const shortcut = document.createElement('span')
189189
shortcut.classList.add('monaco-widget__shortcut')
190+
widget.setAttribute('data-testid', 'monaco-widget')
190191
shortcut.innerHTML = shortcutText
191192

192193
widget.append(title, shortcut)

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export class WorkbenchPage {
7676
preselectCreateHashIndex: Selector
7777
commandExecutionResult: Selector
7878
commandExecutionResultFailed: Selector
79+
monacoWidget: Selector
80+
cancelButton: Selector
81+
applyButton: Selector
7982

8083
constructor() {
8184
//CSS selectors
@@ -123,6 +126,8 @@ export class WorkbenchPage {
123126
this.enablementAreaPagination = Selector('[data-testid=enablement-area__pagination-popover-btn]');
124127
this.paginationPopoverButtons = Selector('[data-testid=enablement-area__pagination-popover] button');
125128
this.fullScreenButton = Selector('[data-testid=toggle-full-screen]');
129+
this.cancelButton = Selector('[data-testid=cancel-btn]');
130+
this.applyButton = Selector('[data-testid=apply-btn]');
126131
// TEXT INPUTS (also referred to as 'Text fields')
127132
this.queryInput = Selector('[data-testid=query-input-container]');
128133
this.scriptsLines = Selector('[data-testid=query-input-container] .view-lines');
@@ -157,6 +162,7 @@ export class WorkbenchPage {
157162
this.customPluginsViewType = Selector('[data-test-subj*=clients-list]');
158163
this.commandExecutionResult = Selector('[data-testid=query-common-result]');
159164
this.commandExecutionResultFailed = Selector('[data-testid=cli-output-response-fail]');
165+
this.monacoWidget = Selector('[data-testid=monaco-widget]');
160166
}
161167

162168
/**
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { rte } from '../../../helpers/constants';
2+
import { acceptLicenseTermsAndAddDatabase, deleteDatabase } from '../../../helpers/database';
3+
import { MyRedisDatabasePage, WorkbenchPage } from '../../../pageObjects';
4+
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
5+
6+
const myRedisDatabasePage = new MyRedisDatabasePage();
7+
const workbenchPage = new WorkbenchPage();
8+
9+
fixture `Cypher syntax at Workbench`
10+
.meta({type: 'critical_path'})
11+
.page(commonUrl)
12+
.beforeEach(async t => {
13+
await acceptLicenseTermsAndAddDatabase(ossStandaloneConfig, ossStandaloneConfig.databaseName);
14+
//Go to Workbench page
15+
await t.click(myRedisDatabasePage.workbenchButton);
16+
})
17+
.afterEach(async() => {
18+
//Drop database
19+
await deleteDatabase(ossStandaloneConfig.databaseName);
20+
})
21+
test
22+
.meta({ rte: rte.standalone })
23+
.after(async() => {
24+
//Delete database
25+
await deleteDatabase(ossStandaloneConfig.databaseName);
26+
})
27+
('Verify that user can see popover Editor is displayed when clicks on “Use Cypher Syntax” popover in the Editor or “Shift+Space”', async t => {
28+
const command = 'GRAPH.QUERY graph';
29+
//Type command and put the cursor inside
30+
await t.typeText(workbenchPage.queryInput, `${command} "query"`, { replace: true });
31+
await t.pressKey('left');
32+
//Open popover editor by clicks on “Use Cypher Syntax”
33+
await t.click(workbenchPage.monacoWidget);
34+
await t.expect(await workbenchPage.queryInput.nth(1).visible).ok('The user can see opened popover Editor');
35+
//Close popover editor and re-open by shortcut
36+
await t.pressKey('esc');
37+
await t.expect(await workbenchPage.queryInput.nth(1).visible).notOk('The popover Editor is closed');
38+
await t.pressKey('shift+space');
39+
await t.expect(await workbenchPage.queryInput.nth(1).visible).ok('The user can see opened popover Editor');
40+
});
41+
test
42+
.meta({ rte: rte.standalone })
43+
.after(async() => {
44+
//Delete database
45+
await deleteDatabase(ossStandaloneConfig.databaseName);
46+
})
47+
('Verify that wheh popover Editor is displayed user can see it is populated with the script that was detected between the quotes or it is blank if quotes were empty', async t => {
48+
const command = 'GRAPH.QUERY graph';
49+
const script = 'query'
50+
//Type command with empty script and open popover
51+
await t.typeText(workbenchPage.queryInput, `${command} ""`, { replace: true });
52+
await t.pressKey('left');
53+
await t.click(workbenchPage.monacoWidget);
54+
//Verify that the Editor is blank
55+
await t.expect(workbenchPage.scriptsLines.nth(1).textContent).eql('', 'The user can see blank Editor');
56+
//Close popover editor and re-open with added script
57+
await t.pressKey('esc');
58+
await t.typeText(workbenchPage.queryInput, `${command} "${script}`, { replace: true });
59+
await t.debug();
60+
await t.pressKey('left');
61+
await t.click(workbenchPage.monacoWidget);
62+
//Verify that the Editor is populated with the script
63+
await t.expect(workbenchPage.scriptsLines.nth(1).textContent).eql(script, 'The user can see editor populated with the script that was detected between the quotes');
64+
});
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import { rte } from '../../../helpers/constants';
2+
import { acceptLicenseTermsAndAddDatabase, deleteDatabase } from '../../../helpers/database';
3+
import { MyRedisDatabasePage, WorkbenchPage } from '../../../pageObjects';
4+
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
5+
6+
const myRedisDatabasePage = new MyRedisDatabasePage();
7+
const workbenchPage = new WorkbenchPage();
8+
9+
fixture `Cypher syntax at Workbench`
10+
.meta({type: 'regression'})
11+
.page(commonUrl)
12+
.beforeEach(async t => {
13+
await acceptLicenseTermsAndAddDatabase(ossStandaloneConfig, ossStandaloneConfig.databaseName);
14+
//Go to Workbench page
15+
await t.click(myRedisDatabasePage.workbenchButton);
16+
})
17+
.afterEach(async() => {
18+
//Drop database
19+
await deleteDatabase(ossStandaloneConfig.databaseName);
20+
})
21+
test
22+
.meta({ rte: rte.standalone })
23+
.after(async() => {
24+
//Delete database
25+
await deleteDatabase(ossStandaloneConfig.databaseName);
26+
})
27+
('Verify that user can see popover “Use Cypher Syntax” when cursor is inside the query argument double/single quotes in the GRAPH command', async t => {
28+
const command = 'GRAPH.QUERY graph';
29+
//Type command and put the cursor inside
30+
await t.typeText(workbenchPage.queryInput, `${command} "query"`, { replace: true });
31+
await t.pressKey('left');
32+
//Check that user can see popover
33+
await t.expect(await workbenchPage.monacoWidget.textContent).contains('Use Cypher Editor', 'The user can see popover Use Cypher Syntax');
34+
await t.expect(await workbenchPage.monacoWidget.textContent).contains('Shift+Space', 'The user can see shortcut for Cypher Syntax');
35+
//Verify the popover with single quotes
36+
await t.typeText(workbenchPage.queryInput, `${command} ''`, { replace: true });
37+
await t.pressKey('left');
38+
await t.expect(await workbenchPage.monacoWidget.textContent).contains('Use Cypher Editor', 'The user can see popover Use Cypher Syntax');
39+
});
40+
test
41+
.meta({ rte: rte.standalone })
42+
.after(async() => {
43+
//Delete database
44+
await deleteDatabase(ossStandaloneConfig.databaseName);
45+
})
46+
('Verify that when user clicks on the “X” control or use keyboard shortcut “ESC” popover Editor is closed and changes are not saved', async t => {
47+
const command = 'GRAPH.QUERY graph "query"';
48+
//Type command and open the popover editor
49+
await t.typeText(workbenchPage.queryInput, command, { replace: true });
50+
await t.pressKey('left');
51+
await t.click(workbenchPage.monacoWidget);
52+
//Do some changes in the Editor and close by “X” control
53+
await t.typeText(workbenchPage.queryInput.nth(1), 'test', { replace: true });
54+
await t.click(workbenchPage.cancelButton);
55+
//Verify that editor is closed and changes are not saved
56+
let commandAfter = await workbenchPage.scriptsLines.textContent;
57+
await t.expect(workbenchPage.queryInput.nth(1).exists).notOk('The popover Editor is closed');
58+
await t.expect(commandAfter.replace(/\s/g, ' ')).eql(command, 'The changes are not saved from the Editor');
59+
//Re-open the Editor and do some changes and close by shortcut “ESC”
60+
await t.click(workbenchPage.monacoWidget);
61+
await t.typeText(workbenchPage.queryInput.nth(1), 'test', { replace: true });
62+
await t.pressKey('esc');
63+
//Verify that editor is closed and changes are not saved
64+
commandAfter = await workbenchPage.scriptsLines.textContent;
65+
await t.expect(commandAfter.replace(/\s/g, ' ')).eql(command, 'The changes are not saved from the Editor');
66+
});
67+
test
68+
.meta({ rte: rte.standalone })
69+
.after(async() => {
70+
//Delete database
71+
await deleteDatabase(ossStandaloneConfig.databaseName);
72+
})
73+
('Verify that when user use keyboard shortcut “CTRL+ENTER” or clicks on the “V” control popover Editor is closed and changes are saved, converted to Redis syntax and inserted back to the Editor', async t => {
74+
let script = 'query';
75+
const command = 'GRAPH.QUERY graph';
76+
//Type command and open the popover editor
77+
await t.typeText(workbenchPage.queryInput, `${command} "${script}`, { replace: true });
78+
await t.pressKey('left');
79+
await t.click(workbenchPage.monacoWidget);
80+
//Do some changes in the Editor and click on the “V” control
81+
script = 'test';
82+
await t.pressKey('ctrl+a');
83+
await t.typeText(workbenchPage.queryInput.nth(1), script, { replace: true });
84+
await t.click(workbenchPage.applyButton);
85+
//Verify that editor is closed and changes are saved
86+
let commandAfter = await workbenchPage.scriptsLines.textContent;
87+
await t.expect(workbenchPage.queryInput.nth(1).exists).notOk('The popover Editor is closed');
88+
await t.expect(commandAfter.replace(/\s/g, ' ')).eql(`${command} "${script}"`, 'The changes are not saved from the Editor');
89+
//Re-open the Editor and do some changes and use keyboard shortcut “CTRL+ENTER”
90+
await t.click(workbenchPage.monacoWidget);
91+
script = 'test2';
92+
await t.pressKey('ctrl+a');
93+
await t.typeText(workbenchPage.queryInput.nth(1), 'test2', { paste: true, replace: true });
94+
await t.pressKey('ctrl+enter');
95+
//Verify that editor is closed and changes are not saved
96+
commandAfter = await workbenchPage.scriptsLines.textContent;
97+
await t.expect(commandAfter.replace(/\s/g, ' ')).eql(`${command} "${script}"`, 'The changes are not saved from the Editor');
98+
});

0 commit comments

Comments
 (0)