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
30 changes: 25 additions & 5 deletions tests/e2e/pageObjects/components/bottom-panel/profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,48 @@ export class Profiler {
* Check specific command in Monitor
* @param command A command which should be displayed in monitor
* @param parameters An arguments which should be displayed in monitor
* @param expected specify is the command is present or not
* @param timeout timeout
*/
async checkCommandInMonitorResults(command: string, parameters?: string[]): Promise<void> {
async checkCommandInMonitorResults(command: string, parameters?: string[], expected: boolean = true, timeout: number = 6000): Promise<void> {
const commandArray = command.split(' ');
for (const value of commandArray) {
await t.expect(this.monitorCommandLinePart.withText(value).exists).ok({ timeout: 6000 });
if(expected){
await t.expect(this.monitorCommandLinePart.withText(value).exists).ok({ timeout: timeout });
}
else {
await t.expect(this.monitorCommandLinePart.withText(value).exists).notOk({ timeout: 1000 });
}
}
if (!!parameters) {
for (const argument of parameters) {
await t.expect(this.monitorCommandLinePart.withText(argument).exists).ok({ timeout: 6000 });
await t.expect(this.monitorCommandLinePart.withText(argument).exists).ok({ timeout: timeout });
}
}
}
/**
* Start monitor function
* Start monitor function and verify info
*/
async startMonitor(): Promise<void> {
async startMonitorAndVerifyStart(): Promise<void> {
await t
.click(this.expandMonitor)
.click(this.startMonitorButton);
//Check for "info" command that is sent automatically every 5 seconds from BE side
await this.checkCommandInMonitorResults('info');
}

/**
* Start monitor function and verify info
*/
async startMonitor(): Promise<void> {
if (!(await this.startMonitorButton.exists)){
await t
.click(this.expandMonitor)
}
await t
.click(this.startMonitorButton);
}

/**
* Start monitor with Save log function
*/
Expand Down
22 changes: 17 additions & 5 deletions tests/e2e/pageObjects/components/overview-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@ export class OverviewPanel {
// TEXT ELEMENTS
overviewTotalKeys = Selector('[data-test-subj=overview-total-keys]');
overviewTotalMemory = Selector('[data-test-subj=overview-total-memory]');
databaseModules = Selector('[data-testid$=module]');
overviewTooltipStatTitle = Selector('[data-testid=overview-db-stat-title]');
overviewCpu = Selector('[data-test-subj=overview-cpu]');
overviewConnectedClients = Selector('[data-test-subj=overview-connected-clients]');
overviewCommandsSec = Selector('[data-test-subj=overview-commands-sec]');
overviewSpinner = Selector('[class*=euiLoadingSpinner--medium]');
// BUTTONS
myRedisDBLink = Selector('[data-testid=my-redis-db-btn]', { timeout: 1000 });
overviewRedisStackLogo = Selector('[data-testid=redis-stack-logo]');
overviewMoreInfo = Selector('[data-testid=overview-more-info-button]');
changeIndexBtn = Selector('[data-testid=change-index-btn]');
databaseInfoIcon = Selector('[data-testid=db-info-icon]');
autoRefreshArrow = Selector('[data-testid=auto-refresh-overview-auto-refresh-config-btn]');
autoRefreshCheckbox = Selector('[data-testid=auto-refresh-overview-auto-refresh-switch]');
// PANEL
overviewTooltip = Selector('[data-testid=overview-more-info-tooltip]');
databaseInfoToolTip = Selector('[data-testid=db-info-tooltip]', { timeout: 2000 });
// INPUTS
changeIndexInput = Selector('[data-testid=change-index-input]');
autoRefreshRateInput = Selector('[data-testid=auto-refresh-overview-refresh-rate]');
inlineItemEditor = Selector('[data-testid=inline-item-editor]');

/**
* Change database index
Expand All @@ -49,4 +48,17 @@ export class OverviewPanel {
async waitForCpuIsCalculated(): Promise<void> {
await t.expect(this.overviewSpinner.visible).notOk('cpu is not calculated, spinner is still displayed');
}

/**
* set auto refresh rate
* @param rate rate value
*/
async setAutoRefreshValue(rate: string): Promise<void> {
if(!(await this.autoRefreshRateInput.exists)){
await t.click(this.autoRefreshArrow)
}
await t.click(this.autoRefreshRateInput);
await t.typeText(this.inlineItemEditor, rate);
await t.click(this.EditorButton.applyBtn);
}
}
4 changes: 3 additions & 1 deletion tests/e2e/pageObjects/dialogs/add-redis-database-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export class AddRedisDatabaseDialog {
aiChatMessage = Selector('[data-testid=ai-chat-message-btn]');
aiCloseMessage = Selector('[aria-label="Closes this modal window"]');

getDeleteCertificate = (certificate: TlsCertificates) => Selector(`[data-testid^=delete-${certificate}-cert]`);

/**
* Adding a new redis database
* @param parameters the parameters of the database
Expand Down Expand Up @@ -266,7 +268,7 @@ export class AddRedisDatabaseDialog {
const row = Selector('button')
.find('div')
.withText(name);
const removeButton = `[data-testid^=delete-${certificate}-cert]`;
const removeButton = String(this.getDeleteCertificate(certificate));
const removeButtonFooter = Selector('[class^=_popoverFooter]');

if(certificate === TlsCertificates.CA){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ test
};
// Verify that user can add SSH tunnel with Password for OSS Cluster database
await myRedisDatabasePage.AddRedisDatabaseDialog.addStandaloneSSHDatabase(sshDbClusterPass, sshWithPass);
//TODO should be deleted after https://redislabs.atlassian.net/browse/RI-5995
await t.wait(6000);
await myRedisDatabasePage.clickOnDBByName(sshDbClusterPass.databaseName);

if(! await browserPage.plusAddKeyButton.exists){
await myRedisDatabasePage.clickOnDBByName(sshDbClusterPass.databaseName);
}
//verify that db is added and profiler works
await t.click(browserPage.Profiler.expandMonitor);
await t.click(browserPage.Profiler.startMonitorButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test('Verify that user can see the list of all commands from all clients ran for
const common_command = 'info';
const browser_command = 'hset';
//Start Monitor
await browserPage.Profiler.startMonitor();
await browserPage.Profiler.startMonitorAndVerifyStart();
//Send command in CLI
await browserPage.Cli.getSuccessCommandResultFromCli(cli_command);
//Check that command from CLI is displayed in monitor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,23 @@ test
.after(async() => {
// Delete databases
await databaseAPIRequests.deleteStandaloneDatabaseApi(sshDbClusterPass);
})('Adding OSS Cluster database with SSH', async() => {
})('Adding OSS Cluster database with SSH', async t => {
const sshWithPass = {
...sshParams,
sshPassword: 'pass'
};
// Verify that user can add SSH tunnel with Password for OSS Cluster database
await myRedisDatabasePage.AddRedisDatabaseDialog.addStandaloneSSHDatabase(sshDbClusterPass, sshWithPass);
// TODO should be deleted after https://redislabs.atlassian.net/browse/RI-5995
await t.wait(6000)
await myRedisDatabasePage.clickOnDBByName(sshDbClusterPass.databaseName);
if(! await browserPage.plusAddKeyButton.exists){
await myRedisDatabasePage.clickOnDBByName(sshDbClusterPass.databaseName);
}
await Common.checkURLContainsText('browser');
});
// Unskip in RI-6478
test.skip

test
.meta({ rte: rte.none })
.before(async() => {
await databaseAPIRequests.deleteAllDatabasesApi();
Expand All @@ -210,9 +215,10 @@ test.skip
await t.expect(myRedisDatabasePage.starFreeDbCheckbox.exists).ok('star checkbox is not displayed next to free db link');
await t.expect(myRedisDatabasePage.portCloudDb.textContent).contains('Set up in a few clicks', `create free db row is not displayed`);

await t.click(myRedisDatabasePage.tableRowContent);
await Common.checkURL(externalPageLinkList);
await goBackHistory();
// skipped until https://redislabs.atlassian.net/browse/RI-6556
// await t.click(myRedisDatabasePage.tableRowContent);
// await Common.checkURL(externalPageLinkList);
// await goBackHistory();

await t.click(myRedisDatabasePage.NavigationPanel.cloudButton);
await Common.checkURL(externalPageLinkNavigation);
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/web/critical-path/monitor/monitor.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test('Verify that user can see the list of all commands from all clients ran for
const common_command = 'info';
const browser_command = 'hset';
//Start Monitor
await browserPage.Profiler.startMonitor();
await browserPage.Profiler.startMonitorAndVerifyStart();
//Send command in CLI
await browserPage.Cli.getSuccessCommandResultFromCli(cli_command);
//Check that command from CLI is displayed in monitor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test('Verify that user can see a tooltip and toggle that allows to save Profiler
});
test('Verify that user can see that toggle is not displayed when Profiler is started', async t => {
// Start Monitor without save logs
await browserPage.Profiler.startMonitor();
await browserPage.Profiler.startMonitorAndVerifyStart();
// Check the toggle
await t.expect(browserPage.Profiler.saveLogSwitchButton.exists).notOk('The toggle is displayed when Profiler is started');
// Restart Monitor with Save logs
Expand Down Expand Up @@ -77,7 +77,7 @@ test('Verify that when user switch toggle to OFF and started the Profiler, tempo
const numberOfTempFiles = fs.readdirSync(tempDir).length;

// Start Monitor without Save logs
await browserPage.Profiler.startMonitor();
await browserPage.Profiler.startMonitorAndVerifyStart();
// Verify that temporary Log file is not created
await t.expect(numberOfTempFiles).gte(fs.readdirSync(tempDir).length, 'The temporary Log file is created');
});
Expand All @@ -96,7 +96,7 @@ test('Verify that when user see the toggle is OFF - Profiler logs are not being
const numberOfDownloadFiles = await databasesActions.getFileCount(fileDownloadPath, fileStarts);

// Start Monitor without Save logs
await browserPage.Profiler.startMonitor();
await browserPage.Profiler.startMonitorAndVerifyStart();
await t.wait(3000);
// Check the download files
await t.expect(await databasesActions.getFileCount(fileDownloadPath, fileStarts)).eql(numberOfDownloadFiles, 'The Profiler logs are saved');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
BrowserPage
} from '../../../../pageObjects';
import { rte } from '../../../../helpers/constants';
import { commonUrl, ossStandaloneConfig } from '../../../../helpers/conf';
import { cloudDatabaseConfig, commonUrl, ossStandaloneConfig } from '../../../../helpers/conf';
import { Common } from '../../../../helpers/common';
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';

Expand All @@ -24,11 +24,14 @@ fixture `Database overview`
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig);
})
.afterEach(async() => {
// Clear and delete database
await browserPage.Cli.sendCommandInCli(`DEL ${keys.join(' ')}`);
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneConfig);
});
test('Verify that user can connect to DB and see breadcrumbs at the top of the application', async t => {
test.after(async() => {
// Delete database
await browserPage.Cli.sendCommandInCli(`DEL ${keys.join(' ')}`);
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneConfig);

})('Verify that user can connect to DB and see breadcrumbs at the top of the application', async t => {
// Create new keys
keys = await Common.createArrayWithKeyValue(10);
await browserPage.Cli.sendCommandInCli(`MSET ${keys.join(' ')}`);
Expand All @@ -42,3 +45,27 @@ test('Verify that user can connect to DB and see breadcrumbs at the top of the a
await t.expect(workbenchPage.OverviewPanel.overviewTotalKeys.exists).ok('User can not see total keys');
await t.expect(workbenchPage.OverviewPanel.overviewTotalMemory.exists).ok('User can not see total memory');
});
test('Verify that user can set overview refresh', async t => {
const common_command = 'info';

await t.click(browserPage.OverviewPanel.autoRefreshArrow);
await t.expect(browserPage.OverviewPanel.autoRefreshRateInput.textContent).eql('5 s', 'default value is incorrect');
await t.click(browserPage.OverviewPanel.autoRefreshCheckbox);
//Start Monitor
await browserPage.Profiler.startMonitor();
//Wait for 6 sec
await t.wait(6000);
await browserPage.Profiler.checkCommandInMonitorResults(common_command, undefined, false);

await browserPage.Profiler.stopMonitor();
await browserPage.OverviewPanel.setAutoRefreshValue('10');
await t.click(browserPage.OverviewPanel.autoRefreshCheckbox);
//Start Monitor
await t.click( browserPage.Profiler.resetProfilerButton);
await browserPage.Profiler.startMonitor();
// verify that the info is not displayed after default value
await t.wait(5000);
await workbenchPage.Profiler.checkCommandInMonitorResults(common_command, undefined, false);
// verify that the info is displayed after set value
await workbenchPage.Profiler.checkCommandInMonitorResults(common_command);
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,24 @@ fixture `tls certificates`
.meta({ type: 'regression', rte: rte.none })
.page(commonUrl)
.beforeEach(async() => {
await databaseAPIRequests.deleteAllDatabasesApi();
await databaseAPIRequests.addNewStandaloneDatabaseApi(ossStandaloneConfig);
await myRedisDatabasePage.reloadPage();
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneTlsConfig);

})
.afterEach(async() => {
// Delete database
await databaseHelper.deleteDatabase(ossStandaloneTlsConfig.databaseName);
await databaseHelper.deleteDatabase(ossStandaloneConfig.databaseName);
await databaseAPIRequests.deleteAllDatabasesApi();
});
test('Verify that user can remove added certificates', async t => {
await t.click(browserPage.NavigationPanel.myRedisDBButton);
await myRedisDatabasePage.clickOnEditDBByName(ossStandaloneTlsConfig.databaseName);
await myRedisDatabasePage.AddRedisDatabaseDialog.removeCertificateButton(TlsCertificates.CA, 'ca');
// remove if other Certificates were added
if( await myRedisDatabasePage.AddRedisDatabaseDialog.getDeleteCertificate(TlsCertificates.CA).exists){
await myRedisDatabasePage.AddRedisDatabaseDialog.removeCertificateButton(TlsCertificates.CA, 'ca');
}
await myRedisDatabasePage.reloadPage();
// wait for dbs are displayed
await t.expect(myRedisDatabasePage.dbNameList.count).gt(0);
Expand All @@ -52,7 +56,7 @@ test('Verify that user can remove added certificates', async t => {
await myRedisDatabasePage.reloadPage();

await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName!);

await t.click(browserPage.NavigationPanel.myRedisDBButton);
await myRedisDatabasePage.clickOnDBByName(ossStandaloneTlsConfig.databaseName);
await t.expect(browserPage.Toast.toastError.textContent).contains('CA or Client certificate', 'user can connect to db without certificates');
Expand Down
7 changes: 4 additions & 3 deletions tests/e2e/tests/web/regression/monitor/monitor.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fixture `Monitor`
});
test('Verify Monitor refresh/stop', async t => {
// Run monitor
await browserPage.Profiler.startMonitor();
await browserPage.Profiler.startMonitorAndVerifyStart();
// Close Monitor
await t.click(browserPage.Profiler.closeMonitor);
// Verify that monitor is not displayed
Expand Down Expand Up @@ -70,7 +70,8 @@ test('Verify Monitor refresh/stop', async t => {

// Run monitor
await t.click(browserPage.Profiler.startMonitorButton);
await browserPage.Profiler.checkCommandInMonitorResults('info');

await browserPage.Profiler.checkCommandInMonitorResults('info', undefined, true, 10000);
// Click on refresh keys to get new logs
await t.click(browserPage.refreshKeysButton);
// Get last timestamp
Expand Down Expand Up @@ -99,7 +100,7 @@ test
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneBigConfig);
})('Verify that user can see monitor results in high DB load', async t => {
// Run monitor
await browserPage.Profiler.startMonitor();
await browserPage.Profiler.startMonitorAndVerifyStart();
// Search by not existed key pattern
await browserPage.searchByKeyName(`${chance.string({ length: 10 })}*`);
// Check that the last child is updated
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/tests/web/regression/monitor/save-commands.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fixture `Save commands`
});
test('Verify that when clicks on “Reset Profiler” button he brought back to Profiler home screen', async t => {
// Start Monitor without Save logs
await browserPage.Profiler.startMonitor();
await browserPage.Profiler.startMonitorAndVerifyStart();
// Remember the number of files in Temp
const numberOfTempFiles = fs.readdirSync(tempDir).length;
// Reset profiler
Expand All @@ -44,7 +44,7 @@ test('Verify that when clicks on “Reset Profiler” button he brought back to
});
test('Verify that when user clears the Profiler he doesn\'t brought back to Profiler home screen', async t => {
// Start Monitor
await browserPage.Profiler.startMonitor();
await browserPage.Profiler.startMonitorAndVerifyStart();
// Clear monitor and check the view
await t.click(browserPage.Profiler.clearMonitorButton);
await t.expect(browserPage.Profiler.monitorNotStartedElement.visible).notOk('Profiler home screen is still opened after Clear');
Expand Down
Loading