Skip to content

Commit d164a6b

Browse files
add refresh overview test
1 parent e71b206 commit d164a6b

File tree

8 files changed

+80
-22
lines changed

8 files changed

+80
-22
lines changed

tests/e2e/pageObjects/components/bottom-panel/profiler.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,17 @@ export class Profiler {
2929
* Check specific command in Monitor
3030
* @param command A command which should be displayed in monitor
3131
* @param parameters An arguments which should be displayed in monitor
32+
* @param expected specify is the command is present or not
3233
*/
33-
async checkCommandInMonitorResults(command: string, parameters?: string[]): Promise<void> {
34+
async checkCommandInMonitorResults(command: string, parameters?: string[], expected: boolean = true): Promise<void> {
3435
const commandArray = command.split(' ');
3536
for (const value of commandArray) {
36-
await t.expect(this.monitorCommandLinePart.withText(value).exists).ok({ timeout: 6000 });
37+
if(expected){
38+
await t.expect(this.monitorCommandLinePart.withText(value).exists).ok({ timeout: 6000 });
39+
}
40+
else {
41+
await t.expect(this.monitorCommandLinePart.withText(value).exists).notOk({ timeout: 1000 });
42+
}
3743
}
3844
if (!!parameters) {
3945
for (const argument of parameters) {
@@ -42,15 +48,28 @@ export class Profiler {
4248
}
4349
}
4450
/**
45-
* Start monitor function
51+
* Start monitor function and verify info
4652
*/
47-
async startMonitor(): Promise<void> {
53+
async startMonitorAndVerifyStart(): Promise<void> {
4854
await t
4955
.click(this.expandMonitor)
5056
.click(this.startMonitorButton);
5157
//Check for "info" command that is sent automatically every 5 seconds from BE side
5258
await this.checkCommandInMonitorResults('info');
5359
}
60+
61+
/**
62+
* Start monitor function and verify info
63+
*/
64+
async startMonitor(): Promise<void> {
65+
if (!(await this.startMonitorButton.exists)){
66+
await t
67+
.click(this.expandMonitor)
68+
}
69+
await t
70+
.click(this.startMonitorButton);
71+
}
72+
5473
/**
5574
* Start monitor with Save log function
5675
*/

tests/e2e/pageObjects/components/overview-panel.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,22 @@ export class OverviewPanel {
66
// TEXT ELEMENTS
77
overviewTotalKeys = Selector('[data-test-subj=overview-total-keys]');
88
overviewTotalMemory = Selector('[data-test-subj=overview-total-memory]');
9-
databaseModules = Selector('[data-testid$=module]');
10-
overviewTooltipStatTitle = Selector('[data-testid=overview-db-stat-title]');
119
overviewCpu = Selector('[data-test-subj=overview-cpu]');
1210
overviewConnectedClients = Selector('[data-test-subj=overview-connected-clients]');
1311
overviewCommandsSec = Selector('[data-test-subj=overview-commands-sec]');
1412
overviewSpinner = Selector('[class*=euiLoadingSpinner--medium]');
1513
// BUTTONS
1614
myRedisDBLink = Selector('[data-testid=my-redis-db-btn]', { timeout: 1000 });
17-
overviewRedisStackLogo = Selector('[data-testid=redis-stack-logo]');
18-
overviewMoreInfo = Selector('[data-testid=overview-more-info-button]');
1915
changeIndexBtn = Selector('[data-testid=change-index-btn]');
2016
databaseInfoIcon = Selector('[data-testid=db-info-icon]');
17+
autoRefreshArrow = Selector('[data-testid=auto-refresh-overview-auto-refresh-config-btn]');
18+
autoRefreshCheckbox = Selector('[data-testid=auto-refresh-overview-auto-refresh-switch]');
2119
// PANEL
22-
overviewTooltip = Selector('[data-testid=overview-more-info-tooltip]');
2320
databaseInfoToolTip = Selector('[data-testid=db-info-tooltip]', { timeout: 2000 });
2421
// INPUTS
2522
changeIndexInput = Selector('[data-testid=change-index-input]');
23+
autoRefreshRateInput = Selector('[data-testid=auto-refresh-overview-refresh-rate]');
24+
inlineItemEditor = Selector('[data-testid=inline-item-editor]');
2625

2726
/**
2827
* Change database index
@@ -49,4 +48,17 @@ export class OverviewPanel {
4948
async waitForCpuIsCalculated(): Promise<void> {
5049
await t.expect(this.overviewSpinner.visible).notOk('cpu is not calculated, spinner is still displayed');
5150
}
51+
52+
/**
53+
* set auto refresh rate
54+
* @param rate rate value
55+
*/
56+
async setAutoRefreshValue(rate: string): Promise<void> {
57+
if(!(await this.autoRefreshRateInput.exists)){
58+
await t.click(this.autoRefreshArrow)
59+
}
60+
await t.click(this.autoRefreshRateInput);
61+
await t.typeText(this.inlineItemEditor, rate);
62+
await t.click(this.EditorButton.applyBtn);
63+
}
5264
}

tests/e2e/tests/electron/critical-path/monitor/monitor.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test('Verify that user can see the list of all commands from all clients ran for
5454
const common_command = 'info';
5555
const browser_command = 'hset';
5656
//Start Monitor
57-
await browserPage.Profiler.startMonitor();
57+
await browserPage.Profiler.startMonitorAndVerifyStart();
5858
//Send command in CLI
5959
await browserPage.Cli.getSuccessCommandResultFromCli(cli_command);
6060
//Check that command from CLI is displayed in monitor

tests/e2e/tests/web/critical-path/monitor/monitor.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ test('Verify that user can see the list of all commands from all clients ran for
5353
const common_command = 'info';
5454
const browser_command = 'hset';
5555
//Start Monitor
56-
await browserPage.Profiler.startMonitor();
56+
await browserPage.Profiler.startMonitorAndVerifyStart();
5757
//Send command in CLI
5858
await browserPage.Cli.getSuccessCommandResultFromCli(cli_command);
5959
//Check that command from CLI is displayed in monitor

tests/e2e/tests/web/critical-path/monitor/save-commands.e2e.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test('Verify that user can see a tooltip and toggle that allows to save Profiler
4848
});
4949
test('Verify that user can see that toggle is not displayed when Profiler is started', async t => {
5050
// Start Monitor without save logs
51-
await browserPage.Profiler.startMonitor();
51+
await browserPage.Profiler.startMonitorAndVerifyStart();
5252
// Check the toggle
5353
await t.expect(browserPage.Profiler.saveLogSwitchButton.exists).notOk('The toggle is displayed when Profiler is started');
5454
// Restart Monitor with Save logs
@@ -77,7 +77,7 @@ test('Verify that when user switch toggle to OFF and started the Profiler, tempo
7777
const numberOfTempFiles = fs.readdirSync(tempDir).length;
7878

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

9898
// Start Monitor without Save logs
99-
await browserPage.Profiler.startMonitor();
99+
await browserPage.Profiler.startMonitorAndVerifyStart();
100100
await t.wait(3000);
101101
// Check the download files
102102
await t.expect(await databasesActions.getFileCount(fileDownloadPath, fileStarts)).eql(numberOfDownloadFiles, 'The Profiler logs are saved');

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

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
BrowserPage
66
} from '../../../../pageObjects';
77
import { rte } from '../../../../helpers/constants';
8-
import { commonUrl, ossStandaloneConfig } from '../../../../helpers/conf';
8+
import { cloudDatabaseConfig, commonUrl, ossStandaloneConfig } from '../../../../helpers/conf';
99
import { Common } from '../../../../helpers/common';
1010
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
1111

@@ -24,11 +24,14 @@ fixture `Database overview`
2424
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig);
2525
})
2626
.afterEach(async() => {
27-
// Clear and delete database
28-
await browserPage.Cli.sendCommandInCli(`DEL ${keys.join(' ')}`);
2927
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneConfig);
3028
});
31-
test('Verify that user can connect to DB and see breadcrumbs at the top of the application', async t => {
29+
test.after(async() => {
30+
// Delete database
31+
await browserPage.Cli.sendCommandInCli(`DEL ${keys.join(' ')}`);
32+
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneConfig);
33+
34+
})('Verify that user can connect to DB and see breadcrumbs at the top of the application', async t => {
3235
// Create new keys
3336
keys = await Common.createArrayWithKeyValue(10);
3437
await browserPage.Cli.sendCommandInCli(`MSET ${keys.join(' ')}`);
@@ -42,3 +45,27 @@ test('Verify that user can connect to DB and see breadcrumbs at the top of the a
4245
await t.expect(workbenchPage.OverviewPanel.overviewTotalKeys.exists).ok('User can not see total keys');
4346
await t.expect(workbenchPage.OverviewPanel.overviewTotalMemory.exists).ok('User can not see total memory');
4447
});
48+
test('Verify that user can set overview refresh', async t => {
49+
const common_command = 'info';
50+
51+
await t.click(browserPage.OverviewPanel.autoRefreshArrow);
52+
await t.expect(browserPage.OverviewPanel.autoRefreshRateInput.textContent).eql('5000 s', 'default value is incorrect');
53+
await t.click(browserPage.OverviewPanel.autoRefreshCheckbox);
54+
//Start Monitor
55+
await browserPage.Profiler.startMonitor();
56+
//Wait for 6 sec
57+
await t.wait(6000);
58+
await browserPage.Profiler.checkCommandInMonitorResults(common_command, undefined, false);
59+
60+
await browserPage.Profiler.stopMonitor();
61+
await browserPage.OverviewPanel.setAutoRefreshValue('10');
62+
await t.click(browserPage.OverviewPanel.autoRefreshCheckbox);
63+
//Start Monitor
64+
await t.click( browserPage.Profiler.resetProfilerButton);
65+
await browserPage.Profiler.startMonitor();
66+
// verify that the info is not displayed after default value
67+
await t.wait(5000);
68+
await workbenchPage.Profiler.checkCommandInMonitorResults(common_command, undefined, false);
69+
// verify that the info is displayed after set value
70+
await workbenchPage.Profiler.checkCommandInMonitorResults(common_command);
71+
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fixture `Monitor`
3232
});
3333
test('Verify Monitor refresh/stop', async t => {
3434
// Run monitor
35-
await browserPage.Profiler.startMonitor();
35+
await browserPage.Profiler.startMonitorAndVerifyStart();
3636
// Close Monitor
3737
await t.click(browserPage.Profiler.closeMonitor);
3838
// Verify that monitor is not displayed
@@ -99,7 +99,7 @@ test
9999
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneBigConfig);
100100
})('Verify that user can see monitor results in high DB load', async t => {
101101
// Run monitor
102-
await browserPage.Profiler.startMonitor();
102+
await browserPage.Profiler.startMonitorAndVerifyStart();
103103
// Search by not existed key pattern
104104
await browserPage.searchByKeyName(`${chance.string({ length: 10 })}*`);
105105
// Check that the last child is updated

tests/e2e/tests/web/regression/monitor/save-commands.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fixture `Save commands`
2424
});
2525
test('Verify that when clicks on “Reset Profiler” button he brought back to Profiler home screen', async t => {
2626
// Start Monitor without Save logs
27-
await browserPage.Profiler.startMonitor();
27+
await browserPage.Profiler.startMonitorAndVerifyStart();
2828
// Remember the number of files in Temp
2929
const numberOfTempFiles = fs.readdirSync(tempDir).length;
3030
// Reset profiler
@@ -44,7 +44,7 @@ test('Verify that when clicks on “Reset Profiler” button he brought back to
4444
});
4545
test('Verify that when user clears the Profiler he doesn\'t brought back to Profiler home screen', async t => {
4646
// Start Monitor
47-
await browserPage.Profiler.startMonitor();
47+
await browserPage.Profiler.startMonitorAndVerifyStart();
4848
// Clear monitor and check the view
4949
await t.click(browserPage.Profiler.clearMonitorButton);
5050
await t.expect(browserPage.Profiler.monitorNotStartedElement.visible).notOk('Profiler home screen is still opened after Clear');

0 commit comments

Comments
 (0)