|
| 1 | +import { addNewStandaloneDatabase } from '../../../helpers/database'; |
| 2 | +import { WorkbenchPage } from '../../../pageObjects/workbench-page'; |
| 3 | +import { MyRedisDatabasePage, UserAgreementPage, AddRedisDatabasePage } 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 | +const indexName = 'idx'; |
| 15 | +const commandsForIndex = [ |
| 16 | + `FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA price NUMERIC SORTABLE`, |
| 17 | + 'HMSET product:1 price 20', |
| 18 | + 'HMSET product:2 price 100' |
| 19 | +]; |
| 20 | + |
| 21 | +fixture `Command results at Workbench` |
| 22 | + .meta({type: 'regression'}) |
| 23 | + .page(commonUrl) |
| 24 | + .beforeEach(async t => { |
| 25 | + await t.maximizeWindow(); |
| 26 | + await userAgreementPage.acceptLicenseTerms(); |
| 27 | + await t.expect(addRedisDatabasePage.addDatabaseButton.exists).ok('The add redis database view', {timeout: 20000}); |
| 28 | + await addNewStandaloneDatabase(ossStandaloneConfig); |
| 29 | + //Connect to DB |
| 30 | + await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName); |
| 31 | + //Add index and data |
| 32 | + await t.click(myRedisDatabasePage.workbenchButton); |
| 33 | + for(let command of commandsForIndex) { |
| 34 | + await workbenchPage.sendCommandInWorkbench(command); |
| 35 | + } |
| 36 | + }) |
| 37 | + .afterEach(async t => { |
| 38 | + //Drop index and dbs |
| 39 | + await workbenchPage.sendCommandInWorkbench('FT.DROPINDEX products DD'); |
| 40 | + await myRedisDatabasePage.deleteAllDatabases(); |
| 41 | + }) |
| 42 | +//skipped due the inaccessibility of the iframe |
| 43 | +test.skip('Verify that user can switches between Table and Text for FT.INFO and see results corresponding to their views', async t => { |
| 44 | + const infoCommand = `FT.INFO ${indexName}`; |
| 45 | + //Send FT.INFO and switch to Text view |
| 46 | + await workbenchPage.sendCommandInWorkbench(infoCommand); |
| 47 | + await workbenchPage.selectViewTypeText(); |
| 48 | + await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).exists).ok(`The text view is switched for command FT.INFO`); |
| 49 | + //Switch to Table view and check result |
| 50 | + await workbenchPage.selectViewTypeTable(); |
| 51 | + await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTableResult).exists).ok(`The table view is switched for command FT.INFO`); |
| 52 | +}); |
| 53 | +//skipped due the inaccessibility of the iframe |
| 54 | +test.skip('Verify that user can switches between Table and Text for FT.SEARCH and see results corresponding to their views', async t => { |
| 55 | + const searchCommand = `FT.SEARCH ${indexName} *`; |
| 56 | + //Send FT.SEARCH and switch to Text view |
| 57 | + await workbenchPage.sendCommandInWorkbench(searchCommand); |
| 58 | + await workbenchPage.selectViewTypeText(); |
| 59 | + await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).visible).ok(`The text view is switched for command FT.SEARCH`); |
| 60 | + //Switch to Table view and check result |
| 61 | + await workbenchPage.selectViewTypeTable(); |
| 62 | + await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTableResult).exists).ok(`The table view is switched for command FT.SEARCH`); |
| 63 | +}); |
| 64 | +//skipped due the inaccessibility of the iframe |
| 65 | +test.skip('Verify that user can switches between Table and Text for FT.AGGREGATE and see results corresponding to their views', async t => { |
| 66 | + const aggregateCommand = `FT.Aggregate ${indexName} * GROUPBY 0 REDUCE MAX 1 @price AS max_price`; |
| 67 | + //Send FT.AGGREGATE and switch to Text view |
| 68 | + await workbenchPage.sendCommandInWorkbench(aggregateCommand); |
| 69 | + await workbenchPage.selectViewTypeText(); |
| 70 | + await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).visible).ok(`The text view is switched for command FT.AGGREGATE`); |
| 71 | + //Switch to Table view and check result |
| 72 | + await workbenchPage.selectViewTypeTable(); |
| 73 | + await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTableResult).exists).ok(`The table view is switched for command FT.AGGREGATE`); |
| 74 | +}); |
0 commit comments