Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions tests/e2e/pageObjects/my-redis-databases-page.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { t, Selector } from 'testcafe';
import { getDatabaseByName } from '../helpers/api/api-database';

export class MyRedisDatabasePage {
//-------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -187,18 +188,24 @@ export class MyRedisDatabasePage {

/**
* Verify database status is visible
* @param databaseName The name of the database
*/
async verifyDatabaseStatusIsVisible(): Promise<void> {
await t.expect(Selector('div').withAttribute('data-testid', /database-status-new-*/).visible)
.ok('Database status is not visible');
async verifyDatabaseStatusIsVisible(databaseName: string): Promise<void> {
const databaseId = await getDatabaseByName(databaseName);
const databaseEditBtn = Selector(`[data-testid=database-status-new-${databaseId}]`);

await t.expect(databaseEditBtn.exists).ok(`Database status is not visible for ${databaseName}`);
}

/**
* Verify database status is not visible
* @param databaseName The name of the database
*/
async verifyDatabaseStatusIsNotVisible(): Promise<void> {
await t.expect(Selector('div').withAttribute('data-testid', /database-status-new-*/).visible)
.notOk('Database status is still visible');
async verifyDatabaseStatusIsNotVisible(databaseName: string): Promise<void> {
const databaseId = await getDatabaseByName(databaseName);
const databaseEditBtn = Selector(`[data-testid=database-status-new-${databaseId}]`);

await t.expect(databaseEditBtn.exists).notOk(`Database status is still visible for ${databaseName}`);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/pageObjects/workbench-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ export class WorkbenchPage {
async checkWorkbenchCommandResult(command: string, result: string, childNum = 0): Promise<void> {
// Compare the command with executed command
const actualCommand = await this.queryCardContainer.nth(childNum).find(this.cssQueryCardCommand).textContent;
await t.expect(actualCommand).eql(command, 'Actual command is not equal to executed');
await t.expect(actualCommand).contains(command, 'Actual command is not equal to executed');
// Compare the command result with executed command
const actualCommandResult = await this.queryCardContainer.nth(childNum).find(this.cssQueryTextResult).textContent;
await t.expect(actualCommandResult).eql(result, 'Actual command result is not equal to executed');
await t.expect(actualCommandResult).contains(result, 'Actual command result is not equal to executed');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ test('Switching between indexed databases', async t => {
// Open Workbench page
await t.click(myRedisDatabasePage.workbenchButton);
await workbenchPage.sendCommandInWorkbench(command);
// Verify that user can see the database index before the command name executed in Workbench
await workbenchPage.checkWorkbenchCommandResult(`[db1] ${command}`, '8');

// Open Browser page
await t.click(myRedisDatabasePage.browserButton);
// Clear filter
Expand All @@ -134,9 +137,16 @@ test('Switching between indexed databases', async t => {
// Verify that data changed for indexed db on Database analysis page
await t.expect(memoryEfficiencyPage.topKeysKeyName.withExactText(keyNames[0]).exists).ok('Keys from current db index not displayed in report');
await t.expect(memoryEfficiencyPage.topKeysKeyName.withExactText(logicalDbKey).exists).notOk('Keys from other db index displayed in report');
await t.expect(memoryEfficiencyPage.selectedReport.textContent).notContains('[db', 'Index displayed for 0 index in report name');
// Change index to logical db
await databaseOverviewPage.changeDbIndex(1);
await t.click(memoryEfficiencyPage.newReportBtn);
await t.expect(memoryEfficiencyPage.selectedReport.textContent).contains('[db1]', 'Index not displayed in report name');
await t.expect(memoryEfficiencyPage.topKeysKeyName.withExactText(logicalDbKey).exists).ok('Keys from current db index not displayed in report');
await t.expect(memoryEfficiencyPage.topKeysKeyName.withExactText(keyNames[0]).exists).notOk('Keys from other db index displayed in report');

// Verify that user can see the database index before the report date in Database Analysis
await t.click(memoryEfficiencyPage.selectedReport);
await t.expect(memoryEfficiencyPage.reportItem.nth(0).textContent).contains('[db1]', 'Index not displayed in report name');
await t.expect(memoryEfficiencyPage.reportItem.nth(1).textContent).notContains('[db', 'Index displayed for 0 index in report name');
});
32 changes: 15 additions & 17 deletions tests/e2e/tests/critical-path/database/clone-databases.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ fixture `Clone databases`
.meta({ type: 'critical_path' })
.page(commonUrl);
test
.before(async () => {
.before(async() => {
await acceptLicenseTerms();
await addNewStandaloneDatabaseApi(ossStandaloneConfig);
await common.reloadPage();
})
.after(async () => {
.after(async() => {
// Delete databases
const dbNumber = await myRedisDatabasePage.dbNameList.withExactText(ossStandaloneConfig.databaseName).count;
for (let i = 0; i < dbNumber; i++) {
Expand All @@ -37,10 +37,6 @@ test
await clickOnEditDatabaseByName(ossStandaloneConfig.databaseName);
// Verify that user can cancel the Clone by clicking the “Cancel” or the “x” button
await t.click(addRedisDatabasePage.cloneDatabaseButton);

// Verify new connection badge for cloned database
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();

await t.click(addRedisDatabasePage.cancelButton);
await t.expect(myRedisDatabasePage.editAliasButton.withText('Clone ').exists).notOk('Clone panel is still displayed', { timeout: 2000 });
await clickOnEditDatabaseByName(ossStandaloneConfig.databaseName);
Expand All @@ -55,25 +51,24 @@ test
// Verify that user can confirm the creation of the database by clicking “Clone Database”
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossStandaloneConfig.databaseName).count).eql(2, 'DB was not cloned');

// Verify new connection badge for cloned database
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossStandaloneConfig.databaseName);
});
test
.before(async () => {
.before(async() => {
await acceptLicenseTerms();
await addNewOSSClusterDatabaseApi(ossClusterConfig);
await common.reloadPage();
})
.after(async () => {
.after(async() => {
// Delete database
await deleteOSSClusterDatabaseApi(ossClusterConfig);
await myRedisDatabasePage.deleteDatabaseByName(newOssDatabaseAlias);
})
.meta({ rte: rte.ossCluster })('Verify that user can clone OSS Cluster', async t => {
await clickOnEditDatabaseByName(ossClusterConfig.ossClusterDatabaseName);
await t.click(addRedisDatabasePage.cloneDatabaseButton);

// New connections indicator
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();

await t
.expect(myRedisDatabasePage.editAliasButton.withText('Clone ').exists).ok('Clone panel is not displayed')
.expect(addRedisDatabasePage.portInput.getAttribute('value')).eql(ossClusterConfig.ossClusterPort, 'Wrong port value')
Expand All @@ -83,15 +78,18 @@ test
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
await t.expect(myRedisDatabasePage.dbNameList.withExactText(newOssDatabaseAlias).exists).ok('DB was not closed');
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossClusterConfig.ossClusterDatabaseName).exists).ok('Original DB is not displayed');

// New connections indicator
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossClusterConfig.ossClusterDatabaseName);
});
test
.before(async () => {
.before(async() => {
await acceptLicenseTerms();
// Add Sentinel databases
await discoverSentinelDatabaseApi(ossSentinelConfig);
await common.reloadPage();
})
.after(async () => {
.after(async() => {
// Delete all primary groups
const sentinelCopy = ossSentinelConfig;
sentinelCopy.masters.push(ossSentinelConfig.masters[1]);
Expand All @@ -103,9 +101,6 @@ test
await clickOnEditDatabaseByName(ossSentinelConfig.name[1]);
await t.click(addRedisDatabasePage.cloneDatabaseButton);

// Verify new connection badge for Sentinel db
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();

// Verify that for Sentinel Host and Port fields are replaced with editable Primary Group Name field
await t
.expect(myRedisDatabasePage.editAliasButton.withText('Clone ').exists).ok('Clone panel is not displayed')
Expand All @@ -123,4 +118,7 @@ test
// Clone Sentinel Primary Group
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossSentinelConfig.masters[1].name).count).gt(1, 'Primary Group was not cloned');

// Verify new connection badge for Sentinel db
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossSentinelConfig.name[1]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const dbData = [
{
type: 'racompass',
path: path.join('..', '..', '..', 'test-data', 'import-databases', racompassValidJson),
dbNames: ['racompassCluster', 'racompassDbWithIndex:8100 [1]']
dbNames: ['racompassCluster', 'racompassDbWithIndex:8100 [db1]']
},
{
type: 'ardm',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';

const addRedisDatabasePage = new AddRedisDatabasePage();
const myRedisDatabasePage = new MyRedisDatabasePage();
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.';

fixture `Logical databases`
.meta({ type: 'critical_path', rte: rte.standalone })
Expand Down Expand Up @@ -33,5 +32,6 @@ test('Verify that user can add DB with logical index via host and port from Add
// Verify that the database is in the list
await t.expect(myRedisDatabasePage.dbNameList.withText(ossStandaloneConfig.databaseName).exists).ok('Database not exist', { timeout: 10000 });
// Verify that if user adds DB with logical DB > 0, DB name contains postfix "space+[{database index}]"
await t.expect(myRedisDatabasePage.dbNameList.textContent).eql(`${ossStandaloneConfig.databaseName} [${index}]`, 'The postfix is not added to the database name', { timeout: 10000 });
// Verify that user can see the db{index} instead of {index} in database alias
await t.expect(myRedisDatabasePage.dbNameList.textContent).eql(`${ossStandaloneConfig.databaseName} [db${index}]`, 'The postfix is not added to the database name', { timeout: 10000 });
});
17 changes: 9 additions & 8 deletions tests/e2e/tests/regression/cli/cli-logical-db.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,37 @@ test
});
test('Verify that working with logical DBs, user can see N DB index in CLI', async t => {
index = '1';
databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[${index}]`;
databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[db${index}]`;

await addRedisDatabasePage.addLogicalRedisDatabase(ossStandaloneConfig, index);
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneConfig.databaseName } [${index}]`);
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneConfig.databaseName } [db${index}]`);
// Open CLI
await t.click(cliPage.cliExpandButton);
// Verify that user can see DB index in CLI
// Verify that user can see the db{index} instead of {index} in CLI input and endpoint
for (const text of cliMessage) {
await t.expect(cliPage.cliArea.textContent).contains(text, 'DB index is not displayed in the CLI message');
}
await t.expect(cliPage.cliDbIndex.textContent).eql(`[${index}] `, 'DB index before the > character in CLI is not displayed');
await t.expect(cliPage.cliDbIndex.textContent).eql(`[db${index}] `, 'DB index before the > character in CLI is not displayed');
await t.expect(cliPage.cliEndpoint.textContent).eql(databaseEndpoint, 'Database index is not displayed in the CLI endpoint');
});
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 => {
index = '2';
const indexAfter = '3';
databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[${index}]`;
const databaseEndpointAfter = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[${indexAfter}]`;
databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[db${index}]`;
const databaseEndpointAfter = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}[db${indexAfter}]`;

await addRedisDatabasePage.addLogicalRedisDatabase(ossStandaloneConfig, index);
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneConfig.databaseName } [${index}]`);
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneConfig.databaseName } [db${index}]`);

// Open CLI and verify that user can see DB index in CLI
await t.click(cliPage.cliExpandButton);
await t.expect(cliPage.cliDbIndex.textContent).eql(`[${index}] `, 'DB index before the > character in CLI is not displayed');
await t.expect(cliPage.cliDbIndex.textContent).eql(`[db${index}] `, 'DB index before the > character in CLI is not displayed');
// Re-creates client in CLI
await t.click(cliPage.cliCollapseButton);
await t.click(cliPage.cliExpandButton);
// Verify that when user re-creates client in CLI the new client is connected to the DB index selected for the DB by default
await t.expect(cliPage.cliDbIndex.textContent).eql(`[${index}] `, 'The new client is not connected to the DB index selected for the DB by default');
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');

// Open CLI and verify the database index in the endpoint
await t.expect(cliPage.cliEndpoint.textContent).eql(databaseEndpoint, `The endpoint in CLI header not contains ${index} index`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { t } from 'testcafe';
import { acceptLicenseTermsAndAddDatabase, acceptLicenseTermsAndAddRECloudDatabase, deleteCustomDatabase, deleteDatabase } from '../../../helpers/database';
import {
MyRedisDatabasePage,
Expand Down Expand Up @@ -35,16 +34,16 @@ fixture `Database overview`
await browserPage.addStringKey(keyName);
await t.click(myRedisDatabasePage.myRedisDBButton);
await addRedisDatabasePage.addLogicalRedisDatabase(ossStandaloneRedisearch, index);
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneRedisearch.databaseName} [${index}]`);
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneRedisearch.databaseName} [db${index}]`);
keys = await common.createArrayWithKeyValue(keysAmount);
await cliPage.sendCommandInCli(`MSET ${keys.join(' ')}`);
})
.afterEach(async t => {
// Clear and delete databases
await t.click(myRedisDatabasePage.myRedisDBButton);
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneRedisearch.databaseName} [${index}]`);
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneRedisearch.databaseName} [db${index}]`);
await cliPage.sendCommandInCli(`DEL ${keys.join(' ')}`);
await deleteCustomDatabase(`${ossStandaloneRedisearch.databaseName} [${index}]`);
await deleteCustomDatabase(`${ossStandaloneRedisearch.databaseName} [db${index}]`);
await myRedisDatabasePage.clickOnDBByName(ossStandaloneRedisearch.databaseName);
await browserPage.deleteKeyByName(keyName);
await deleteStandaloneDatabaseApi(ossStandaloneRedisearch);
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/regression/workbench/group-mode.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('Verify that user can run the commands from the Editor in the group mode',
// Verify that user can run a command with quantifier and see results in group(10 info)
await workbenchPage.sendCommandInWorkbench(`${counter} ${command}`);
// Verify that user can see number of total commands in group, success commands, number of failed commands in header summary in Workbench
await t.expect(workbenchPage.queryCardCommand.textContent).eql(`${counter} Command(s) - ${counter} success, 0 error(s)`, 'Not valid summary');
await t.expect(workbenchPage.queryCardCommand.textContent).contains(`${counter} Command(s) - ${counter} success, 0 error(s)`, 'Not valid summary');
// Verify that if users execute commands in group mode, they see summary of the commands execution
await t.expect(workbenchPage.executionCommandTime.exists).ok('Execution time is not displayed');
await t.expect(workbenchPage.executionCommandIcon.exists).ok('Execution time icon is not displayed');
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/tests/smoke/database/add-standalone-db.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ test
})('Verify that user can add Standalone Database', async() => {
await addNewStandaloneDatabase(ossStandaloneConfig);
// Verify that user can see an indicator of databases that are added manually and not opened yet
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossStandaloneConfig.databaseName);
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
await t.click(browserPage.myRedisDbIcon);
// Verify that user can't see an indicator of databases that were opened
await myRedisDatabasePage.verifyDatabaseStatusIsNotVisible();
await myRedisDatabasePage.verifyDatabaseStatusIsNotVisible(ossStandaloneConfig.databaseName);
});
test
.meta({ rte: rte.reCluster })
Expand All @@ -47,7 +47,7 @@ test
await addNewREClusterDatabase(redisEnterpriseClusterConfig);
// Verify that user can see an indicator of databases that are added using autodiscovery and not opened yet
// Verify new connection badge for RE cluster
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(redisEnterpriseClusterConfig.databaseName);
});
test
.meta({ env: env.web, rte: rte.ossCluster })
Expand All @@ -56,7 +56,7 @@ test
})('Verify that user can add OSS Cluster DB', async() => {
await addOSSClusterDatabase(ossClusterConfig);
// Verify new connection badge for OSS cluster
await myRedisDatabasePage.verifyDatabaseStatusIsVisible();
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossClusterConfig.ossClusterDatabaseName);
});

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