|
| 1 | +import { ClientFunction } from 'testcafe'; |
| 2 | +import { addNewStandaloneDatabase } from '../../../helpers/database' |
| 3 | +import { |
| 4 | + MyRedisDatabasePage, |
| 5 | + UserAgreementPage, |
| 6 | + CliPage, |
| 7 | + AddRedisDatabasePage |
| 8 | +} from '../../../pageObjects'; |
| 9 | +import { |
| 10 | + commonUrl, |
| 11 | + ossStandaloneConfig |
| 12 | +} from '../../../helpers/conf'; |
| 13 | + |
| 14 | +const myRedisDatabasePage = new MyRedisDatabasePage(); |
| 15 | +const cliPage = new CliPage(); |
| 16 | +const userAgreementPage = new UserAgreementPage(); |
| 17 | +const addRedisDatabasePage = new AddRedisDatabasePage(); |
| 18 | +const COMMAND_GROUP_JSON = 'JSON'; |
| 19 | +const COMMAND_GROUP_SEARCH = 'Search'; |
| 20 | + |
| 21 | +fixture `CLI Command helper` |
| 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 | + }) |
| 30 | + |
| 31 | +const getPageUrl = ClientFunction(() => window.location.href); |
| 32 | + |
| 33 | +test('Verify that user can see in Command helper and click on new group "JSON", can choose it and see list of commands in the group', async t => { |
| 34 | + const commandForCheck = 'JSON.SET'; |
| 35 | + await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName); |
| 36 | + //Open CLI |
| 37 | + await t.click(cliPage.cliExpandButton); |
| 38 | + //Select one command from the list |
| 39 | + await cliPage.selectFilterGroupType(COMMAND_GROUP_JSON); |
| 40 | + await t.click(cliPage.cliHelperOutputTitles.withExactText(commandForCheck)); |
| 41 | + //Verify results of opened command |
| 42 | + await t.expect(cliPage.cliHelperTitleArgs.textContent).eql('JSON.SET key path value [NX|XX]', 'Selected command title'); |
| 43 | + //Click on Read More link for selected command |
| 44 | + await t.click(cliPage.readMoreButton); |
| 45 | + //Check new opened window page with the correct URL |
| 46 | + await t.expect(getPageUrl()).contains('/#jsonset'); |
| 47 | + //Check that command info is displayed on the page |
| 48 | + await t.expect(cliPage.cliReadMoreJSONCommandDocumentation().textContent).contains('JSON.SET'); |
| 49 | +}); |
| 50 | + |
| 51 | +test('Verify that user can see in Command helper and click on new group "Search", can choose it and see list of commands in the group', async t => { |
| 52 | + const commandForCheck = 'FT.EXPLAIN'; |
| 53 | + await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName); |
| 54 | + //Open CLI |
| 55 | + await t.click(cliPage.cliExpandButton); |
| 56 | + //Select one command from the list |
| 57 | + await cliPage.selectFilterGroupType(COMMAND_GROUP_SEARCH); |
| 58 | + await t.click(cliPage.cliHelperOutputTitles.withExactText(commandForCheck)); |
| 59 | + //Verify results of opened command |
| 60 | + await t.expect(cliPage.cliHelperTitleArgs.textContent).eql('FT.EXPLAIN index query', 'Selected command title'); |
| 61 | + //Click on Read More link for selected command |
| 62 | + await t.click(cliPage.readMoreButton); |
| 63 | + //Check new opened window page with the correct URL |
| 64 | + await t.expect(getPageUrl()).contains('/#ftexplain'); |
| 65 | + //Check that command info is displayed on the page |
| 66 | + await t.expect(cliPage.cliReadMoreRediSearchCommandDocumentation().textContent).contains('FT.EXPLAIN'); |
| 67 | +}); |
0 commit comments