|
| 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 | + ('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 => { |
| 24 | + const command = 'GRAPH.QUERY graph'; |
| 25 | + //Type command and put the cursor inside |
| 26 | + await t.typeText(workbenchPage.queryInput, `${command} "query"`, { replace: true }); |
| 27 | + await t.pressKey('left'); |
| 28 | + //Check that user can see popover |
| 29 | + await t.expect(await workbenchPage.monacoWidget.textContent).contains('Use Cypher Editor', 'The user can see popover Use Cypher Syntax'); |
| 30 | + await t.expect(await workbenchPage.monacoWidget.textContent).contains('Shift+Space', 'The user can see shortcut for Cypher Syntax'); |
| 31 | + //Verify the popover with single quotes |
| 32 | + await t.typeText(workbenchPage.queryInput, `${command} ''`, { replace: true }); |
| 33 | + await t.pressKey('left'); |
| 34 | + await t.expect(await workbenchPage.monacoWidget.textContent).contains('Use Cypher Editor', 'The user can see popover Use Cypher Syntax'); |
| 35 | + }); |
| 36 | +test |
| 37 | + .meta({ rte: rte.standalone }) |
| 38 | + ('Verify that when user clicks on the “X” control or use shortcut “ESC” popover Editor is closed and changes are not saved', async t => { |
| 39 | + const command = 'GRAPH.QUERY graph "query"'; |
| 40 | + //Type command and open the popover editor |
| 41 | + await t.typeText(workbenchPage.queryInput, command, { replace: true }); |
| 42 | + await t.pressKey('left'); |
| 43 | + await t.click(workbenchPage.monacoWidget); |
| 44 | + //Do some changes in the Editor and close by “X” control |
| 45 | + await t.typeText(workbenchPage.queryInput.nth(1), 'test', { replace: true }); |
| 46 | + await t.click(workbenchPage.cancelButton); |
| 47 | + //Verify that editor is closed and changes are not saved |
| 48 | + let commandAfter = await workbenchPage.scriptsLines.textContent; |
| 49 | + await t.expect(workbenchPage.queryInput.nth(1).exists).notOk('The popover Editor is closed'); |
| 50 | + await t.expect(commandAfter.replace(/\s/g, ' ')).eql(command, 'The changes are not saved from the Editor'); |
| 51 | + //Re-open the Editor and do some changes and close by shortcut “ESC” |
| 52 | + await t.click(workbenchPage.monacoWidget); |
| 53 | + await t.typeText(workbenchPage.queryInput.nth(1), 'test', { replace: true }); |
| 54 | + await t.pressKey('esc'); |
| 55 | + //Verify that editor is closed and changes are not saved |
| 56 | + commandAfter = await workbenchPage.scriptsLines.textContent; |
| 57 | + await t.expect(commandAfter.replace(/\s/g, ' ')).eql(command, 'The changes are not saved from the Editor'); |
| 58 | + }); |
| 59 | +test |
| 60 | + .meta({ rte: rte.standalone }) |
| 61 | + ('Verify that when user use shortcut “CTRL+ENTER” or clicks on the “V” control popover Editor is closed and changes are saved', async t => { |
| 62 | + let script = 'query'; |
| 63 | + const command = 'GRAPH.QUERY graph'; |
| 64 | + //Type command and open the popover editor |
| 65 | + await t.typeText(workbenchPage.queryInput, `${command} "${script}`, { replace: true }); |
| 66 | + await t.pressKey('left'); |
| 67 | + await t.click(workbenchPage.monacoWidget); |
| 68 | + //Do some changes in the Editor and click on the “V” control |
| 69 | + script = 'test'; |
| 70 | + await t.pressKey('ctrl+a'); |
| 71 | + await t.typeText(workbenchPage.queryInput.nth(1), script, { replace: true }); |
| 72 | + await t.click(workbenchPage.applyButton); |
| 73 | + //Verify that editor is closed and changes are saved |
| 74 | + let commandAfter = await workbenchPage.scriptsLines.textContent; |
| 75 | + await t.expect(workbenchPage.queryInput.nth(1).exists).notOk('The popover Editor is closed'); |
| 76 | + await t.expect(commandAfter.replace(/\s/g, ' ')).eql(`${command} "${script}"`, 'The changes are not saved from the Editor'); |
| 77 | + //Re-open the Editor and do some changes and use keyboard shortcut “CTRL+ENTER” |
| 78 | + await t.click(workbenchPage.monacoWidget); |
| 79 | + script = 'test2'; |
| 80 | + await t.pressKey('ctrl+a'); |
| 81 | + await t.typeText(workbenchPage.queryInput.nth(1), 'test2', { paste: true, replace: true }); |
| 82 | + await t.pressKey('ctrl+enter'); |
| 83 | + //Verify that editor is closed and changes are not saved |
| 84 | + commandAfter = await workbenchPage.scriptsLines.textContent; |
| 85 | + await t.expect(commandAfter.replace(/\s/g, ' ')).eql(`${command} "${script}"`, 'The changes are not saved from the Editor'); |
| 86 | + }); |
0 commit comments