Skip to content

Commit d8a3a45

Browse files
authored
Merge pull request #1618 from RedisInsight/e2e/feature/RI-3997_display-indexes-in-workbench-and-analytics
E2E/RI-3997 display indexes in workbench and analytics
2 parents 3be5729 + 6084be4 commit d8a3a45

File tree

11 files changed

+67
-50
lines changed

11 files changed

+67
-50
lines changed

tests/e2e/pageObjects/my-redis-databases-page.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { t, Selector } from 'testcafe';
2+
import { getDatabaseByName } from '../helpers/api/api-database';
23

34
export class MyRedisDatabasePage {
45
//-------------------------------------------------------------------------------------------
@@ -187,18 +188,24 @@ export class MyRedisDatabasePage {
187188

188189
/**
189190
* Verify database status is visible
191+
* @param databaseName The name of the database
190192
*/
191-
async verifyDatabaseStatusIsVisible(): Promise<void> {
192-
await t.expect(Selector('div').withAttribute('data-testid', /database-status-new-*/).visible)
193-
.ok('Database status is not visible');
193+
async verifyDatabaseStatusIsVisible(databaseName: string): Promise<void> {
194+
const databaseId = await getDatabaseByName(databaseName);
195+
const databaseEditBtn = Selector(`[data-testid=database-status-new-${databaseId}]`);
196+
197+
await t.expect(databaseEditBtn.exists).ok(`Database status is not visible for ${databaseName}`);
194198
}
195199

196200
/**
197201
* Verify database status is not visible
202+
* @param databaseName The name of the database
198203
*/
199-
async verifyDatabaseStatusIsNotVisible(): Promise<void> {
200-
await t.expect(Selector('div').withAttribute('data-testid', /database-status-new-*/).visible)
201-
.notOk('Database status is still visible');
204+
async verifyDatabaseStatusIsNotVisible(databaseName: string): Promise<void> {
205+
const databaseId = await getDatabaseByName(databaseName);
206+
const databaseEditBtn = Selector(`[data-testid=database-status-new-${databaseId}]`);
207+
208+
await t.expect(databaseEditBtn.exists).notOk(`Database status is still visible for ${databaseName}`);
202209
}
203210

204211
/**

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ export class WorkbenchPage {
214214
async checkWorkbenchCommandResult(command: string, result: string, childNum = 0): Promise<void> {
215215
// Compare the command with executed command
216216
const actualCommand = await this.queryCardContainer.nth(childNum).find(this.cssQueryCardCommand).textContent;
217-
await t.expect(actualCommand).eql(command, 'Actual command is not equal to executed');
217+
await t.expect(actualCommand).contains(command, 'Actual command is not equal to executed');
218218
// Compare the command result with executed command
219219
const actualCommandResult = await this.queryCardContainer.nth(childNum).find(this.cssQueryTextResult).textContent;
220-
await t.expect(actualCommandResult).eql(result, 'Actual command result is not equal to executed');
220+
await t.expect(actualCommandResult).contains(result, 'Actual command result is not equal to executed');
221221
}
222222
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ test('Switching between indexed databases', async t => {
113113
// Open Workbench page
114114
await t.click(myRedisDatabasePage.workbenchButton);
115115
await workbenchPage.sendCommandInWorkbench(command);
116+
// Verify that user can see the database index before the command name executed in Workbench
117+
await workbenchPage.checkWorkbenchCommandResult(`[db1] ${command}`, '8');
118+
116119
// Open Browser page
117120
await t.click(myRedisDatabasePage.browserButton);
118121
// Clear filter
@@ -134,9 +137,16 @@ test('Switching between indexed databases', async t => {
134137
// Verify that data changed for indexed db on Database analysis page
135138
await t.expect(memoryEfficiencyPage.topKeysKeyName.withExactText(keyNames[0]).exists).ok('Keys from current db index not displayed in report');
136139
await t.expect(memoryEfficiencyPage.topKeysKeyName.withExactText(logicalDbKey).exists).notOk('Keys from other db index displayed in report');
140+
await t.expect(memoryEfficiencyPage.selectedReport.textContent).notContains('[db', 'Index displayed for 0 index in report name');
137141
// Change index to logical db
138142
await databaseOverviewPage.changeDbIndex(1);
139143
await t.click(memoryEfficiencyPage.newReportBtn);
144+
await t.expect(memoryEfficiencyPage.selectedReport.textContent).contains('[db1]', 'Index not displayed in report name');
140145
await t.expect(memoryEfficiencyPage.topKeysKeyName.withExactText(logicalDbKey).exists).ok('Keys from current db index not displayed in report');
141146
await t.expect(memoryEfficiencyPage.topKeysKeyName.withExactText(keyNames[0]).exists).notOk('Keys from other db index displayed in report');
147+
148+
// Verify that user can see the database index before the report date in Database Analysis
149+
await t.click(memoryEfficiencyPage.selectedReport);
150+
await t.expect(memoryEfficiencyPage.reportItem.nth(0).textContent).contains('[db1]', 'Index not displayed in report name');
151+
await t.expect(memoryEfficiencyPage.reportItem.nth(1).textContent).notContains('[db', 'Index displayed for 0 index in report name');
142152
});

tests/e2e/tests/critical-path/database/clone-databases.e2e.ts

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ fixture `Clone databases`
2121
.meta({ type: 'critical_path' })
2222
.page(commonUrl);
2323
test
24-
.before(async () => {
24+
.before(async() => {
2525
await acceptLicenseTerms();
2626
await addNewStandaloneDatabaseApi(ossStandaloneConfig);
2727
await common.reloadPage();
2828
})
29-
.after(async () => {
29+
.after(async() => {
3030
// Delete databases
3131
const dbNumber = await myRedisDatabasePage.dbNameList.withExactText(ossStandaloneConfig.databaseName).count;
3232
for (let i = 0; i < dbNumber; i++) {
@@ -37,10 +37,6 @@ test
3737
await clickOnEditDatabaseByName(ossStandaloneConfig.databaseName);
3838
// Verify that user can cancel the Clone by clicking the “Cancel” or the “x” button
3939
await t.click(addRedisDatabasePage.cloneDatabaseButton);
40-
41-
// Verify new connection badge for cloned database
42-
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
43-
4440
await t.click(addRedisDatabasePage.cancelButton);
4541
await t.expect(myRedisDatabasePage.editAliasButton.withText('Clone ').exists).notOk('Clone panel is still displayed', { timeout: 2000 });
4642
await clickOnEditDatabaseByName(ossStandaloneConfig.databaseName);
@@ -55,25 +51,24 @@ test
5551
// Verify that user can confirm the creation of the database by clicking “Clone Database”
5652
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
5753
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossStandaloneConfig.databaseName).count).eql(2, 'DB was not cloned');
54+
55+
// Verify new connection badge for cloned database
56+
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossStandaloneConfig.databaseName);
5857
});
5958
test
60-
.before(async () => {
59+
.before(async() => {
6160
await acceptLicenseTerms();
6261
await addNewOSSClusterDatabaseApi(ossClusterConfig);
6362
await common.reloadPage();
6463
})
65-
.after(async () => {
64+
.after(async() => {
6665
// Delete database
6766
await deleteOSSClusterDatabaseApi(ossClusterConfig);
6867
await myRedisDatabasePage.deleteDatabaseByName(newOssDatabaseAlias);
6968
})
7069
.meta({ rte: rte.ossCluster })('Verify that user can clone OSS Cluster', async t => {
7170
await clickOnEditDatabaseByName(ossClusterConfig.ossClusterDatabaseName);
7271
await t.click(addRedisDatabasePage.cloneDatabaseButton);
73-
74-
// New connections indicator
75-
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
76-
7772
await t
7873
.expect(myRedisDatabasePage.editAliasButton.withText('Clone ').exists).ok('Clone panel is not displayed')
7974
.expect(addRedisDatabasePage.portInput.getAttribute('value')).eql(ossClusterConfig.ossClusterPort, 'Wrong port value')
@@ -83,15 +78,18 @@ test
8378
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
8479
await t.expect(myRedisDatabasePage.dbNameList.withExactText(newOssDatabaseAlias).exists).ok('DB was not closed');
8580
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossClusterConfig.ossClusterDatabaseName).exists).ok('Original DB is not displayed');
81+
82+
// New connections indicator
83+
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossClusterConfig.ossClusterDatabaseName);
8684
});
8785
test
88-
.before(async () => {
86+
.before(async() => {
8987
await acceptLicenseTerms();
9088
// Add Sentinel databases
9189
await discoverSentinelDatabaseApi(ossSentinelConfig);
9290
await common.reloadPage();
9391
})
94-
.after(async () => {
92+
.after(async() => {
9593
// Delete all primary groups
9694
const sentinelCopy = ossSentinelConfig;
9795
sentinelCopy.masters.push(ossSentinelConfig.masters[1]);
@@ -103,9 +101,6 @@ test
103101
await clickOnEditDatabaseByName(ossSentinelConfig.name[1]);
104102
await t.click(addRedisDatabasePage.cloneDatabaseButton);
105103

106-
// Verify new connection badge for Sentinel db
107-
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
108-
109104
// Verify that for Sentinel Host and Port fields are replaced with editable Primary Group Name field
110105
await t
111106
.expect(myRedisDatabasePage.editAliasButton.withText('Clone ').exists).ok('Clone panel is not displayed')
@@ -123,4 +118,7 @@ test
123118
// Clone Sentinel Primary Group
124119
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
125120
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossSentinelConfig.masters[1].name).count).gt(1, 'Primary Group was not cloned');
121+
122+
// Verify new connection badge for Sentinel db
123+
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossSentinelConfig.name[1]);
126124
});

tests/e2e/tests/critical-path/database/import-databases.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const dbData = [
4242
{
4343
type: 'racompass',
4444
path: path.join('..', '..', '..', 'test-data', 'import-databases', racompassValidJson),
45-
dbNames: ['racompassCluster', 'racompassDbWithIndex:8100 [1]']
45+
dbNames: ['racompassCluster', 'racompassDbWithIndex:8100 [db1]']
4646
},
4747
{
4848
type: 'ardm',

tests/e2e/tests/critical-path/database/logical-databases.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
55

66
const addRedisDatabasePage = new AddRedisDatabasePage();
77
const myRedisDatabasePage = new MyRedisDatabasePage();
8-
const indexDbMessage = 'When the database is added, you can select logical databases only in CLI. To work with other logical databases in Browser and Workbench, add another database with the same host and port, but a different database index.';
98

109
fixture `Logical databases`
1110
.meta({ type: 'critical_path', rte: rte.standalone })
@@ -33,5 +32,6 @@ test('Verify that user can add DB with logical index via host and port from Add
3332
// Verify that the database is in the list
3433
await t.expect(myRedisDatabasePage.dbNameList.withText(ossStandaloneConfig.databaseName).exists).ok('Database not exist', { timeout: 10000 });
3534
// Verify that if user adds DB with logical DB > 0, DB name contains postfix "space+[{database index}]"
36-
await t.expect(myRedisDatabasePage.dbNameList.textContent).eql(`${ossStandaloneConfig.databaseName} [${index}]`, 'The postfix is not added to the database name', { timeout: 10000 });
35+
// Verify that user can see the db{index} instead of {index} in database alias
36+
await t.expect(myRedisDatabasePage.dbNameList.textContent).eql(`${ossStandaloneConfig.databaseName} [db${index}]`, 'The postfix is not added to the database name', { timeout: 10000 });
3737
});

tests/e2e/tests/regression/cli/cli-logical-db.e2e.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,36 +48,37 @@ test
4848
});
4949
test('Verify that working with logical DBs, user can see N DB index in CLI', async t => {
5050
index = '1';
51-
databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[${index}]`;
51+
databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[db${index}]`;
5252

5353
await addRedisDatabasePage.addLogicalRedisDatabase(ossStandaloneConfig, index);
54-
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneConfig.databaseName } [${index}]`);
54+
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneConfig.databaseName } [db${index}]`);
5555
// Open CLI
5656
await t.click(cliPage.cliExpandButton);
5757
// Verify that user can see DB index in CLI
58+
// Verify that user can see the db{index} instead of {index} in CLI input and endpoint
5859
for (const text of cliMessage) {
5960
await t.expect(cliPage.cliArea.textContent).contains(text, 'DB index is not displayed in the CLI message');
6061
}
61-
await t.expect(cliPage.cliDbIndex.textContent).eql(`[${index}] `, 'DB index before the > character in CLI is not displayed');
62+
await t.expect(cliPage.cliDbIndex.textContent).eql(`[db${index}] `, 'DB index before the > character in CLI is not displayed');
6263
await t.expect(cliPage.cliEndpoint.textContent).eql(databaseEndpoint, 'Database index is not displayed in the CLI endpoint');
6364
});
6465
test('Verify that user can see DB index in the endpoint in CLI header is automatically changed when switched to another logical DB', async t => {
6566
index = '2';
6667
const indexAfter = '3';
67-
databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[${index}]`;
68-
const databaseEndpointAfter = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[${indexAfter}]`;
68+
databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[db${index}]`;
69+
const databaseEndpointAfter = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[db${indexAfter}]`;
6970

7071
await addRedisDatabasePage.addLogicalRedisDatabase(ossStandaloneConfig, index);
71-
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneConfig.databaseName } [${index}]`);
72+
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneConfig.databaseName } [db${index}]`);
7273

7374
// Open CLI and verify that user can see DB index in CLI
7475
await t.click(cliPage.cliExpandButton);
75-
await t.expect(cliPage.cliDbIndex.textContent).eql(`[${index}] `, 'DB index before the > character in CLI is not displayed');
76+
await t.expect(cliPage.cliDbIndex.textContent).eql(`[db${index}] `, 'DB index before the > character in CLI is not displayed');
7677
// Re-creates client in CLI
7778
await t.click(cliPage.cliCollapseButton);
7879
await t.click(cliPage.cliExpandButton);
7980
// Verify that when user re-creates client in CLI the new client is connected to the DB index selected for the DB by default
80-
await t.expect(cliPage.cliDbIndex.textContent).eql(`[${index}] `, 'The new client is not connected to the DB index selected for the DB by default');
81+
await t.expect(cliPage.cliDbIndex.textContent).eql(`[db${index}] `, 'The new client is not connected to the DB index selected for the DB by default');
8182

8283
// Open CLI and verify the database index in the endpoint
8384
await t.expect(cliPage.cliEndpoint.textContent).eql(databaseEndpoint, `The endpoint in CLI header not contains ${index} index`);

tests/e2e/tests/regression/database-overview/database-overview-keys.e2e.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { t } from 'testcafe';
21
import { acceptLicenseTermsAndAddDatabase, acceptLicenseTermsAndAddRECloudDatabase, deleteCustomDatabase, deleteDatabase } from '../../../helpers/database';
32
import {
43
MyRedisDatabasePage,
@@ -35,16 +34,16 @@ fixture `Database overview`
3534
await browserPage.addStringKey(keyName);
3635
await t.click(myRedisDatabasePage.myRedisDBButton);
3736
await addRedisDatabasePage.addLogicalRedisDatabase(ossStandaloneRedisearch, index);
38-
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneRedisearch.databaseName} [${index}]`);
37+
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneRedisearch.databaseName} [db${index}]`);
3938
keys = await common.createArrayWithKeyValue(keysAmount);
4039
await cliPage.sendCommandInCli(`MSET ${keys.join(' ')}`);
4140
})
4241
.afterEach(async t => {
4342
// Clear and delete databases
4443
await t.click(myRedisDatabasePage.myRedisDBButton);
45-
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneRedisearch.databaseName} [${index}]`);
44+
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneRedisearch.databaseName} [db${index}]`);
4645
await cliPage.sendCommandInCli(`DEL ${keys.join(' ')}`);
47-
await deleteCustomDatabase(`${ossStandaloneRedisearch.databaseName} [${index}]`);
46+
await deleteCustomDatabase(`${ossStandaloneRedisearch.databaseName} [db${index}]`);
4847
await myRedisDatabasePage.clickOnDBByName(ossStandaloneRedisearch.databaseName);
4948
await browserPage.deleteKeyByName(keyName);
5049
await deleteStandaloneDatabaseApi(ossStandaloneRedisearch);

tests/e2e/tests/regression/workbench/group-mode.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test('Verify that user can run the commands from the Editor in the group mode',
3131
// Verify that user can run a command with quantifier and see results in group(10 info)
3232
await workbenchPage.sendCommandInWorkbench(`${counter} ${command}`);
3333
// Verify that user can see number of total commands in group, success commands, number of failed commands in header summary in Workbench
34-
await t.expect(workbenchPage.queryCardCommand.textContent).eql(`${counter} Command(s) - ${counter} success, 0 error(s)`, 'Not valid summary');
34+
await t.expect(workbenchPage.queryCardCommand.textContent).contains(`${counter} Command(s) - ${counter} success, 0 error(s)`, 'Not valid summary');
3535
// Verify that if users execute commands in group mode, they see summary of the commands execution
3636
await t.expect(workbenchPage.executionCommandTime.exists).ok('Execution time is not displayed');
3737
await t.expect(workbenchPage.executionCommandIcon.exists).ok('Execution time icon is not displayed');

tests/e2e/tests/smoke/database/add-standalone-db.e2e.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ test
3333
})('Verify that user can add Standalone Database', async() => {
3434
await addNewStandaloneDatabase(ossStandaloneConfig);
3535
// Verify that user can see an indicator of databases that are added manually and not opened yet
36-
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
36+
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossStandaloneConfig.databaseName);
3737
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
3838
await t.click(browserPage.myRedisDbIcon);
3939
// Verify that user can't see an indicator of databases that were opened
40-
await myRedisDatabasePage.verifyDatabaseStatusIsNotVisible();
40+
await myRedisDatabasePage.verifyDatabaseStatusIsNotVisible(ossStandaloneConfig.databaseName);
4141
});
4242
test
4343
.meta({ rte: rte.reCluster })
@@ -47,7 +47,7 @@ test
4747
await addNewREClusterDatabase(redisEnterpriseClusterConfig);
4848
// Verify that user can see an indicator of databases that are added using autodiscovery and not opened yet
4949
// Verify new connection badge for RE cluster
50-
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
50+
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(redisEnterpriseClusterConfig.databaseName);
5151
});
5252
test
5353
.meta({ env: env.web, rte: rte.ossCluster })
@@ -56,7 +56,7 @@ test
5656
})('Verify that user can add OSS Cluster DB', async() => {
5757
await addOSSClusterDatabase(ossClusterConfig);
5858
// Verify new connection badge for OSS cluster
59-
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
59+
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossClusterConfig.ossClusterDatabaseName);
6060
});
6161

6262
test
@@ -66,7 +66,7 @@ test
6666
})('Verify that user can add database from RE Cloud via auto-discover flow', async() => {
6767
await addRECloudDatabase(cloudDatabaseConfig);
6868
// Verify new connection badge for RE cloud
69-
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
69+
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(cloudDatabaseConfig.databaseName);
7070
// Verify redis stack icon for RE Cloud with all 5 modules
7171
await t.expect(myRedisDatabasePage.redisStackIcon.visible).ok('Redis Stack icon not found for RE Cloud db with all 5 modules');
7272
});

0 commit comments

Comments
 (0)