Skip to content

Commit 466c82f

Browse files
Merge pull request #4246 from RedisInsight/e2e/feature/RI-6330-disable-the-overview-refresh
E2e/feature/ri 6330 disable the overview refresh
2 parents 04244ca + 82fabd4 commit 466c82f

File tree

12 files changed

+111
-35
lines changed

12 files changed

+111
-35
lines changed

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

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,48 @@ 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
33+
* @param timeout timeout
3234
*/
33-
async checkCommandInMonitorResults(command: string, parameters?: string[]): Promise<void> {
35+
async checkCommandInMonitorResults(command: string, parameters?: string[], expected: boolean = true, timeout: number = 6000): Promise<void> {
3436
const commandArray = command.split(' ');
3537
for (const value of commandArray) {
36-
await t.expect(this.monitorCommandLinePart.withText(value).exists).ok({ timeout: 6000 });
38+
if(expected){
39+
await t.expect(this.monitorCommandLinePart.withText(value).exists).ok({ timeout: timeout });
40+
}
41+
else {
42+
await t.expect(this.monitorCommandLinePart.withText(value).exists).notOk({ timeout: 1000 });
43+
}
3744
}
3845
if (!!parameters) {
3946
for (const argument of parameters) {
40-
await t.expect(this.monitorCommandLinePart.withText(argument).exists).ok({ timeout: 6000 });
47+
await t.expect(this.monitorCommandLinePart.withText(argument).exists).ok({ timeout: timeout });
4148
}
4249
}
4350
}
4451
/**
45-
* Start monitor function
52+
* Start monitor function and verify info
4653
*/
47-
async startMonitor(): Promise<void> {
54+
async startMonitorAndVerifyStart(): Promise<void> {
4855
await t
4956
.click(this.expandMonitor)
5057
.click(this.startMonitorButton);
5158
//Check for "info" command that is sent automatically every 5 seconds from BE side
5259
await this.checkCommandInMonitorResults('info');
5360
}
61+
62+
/**
63+
* Start monitor function and verify info
64+
*/
65+
async startMonitor(): Promise<void> {
66+
if (!(await this.startMonitorButton.exists)){
67+
await t
68+
.click(this.expandMonitor)
69+
}
70+
await t
71+
.click(this.startMonitorButton);
72+
}
73+
5474
/**
5575
* Start monitor with Save log function
5676
*/

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/pageObjects/dialogs/add-redis-database-dialog.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export class AddRedisDatabaseDialog {
7272
aiChatMessage = Selector('[data-testid=ai-chat-message-btn]');
7373
aiCloseMessage = Selector('[aria-label="Closes this modal window"]');
7474

75+
getDeleteCertificate = (certificate: TlsCertificates) => Selector(`[data-testid^=delete-${certificate}-cert]`);
76+
7577
/**
7678
* Adding a new redis database
7779
* @param parameters the parameters of the database
@@ -266,7 +268,7 @@ export class AddRedisDatabaseDialog {
266268
const row = Selector('button')
267269
.find('div')
268270
.withText(name);
269-
const removeButton = `[data-testid^=delete-${certificate}-cert]`;
271+
const removeButton = String(this.getDeleteCertificate(certificate));
270272
const removeButtonFooter = Selector('[class^=_popoverFooter]');
271273

272274
if(certificate === TlsCertificates.CA){

tests/e2e/tests/electron/critical-path/database/add-ssh-db.e2e.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ test
131131
};
132132
// Verify that user can add SSH tunnel with Password for OSS Cluster database
133133
await myRedisDatabasePage.AddRedisDatabaseDialog.addStandaloneSSHDatabase(sshDbClusterPass, sshWithPass);
134+
//TODO should be deleted after https://redislabs.atlassian.net/browse/RI-5995
135+
await t.wait(6000);
134136
await myRedisDatabasePage.clickOnDBByName(sshDbClusterPass.databaseName);
135-
137+
if(! await browserPage.plusAddKeyButton.exists){
138+
await myRedisDatabasePage.clickOnDBByName(sshDbClusterPass.databaseName);
139+
}
136140
//verify that db is added and profiler works
137141
await t.click(browserPage.Profiler.expandMonitor);
138142
await t.click(browserPage.Profiler.startMonitorButton);

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/database/connecting-to-the-db.e2e.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,23 @@ test
185185
.after(async() => {
186186
// Delete databases
187187
await databaseAPIRequests.deleteStandaloneDatabaseApi(sshDbClusterPass);
188-
})('Adding OSS Cluster database with SSH', async() => {
188+
})('Adding OSS Cluster database with SSH', async t => {
189189
const sshWithPass = {
190190
...sshParams,
191191
sshPassword: 'pass'
192192
};
193193
// Verify that user can add SSH tunnel with Password for OSS Cluster database
194194
await myRedisDatabasePage.AddRedisDatabaseDialog.addStandaloneSSHDatabase(sshDbClusterPass, sshWithPass);
195+
// TODO should be deleted after https://redislabs.atlassian.net/browse/RI-5995
196+
await t.wait(6000)
195197
await myRedisDatabasePage.clickOnDBByName(sshDbClusterPass.databaseName);
198+
if(! await browserPage.plusAddKeyButton.exists){
199+
await myRedisDatabasePage.clickOnDBByName(sshDbClusterPass.databaseName);
200+
}
196201
await Common.checkURLContainsText('browser');
197202
});
198-
// Unskip in RI-6478
199-
test.skip
203+
204+
test
200205
.meta({ rte: rte.none })
201206
.before(async() => {
202207
await databaseAPIRequests.deleteAllDatabasesApi();
@@ -210,9 +215,10 @@ test.skip
210215
await t.expect(myRedisDatabasePage.starFreeDbCheckbox.exists).ok('star checkbox is not displayed next to free db link');
211216
await t.expect(myRedisDatabasePage.portCloudDb.textContent).contains('Set up in a few clicks', `create free db row is not displayed`);
212217

213-
await t.click(myRedisDatabasePage.tableRowContent);
214-
await Common.checkURL(externalPageLinkList);
215-
await goBackHistory();
218+
// skipped until https://redislabs.atlassian.net/browse/RI-6556
219+
// await t.click(myRedisDatabasePage.tableRowContent);
220+
// await Common.checkURL(externalPageLinkList);
221+
// await goBackHistory();
216222

217223
await t.click(myRedisDatabasePage.NavigationPanel.cloudButton);
218224
await Common.checkURL(externalPageLinkNavigation);

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('5 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/database-overview/database-tls-certificates.e2e.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,24 @@ fixture `tls certificates`
1313
.meta({ type: 'regression', rte: rte.none })
1414
.page(commonUrl)
1515
.beforeEach(async() => {
16+
await databaseAPIRequests.deleteAllDatabasesApi();
1617
await databaseAPIRequests.addNewStandaloneDatabaseApi(ossStandaloneConfig);
1718
await myRedisDatabasePage.reloadPage();
1819
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneTlsConfig);
1920

2021
})
2122
.afterEach(async() => {
2223
// Delete database
23-
await databaseHelper.deleteDatabase(ossStandaloneTlsConfig.databaseName);
24-
await databaseHelper.deleteDatabase(ossStandaloneConfig.databaseName);
24+
await databaseAPIRequests.deleteAllDatabasesApi();
2525
});
2626
test('Verify that user can remove added certificates', async t => {
2727
await t.click(browserPage.NavigationPanel.myRedisDBButton);
2828
await myRedisDatabasePage.clickOnEditDBByName(ossStandaloneTlsConfig.databaseName);
2929
await myRedisDatabasePage.AddRedisDatabaseDialog.removeCertificateButton(TlsCertificates.CA, 'ca');
30+
// remove if other Certificates were added
31+
if( await myRedisDatabasePage.AddRedisDatabaseDialog.getDeleteCertificate(TlsCertificates.CA).exists){
32+
await myRedisDatabasePage.AddRedisDatabaseDialog.removeCertificateButton(TlsCertificates.CA, 'ca');
33+
}
3034
await myRedisDatabasePage.reloadPage();
3135
// wait for dbs are displayed
3236
await t.expect(myRedisDatabasePage.dbNameList.count).gt(0);
@@ -52,7 +56,7 @@ test('Verify that user can remove added certificates', async t => {
5256
await myRedisDatabasePage.reloadPage();
5357

5458
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName!);
55-
59+
5660
await t.click(browserPage.NavigationPanel.myRedisDBButton);
5761
await myRedisDatabasePage.clickOnDBByName(ossStandaloneTlsConfig.databaseName);
5862
await t.expect(browserPage.Toast.toastError.textContent).contains('CA or Client certificate', 'user can connect to db without certificates');

0 commit comments

Comments
 (0)