Skip to content

Commit 68a91ef

Browse files
authored
Merge pull request #59 from RedisInsight/feature/e2e-command-helper
Command Helper E2E tests
2 parents ca67183 + e0e5fe2 commit 68a91ef

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

tests/e2e/pageObjects/cli-page.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export class CliPage {
3232
cliCommandAutocomplete: Selector
3333
cliResizeButton: Selector
3434
cliCommandExecuted: Selector
35+
cliReadMoreJSONCommandDocumentation: Selector
36+
cliReadMoreRediSearchCommandDocumentation: Selector
3537

3638
constructor() {
3739
//-------------------------------------------------------------------------------------------
@@ -64,6 +66,8 @@ export class CliPage {
6466
this.cliCommandAutocomplete = Selector('[data-testid=cli-command-autocomplete]');
6567
this.cliResizeButton = Selector('[data-test-subj=resize-btn-browser-cli]');
6668
this.cliCommandExecuted = Selector('[data-testid=cli-command-wrapper]');
69+
this.cliReadMoreJSONCommandDocumentation = Selector('[id=jsonset]');
70+
this.cliReadMoreRediSearchCommandDocumentation = Selector('[id=ftexplain]');
6771
}
6872
/**
6973
* Select filter group type
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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

Comments
 (0)