Skip to content

Commit 10c3e41

Browse files
committed
updates by pr comments
1 parent aa3a145 commit 10c3e41

File tree

4 files changed

+40
-29
lines changed

4 files changed

+40
-29
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { t } from 'testcafe';
2+
import { CliPage } from '../pageObjects';
3+
4+
const cliPage = new CliPage();
5+
6+
export class CliActions {
7+
8+
/**
9+
* Check list of commands searched
10+
* @param searchedCommand Searched command in Command Helper
11+
* @param listToCompare The list with commands to compare with opened in Command Helper
12+
*/
13+
async checkSearchedCommandInCommandHelper(searchedCommand: string, listToCompare: string[]): Promise<void> {
14+
await t.typeText(cliPage.cliHelperSearch, searchedCommand, { speed: 0.5 });
15+
//Verify results in the output
16+
const commandsCount = await cliPage.cliHelperOutputTitles.count;
17+
for (let i = 0; i < commandsCount; i++) {
18+
await t.expect(cliPage.cliHelperOutputTitles.nth(i).textContent).eql(listToCompare[i], 'Results in the output contains searched value');
19+
}
20+
}
21+
22+
/**
23+
* Check commands list
24+
* @param listToCompare The list with commands to compare with opened in Command Helper
25+
*/
26+
async checkCommandsInCommandHelper(listToCompare: string[]): Promise<void> {
27+
//Verify results in the output
28+
const commandsCount = await cliPage.cliHelperOutputTitles.count;
29+
for (let i = 0; i < commandsCount; i++) {
30+
await t.expect(cliPage.cliHelperOutputTitles.nth(i).textContent).eql(listToCompare[i], 'Results in the output not contain searched value');
31+
}
32+
}
33+
}

tests/e2e/pageObjects/cli-page.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -128,30 +128,4 @@ export class CliPage {
128128
await t.click(this.readMoreButton);
129129
await t.expect(getPageUrl()).eql(url, 'The opened page');
130130
}
131-
132-
/**
133-
* Check list of commands searched
134-
* @param searchedCommand Searched command in Command Helper
135-
* @param listToCompare The list with commands to compare with opened in Command Helper
136-
*/
137-
async checkSearchedCommandInCommandHelper(searchedCommand: string, listToCompare: string[]): Promise<void> {
138-
await t.typeText(this.cliHelperSearch, searchedCommand, { speed: 0.5 });
139-
//Verify results in the output
140-
const commandsCount = await this.cliHelperOutputTitles.count;
141-
for (let i = 0; i < commandsCount; i++) {
142-
await t.expect(this.cliHelperOutputTitles.nth(i).textContent).eql(listToCompare[i], 'Results in the output contains searched value');
143-
}
144-
}
145-
146-
/**
147-
* Check commands list
148-
* @param listToCompare The list with commands to compare with opened in Command Helper
149-
*/
150-
async checkCommandsInCommandHelper(listToCompare: string[]): Promise<void> {
151-
//Verify results in the output
152-
const commandsCount = await this.cliHelperOutputTitles.count;
153-
for (let i = 0; i < commandsCount; i++) {
154-
await t.expect(this.cliHelperOutputTitles.nth(i).textContent).eql(listToCompare[i], 'Results in the output not contain searched value');
155-
}
156-
}
157131
}

tests/e2e/tests/critical-path/cli/cli-command-helper.e2e.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
33
import { CliPage } from '../../../pageObjects';
44
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
55
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
6+
import { CliActions } from '../../../common-actions/cli-actions';
67

78
const cliPage = new CliPage();
9+
const cliActions = new CliActions();
810

911
const defaultHelperText = 'Enter any command in CLI or use search to see detailed information.';
1012
const COMMAND_APPEND = 'APPEND';
@@ -123,7 +125,7 @@ test
123125
//Unselect group from list
124126
await cliPage.selectFilterGroupType(COMMAND_GROUP_TIMESERIES);
125127
//Search per part of command and check all opened commands
126-
await cliPage.checkSearchedCommandInCommandHelper(commandForSearch, timeSeriesCommands);
128+
await cliActions.checkSearchedCommandInCommandHelper(commandForSearch, timeSeriesCommands);
127129
//Check the first command documentation url
128130
await cliPage.checkURLCommand(timeSeriesCommands[0], `https://redis.io/commands/${timeSeriesCommands[0].toLowerCase()}/`);
129131
await t.switchToParentWindow();
@@ -144,7 +146,7 @@ test
144146
//Unselect group from list
145147
await cliPage.selectFilterGroupType(COMMAND_GROUP_GRAPH);
146148
//Search per part of command and check all opened commands
147-
await cliPage.checkSearchedCommandInCommandHelper(commandForSearch, graphCommands);
149+
await cliActions.checkSearchedCommandInCommandHelper(commandForSearch, graphCommands);
148150
//Check the first command documentation url
149151
await cliPage.checkURLCommand(graphCommands[0], externalPageLink);
150152
await t.switchToParentWindow();

tests/e2e/tests/regression/cli/cli-command-helper.e2e.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import {
88
} from '../../../helpers/conf';
99
import { env, rte } from '../../../helpers/constants';
1010
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
11+
import { CliActions } from '../../../common-actions/cli-actions';
1112

1213
const cliPage = new CliPage();
1314
const common = new Common();
15+
const cliActions = new CliActions();
1416
let filteringGroup = '';
1517
let filteringGroups: string[] = [];
1618
let commandToCheck = '';
@@ -268,6 +270,6 @@ test
268270
// Click return button
269271
await t.click(cliPage.returnToList);
270272
// Check that user returned to list with filter and search applied
271-
await cliPage.checkCommandsInCommandHelper(filteredCommands);
273+
await cliActions.checkCommandsInCommandHelper(filteredCommands);
272274
await t.expect(cliPage.returnToList.exists).notOk('Return to list button still displayed');
273275
});

0 commit comments

Comments
 (0)