Skip to content

Commit f47e55f

Browse files
e2e tests for logical dbs and overview
1 parent d0dfda3 commit f47e55f

File tree

5 files changed

+115
-0
lines changed

5 files changed

+115
-0
lines changed

tests/e2e/pageObjects/add-redis-database-page.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export class AddRedisDatabasePage {
2525
showDatabasesButton: Selector
2626
selectAllCheckbox: Selector
2727
welcomePageTitle: Selector
28+
databaseIndexCheckbox: Selector
29+
databaseIndexInput: Selector
2830
secretKeyInput: Selector;
2931

3032
constructor() {
@@ -45,6 +47,7 @@ export class AddRedisDatabasePage {
4547
this.showDatabasesButton = Selector('[data-testid=btn-show-databases]');
4648
this.databaseName = Selector('.euiTableCellContent.column_name');
4749
this.selectAllCheckbox = Selector('[data-test-subj=checkboxSelectAll]');
50+
this.databaseIndexCheckbox = Selector('[data-testid=showDb]~div');
4851
//TEXT INPUTS (also referred to as 'Text fields')
4952
this.hostInput = Selector('[data-testid=host]');
5053
this.portInput = Selector('[data-testid=port]');
@@ -55,6 +58,7 @@ export class AddRedisDatabasePage {
5558
this.accessKeyInput = Selector('[data-testid=access-key]');
5659
this.secretKeyInput = Selector('[data-testid=secret-key]');
5760
this.welcomePageTitle = Selector('[data-testid=welcome-page-title]');
61+
this.databaseIndexInput = Selector('[data-testid=db]');
5862
}
5963

6064
/**

tests/e2e/pageObjects/browser-page.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ export class BrowserPage {
105105
keysTotalNumber: Selector
106106
overviewTotalKeys: Selector
107107
overviewTotalMemory: Selector
108+
overviewConnectedClients: Selector
108109
selectedFilterTypeString: Selector
110+
overviewCommandsSec: Selector
111+
overviewCpu: Selector
109112
modulesButton: Selector
110113

111114
constructor() {
@@ -214,6 +217,9 @@ export class BrowserPage {
214217
this.keysTotalNumber = Selector('[data-testid=keys-total]');
215218
this.overviewTotalKeys = Selector('[data-test-subj=overview-total-keys]');
216219
this.overviewTotalMemory = Selector('[data-test-subj=overview-total-memory]');
220+
this.overviewConnectedClients = Selector('[data-test-subj=overview-connected-clients]');
221+
this.overviewCommandsSec = Selector('[data-test-subj=overview-commands-sec]');
222+
this.overviewCpu = Selector('[data-test-subj=overview-cpu]');
217223
this.selectedFilterTypeString = Selector('[data-testid=filter-option-type-selected-string]');
218224
}
219225

tests/e2e/tests/critical-path/browser/database-overview.e2e.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,23 @@ test('Verify that user can see total memory rounded in format B, KB, MB, GB, TB
127127
await t.wait(fiveSecondsTimeout);
128128
await t.expect(browserPage.overviewTotalMemory.textContent).contains('MB', 'Total memory value is MB');
129129
});
130+
test('Verify that user can see additional information in Overview: Connected Clients, Commands/Sec, CPU (%) using Standalone DB connection type', async t => {
131+
//Connect to DB
132+
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
133+
const cpuBeforeEdit = await browserPage.overviewCpu.textContent;
134+
const commandsSecBeforeEdit = await browserPage.overviewCommandsSec.textContent;
135+
//Verify that additional information in Overview: Connected Clients, Commands/Sec, CPU (%) is displayed
136+
await t.expect(browserPage.overviewConnectedClients.visible).ok('Connected Clients is dispalyed in the Overview');
137+
await t.expect(browserPage.overviewCommandsSec.visible).ok('Commands/Sec is dispalyed in the Overview');
138+
await t.expect(browserPage.overviewCpu.visible).ok('CPU (%) is dispalyed in the Overview');
139+
//Add 1M keys
140+
for(let i = 0; i < 10; i++) {
141+
await cliPage.addKeysFromCli('MSET', 100000, `keyName${i}`);
142+
}
143+
//Verify that CPU and commands per second parameters are changed
144+
const cpuAfterEdit = await browserPage.overviewCpu.textContent;
145+
const commandsSecAfterEdit = await browserPage.overviewCommandsSec.textContent;
146+
147+
await t.expect(cpuAfterEdit).notEql(cpuBeforeEdit, 'CPU parameter is changed');
148+
await t.expect(commandsSecAfterEdit).notEql(commandsSecBeforeEdit, 'Commands per second parameter is changed');
149+
});
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import {
2+
MyRedisDatabasePage,
3+
UserAgreementPage,
4+
AddRedisDatabasePage
5+
} from '../../../pageObjects';
6+
import {
7+
commonUrl,
8+
ossStandaloneConfig
9+
} from '../../../helpers/conf';
10+
11+
const userAgreementPage = new UserAgreementPage();
12+
const addRedisDatabasePage = new AddRedisDatabasePage();
13+
const myRedisDatabasePage = new MyRedisDatabasePage();
14+
15+
fixture `Logical databases`
16+
.meta({ type: 'critical_path' })
17+
.page(commonUrl)
18+
.beforeEach(async t => {
19+
await t.maximizeWindow();
20+
await userAgreementPage.acceptLicenseTerms();
21+
await myRedisDatabasePage.deleteAllDatabases();
22+
await t.expect(addRedisDatabasePage.addDatabaseButton.exists).ok('The add redis database view', { timeout: 20000 });
23+
})
24+
test('Verify that user can add DB with logical index via host and port from Add DB manually form', async t => {
25+
const index = '0';
26+
await addRedisDatabasePage.addRedisDataBase(ossStandaloneConfig);
27+
//Enter logical index
28+
await t.click(addRedisDatabasePage.databaseIndexCheckbox);
29+
await t.typeText(addRedisDatabasePage.databaseIndexInput, index, { paste: true });
30+
//Click for saving
31+
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
32+
//Verify that the database is in the list
33+
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossStandaloneConfig.databaseName).exists).ok('The existence of the database', { timeout: 60000 });
34+
});
35+
test('Verify that if user adds DB with logical DB >0, DB name contains postfix "space+[{database index}]"', async t => {
36+
const index = '10';
37+
await addRedisDatabasePage.addRedisDataBase(ossStandaloneConfig);
38+
//Enter logical index
39+
await t.click(addRedisDatabasePage.databaseIndexCheckbox);
40+
await t.typeText(addRedisDatabasePage.databaseIndexInput, index, { paste: true });
41+
//Click for saving
42+
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
43+
//Verify that the database name contains postfix
44+
await t.expect(myRedisDatabasePage.dbNameList.textContent).eql(`${ossStandaloneConfig.databaseName} [${index}]`, 'The postfix is added to the database name', { timeout: 60000 });
45+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import {
2+
MyRedisDatabasePage,
3+
UserAgreementPage,
4+
CliPage,
5+
AddRedisDatabasePage
6+
} from '../../../pageObjects';
7+
import {
8+
commonUrl,
9+
ossStandaloneConfig
10+
} from '../../../helpers/conf';
11+
12+
const userAgreementPage = new UserAgreementPage();
13+
const cliPage = new CliPage();
14+
const addRedisDatabasePage = new AddRedisDatabasePage();
15+
const myRedisDatabasePage = new MyRedisDatabasePage();
16+
17+
fixture `Logical databases`
18+
.meta({ type: 'regression' })
19+
.page(commonUrl)
20+
.beforeEach(async t => {
21+
await t.maximizeWindow();
22+
await userAgreementPage.acceptLicenseTerms();
23+
await myRedisDatabasePage.deleteAllDatabases();
24+
await t.expect(addRedisDatabasePage.addDatabaseButton.exists).ok('The add redis database view', { timeout: 20000 });
25+
})
26+
test('Verify that if user enters any index of the logical database that does not exist in the database, he can see Redis error "ERR DB index is out of range" and cannot proceed', async t => {
27+
const index = '0';
28+
//Add database with logical index
29+
await addRedisDatabasePage.addRedisDataBase(ossStandaloneConfig);
30+
await t.click(addRedisDatabasePage.databaseIndexCheckbox);
31+
await t.typeText(addRedisDatabasePage.databaseIndexInput, index, { paste: true });
32+
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
33+
//Open database and run command with non-existing index
34+
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
35+
await t.click(cliPage.cliExpandButton);
36+
await t.typeText(cliPage.cliCommandInput, 'Select 19', { paste: true });
37+
await t.pressKey('enter');
38+
//Verify the error
39+
await t.expect(cliPage.cliOutputResponseFail.textContent).eql('ERR DB index is out of range', 'Error is dispalyed in CLI');
40+
});

0 commit comments

Comments
 (0)