From 1afbd7c7106d668161cdd9b42d3ef24ecb065ad0 Mon Sep 17 00:00:00 2001 From: Elena Naboko Date: Mon, 29 Nov 2021 20:44:43 +0300 Subject: [PATCH 1/2] New e2e tests added with JSON and RediSearch commands in Command helper --- tests/e2e/pageObjects/cli-page.ts | 4 ++ .../regression/cli/cli-command-helper.e2e.ts | 67 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts diff --git a/tests/e2e/pageObjects/cli-page.ts b/tests/e2e/pageObjects/cli-page.ts index 1bcbf5a4e2..be265ffe73 100644 --- a/tests/e2e/pageObjects/cli-page.ts +++ b/tests/e2e/pageObjects/cli-page.ts @@ -32,6 +32,8 @@ export class CliPage { cliCommandAutocomplete: Selector cliResizeButton: Selector cliCommandExecuted: Selector + cliReadMoreJSONCommandDocumentation: Selector + cliReadMoreRediSearchCommandDocumentation: Selector constructor() { //------------------------------------------------------------------------------------------- @@ -64,6 +66,8 @@ export class CliPage { this.cliCommandAutocomplete = Selector('[data-testid=cli-command-autocomplete]'); this.cliResizeButton = Selector('[data-test-subj=resize-btn-browser-cli]'); this.cliCommandExecuted = Selector('[data-testid=cli-command-wrapper]'); + this.cliReadMoreJSONCommandDocumentation = Selector('[id=jsonset]'); + this.cliReadMoreRediSearchCommandDocumentation = Selector('[id=ftexplain]'); } /** * Select filter group type diff --git a/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts b/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts new file mode 100644 index 0000000000..4792e6e540 --- /dev/null +++ b/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts @@ -0,0 +1,67 @@ +import { ClientFunction } from 'testcafe'; +import { addNewStandaloneDatabase } from '../../../helpers/database' +import { + MyRedisDatabasePage, + UserAgreementPage, + CliPage, + AddRedisDatabasePage +} from '../../../pageObjects'; +import { + commonUrl, + ossStandaloneConfig +} from '../../../helpers/conf'; + +const myRedisDatabasePage = new MyRedisDatabasePage(); +const cliPage = new CliPage(); +const userAgreementPage = new UserAgreementPage(); +const addRedisDatabasePage = new AddRedisDatabasePage(); +const COMMAND_GROUP_JSON = 'JSON'; +const COMMAND_GROUP_SEARCH = 'Search'; + +fixture `CLI Command helper` + .meta({ type: 'regression' }) + .page(commonUrl) + .beforeEach(async t => { + await t.maximizeWindow(); + await userAgreementPage.acceptLicenseTerms(); + await t.expect(addRedisDatabasePage.addDatabaseButton.exists).ok('The add redis database view', { timeout: 20000 }); + await addNewStandaloneDatabase(ossStandaloneConfig); + }) + +const getPageUrl = ClientFunction(() => window.location.href); + +test.only('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 => { + const commandForCheck = 'JSON.SET'; + await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName); + //Open CLI + await t.click(cliPage.cliExpandButton); + //Select one command from the list + await cliPage.selectFilterGroupType(COMMAND_GROUP_JSON); + await t.click(cliPage.cliHelperOutputTitles.withExactText(commandForCheck)); + //Verify results of opened command + await t.expect(cliPage.cliHelperTitleArgs.textContent).eql('JSON.SET key path value [NX|XX]', 'Selected command title'); + //Click on Read More link for selected command + await t.click(cliPage.readMoreButton); + //Check new opened window page with the correct URL + await t.expect(getPageUrl()).contains('/#jsonset'); + //Check that command info is displayed on the page + await t.expect(cliPage.cliReadMoreJSONCommandDocumentation().textContent).contains('JSON.SET'); +}); + +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 => { + const commandForCheck = 'FT.EXPLAIN'; + await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName); + //Open CLI + await t.click(cliPage.cliExpandButton); + //Select one command from the list + await cliPage.selectFilterGroupType(COMMAND_GROUP_SEARCH); + await t.click(cliPage.cliHelperOutputTitles.withExactText(commandForCheck)); + //Verify results of opened command + await t.expect(cliPage.cliHelperTitleArgs.textContent).eql('FT.EXPLAIN index query', 'Selected command title'); + //Click on Read More link for selected command + await t.click(cliPage.readMoreButton); + //Check new opened window page with the correct URL + await t.expect(getPageUrl()).contains('/#ftexplain'); + //Check that command info is displayed on the page + await t.expect(cliPage.cliReadMoreRediSearchCommandDocumentation().textContent).contains('FT.EXPLAIN'); +}); From e0e5fe293bb41ba1d0c6efee60501c9424221a4d Mon Sep 17 00:00:00 2001 From: Elena Naboko Date: Tue, 30 Nov 2021 11:32:42 +0300 Subject: [PATCH 2/2] Remove only from the test --- tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts b/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts index 4792e6e540..045e3c2497 100644 --- a/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts +++ b/tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts @@ -30,7 +30,7 @@ fixture `CLI Command helper` const getPageUrl = ClientFunction(() => window.location.href); -test.only('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 => { +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 => { const commandForCheck = 'JSON.SET'; await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName); //Open CLI