Skip to content

Commit 46a587a

Browse files
authored
Merge pull request #1675 from RedisInsight/e2e/feature/RI-4069_client-list
E2e/feature/ri 4069 client list
2 parents aa83cd2 + b078fac commit 46a587a

File tree

4 files changed

+75
-6
lines changed

4 files changed

+75
-6
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {t, Selector} from 'testcafe';
2+
import { WorkbenchPage } from '../pageObjects';
3+
4+
const workbenchPage = new WorkbenchPage();
5+
6+
export class WorkbenchActions {
7+
/**
8+
Verify after client list command columns are visible
9+
@param columns List of columns to verify
10+
*/
11+
async verifyClientListColumnsAreVisible(columns: string[]): Promise<void> {
12+
await t.switchToIframe(workbenchPage.iframe);
13+
for (const column of columns) {
14+
const columnSelector = Selector(`[data-test-subj^=tableHeaderCell_${column}_]`);
15+
await t.expect(columnSelector.visible).ok(`${column} column is not visible`);
16+
}
17+
await t.switchToMainWindow();
18+
}
19+
/**
20+
Verify after `client list` command table rows are expected count
21+
*/
22+
async verifyClientListTableViewRowCount(): Promise<void>{
23+
await t.click(workbenchPage.selectViewType)
24+
.click(workbenchPage.viewTypeOptionsText);
25+
// get number of rows from text view
26+
const numberOfRowsInTextView = await Selector('[data-testid^=row-]').count - 1;
27+
// select client list table view
28+
await t.click(workbenchPage.selectViewType)
29+
.click(workbenchPage.viewTypeOptionClientList);
30+
await t.switchToIframe(workbenchPage.iframe);
31+
await t.expect(Selector('tbody tr').count).eql(numberOfRowsInTextView);
32+
}
33+
/**
34+
Verify error message after `client list` command if there is no permission to run
35+
*/
36+
async verifyClientListErrorMessage(): Promise<void>{
37+
await t.switchToIframe(workbenchPage.iframe);
38+
await t.expect(Selector('div').withText('NOPERM this user has no permissions to run the \'client\' command or its subcommand').visible)
39+
.ok('NOPERM error message is not displayed');
40+
await t.switchToMainWindow();
41+
}
42+
}

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ export class WorkbenchPage {
140140
textViewTypeOption = Selector('[data-test-subj^=view-type-option-Text]');
141141
tableViewTypeOption = Selector('[data-test-subj^=view-type-option-Plugin]');
142142
graphViewTypeOption = Selector('[data-test-subj^=view-type-option-Plugin-graph]');
143-
143+
typeSelectedClientsList = Selector('[data-testid=view-type-selected-Plugin-client-list__clients-list]');
144+
viewTypeOptionClientList = Selector('[data-test-subj=view-type-option-Plugin-client-list__clients-list]');
145+
viewTypeOptionsText = Selector('[data-test-subj=view-type-option-Text-default__Text]');
144146
/**
145147
* Get card container by command
146148
* @param command The command

tests/e2e/tests/regression/monitor/monitor.e2e.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
MonitorPage,
66
SettingsPage,
77
BrowserPage,
8-
CliPage
8+
CliPage, WorkbenchPage
99
} from '../../../pageObjects';
1010
import {
1111
commonUrl,
@@ -16,6 +16,7 @@ import {
1616
import { rte } from '../../../helpers/constants';
1717
import { addNewStandaloneDatabaseApi, deleteStandaloneDatabaseApi, deleteStandaloneDatabasesApi } from '../../../helpers/api/api-database';
1818
import { Common } from '../../../helpers/common';
19+
import {WorkbenchActions} from '../../../common-actions/workbench-actions';
1920

2021
const myRedisDatabasePage = new MyRedisDatabasePage();
2122
const monitorPage = new MonitorPage();
@@ -24,6 +25,8 @@ const browserPage = new BrowserPage();
2425
const cliPage = new CliPage();
2526
const chance = new Chance();
2627
const common = new Common();
28+
const workbenchPage = new WorkbenchPage();
29+
const workbencActions = new WorkbenchActions();
2730

2831
fixture `Monitor`
2932
.meta({ type: 'regression', rte: rte.standalone })
@@ -115,11 +118,11 @@ test
115118
await t.expect(previousTimestamp).notEql(nextTimestamp, 'Monitor results not correct');
116119
}
117120
});
118-
// Skipped due to redis issue https://redislabs.atlassian.net/browse/RI-4111
121+
// Skipped due to redis issue https://redislabs.atlassian.net/browse/RI-4111
119122
test.skip
120123
.before(async t => {
121124
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName);
122-
await cliPage.sendCommandInCli('acl setuser noperm nopass on +@all ~* -monitor');
125+
await cliPage.sendCommandInCli('acl setuser noperm nopass on +@all ~* -monitor -client');
123126
// Check command result in CLI
124127
await t.click(cliPage.cliExpandButton);
125128
await t.expect(cliPage.cliOutputResponseSuccess.textContent).eql('"OK"', 'Command from autocomplete was not found & executed');
@@ -137,6 +140,7 @@ test.skip
137140
// Delete database
138141
await deleteStandaloneDatabasesApi([ossStandaloneConfig, ossStandaloneNoPermissionsConfig]);
139142
})('Verify that if user doesn\'t have permissions to run monitor, user can see error message', async t => {
143+
const command = 'CLIENT LIST';
140144
// Expand the Profiler
141145
await t.click(monitorPage.expandMonitor);
142146
// Click on run monitor button
@@ -147,4 +151,8 @@ test.skip
147151
await t.expect(monitorPage.monitorNoPermissionsMessage.innerText).eql('The Profiler cannot be started. This user has no permissions to run the \'monitor\' command', 'No Permissions message not found');
148152
// Verify that if user doesn't have permissions to run monitor, run monitor button is not available
149153
await t.expect(monitorPage.runMonitorToggle.withAttribute('disabled').exists).ok('No permissions run icon not found');
154+
await t.click(myRedisDatabasePage.workbenchButton);
155+
await workbenchPage.sendCommandInWorkbench(command);
156+
// Verify that user have the following error when there is no permission to run the CLIENT LIST: "NOPERM this user has no permissions to run the 'CLIENT LIST' command or its subcommand"
157+
await workbencActions.verifyClientListErrorMessage();
150158
});

tests/e2e/tests/regression/workbench/command-results.e2e.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
2-
import { WorkbenchPage } from '../../../pageObjects/workbench-page';
3-
import { MyRedisDatabasePage } from '../../../pageObjects';
2+
import { WorkbenchPage, MyRedisDatabasePage } from '../../../pageObjects';
43
import {
54
commonUrl,
65
ossStandaloneRedisearch
76
} from '../../../helpers/conf';
87
import { env, rte } from '../../../helpers/constants';
98
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
109
import { Common } from '../../../helpers/common';
10+
import {WorkbenchActions} from '../../../common-actions/workbench-actions';
1111

1212
const myRedisDatabasePage = new MyRedisDatabasePage();
1313
const workbenchPage = new WorkbenchPage();
14+
const workBenchActions = new WorkbenchActions();
1415
const common = new Common();
1516

1617
const indexName = common.generateWord(5);
@@ -117,3 +118,19 @@ test('Big output in workbench is visible in virtualized table', async t => {
117118
// Verify that all commands scrolled
118119
await t.expect(lastExpectedItem.visible).ok('Final execution time message not displayed');
119120
});
121+
122+
test.before(async t => {
123+
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneRedisearch, ossStandaloneRedisearch.databaseName);
124+
await t.click(myRedisDatabasePage.workbenchButton);
125+
}).after(async t => {
126+
await t.switchToMainWindow();
127+
await deleteStandaloneDatabaseApi(ossStandaloneRedisearch);
128+
})('Verify that user can see the client List visualization available for all users', async t => {
129+
const command = 'CLIENT LIST';
130+
// Send command in workbench to view client list
131+
await workbenchPage.sendCommandInWorkbench(command);
132+
await t.expect(workbenchPage.typeSelectedClientsList.visible).ok('client list view button is not visible');
133+
await workBenchActions.verifyClientListColumnsAreVisible(['id', 'addr', 'name', 'user']);
134+
// verify table view row count match with text view after client list command
135+
await workBenchActions.verifyClientListTableViewRowCount();
136+
});

0 commit comments

Comments
 (0)