Skip to content

Commit 569e8e1

Browse files
author
ALENA NABOKA
committed
add e2e for top keys
1 parent e4bfb6d commit 569e8e1

File tree

6 files changed

+75
-3
lines changed

6 files changed

+75
-3
lines changed

redisinsight/ui/src/components/monitor/Monitor/Monitor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const Monitor = (props: Props) => {
7676
</EuiFlexItem>
7777
<EuiFlexItem grow={false}>
7878
<EuiTextColor color="warning" className="warning--light" style={{ paddingLeft: 4 }} data-testid="monitor-warning-message">
79-
Running Profiler will decrease throughput, avoid running it in production databases
79+
Running Profiler will decrease throughput, avoid running it in production databases.
8080
</EuiTextColor>
8181
</EuiFlexItem>
8282
</EuiFlexGroup>

redisinsight/ui/src/pages/databaseAnalysis/components/empty-analysis-message/EmptyAnalysisMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface Props {
1515
const emptyMessageContent: { [key in EmptyMessage]: Content } = {
1616
[EmptyMessage.Reports]: {
1717
title: 'No Reports found',
18-
text: () => 'Run "New Analysis" to generate first report'
18+
text: () => 'Run "New Analysis" to generate first report.'
1919
},
2020
[EmptyMessage.Keys]: {
2121
title: 'No keys to display',

tests/e2e/pageObjects/memory-efficiency-page.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ export class MemoryEfficiencyPage {
1414
showNoExpiryToggle = Selector('[data-testid=show-no-expiry-switch]');
1515
reportItem = Selector('[data-test-subj^=items-report-]');
1616
selectedReport = Selector('[data-testid=select-report]');
17+
sortByLength = Selector('[data-testid=btn-change-table-keys]');
1718
// ICONS
1819
reportTooltipIcon = Selector('[data-testid=db-new-reports-icon]');
1920
// TEXT ELEMENTS
2021
noReportsText = Selector('[data-testid=empty-analysis-no-reports]');
2122
noKeysText = Selector('[data-testid=empty-analysis-no-keys]');
2223
scannedPercentageInReport = Selector('[data-testid=analysis-progress]');
2324
scannedKeysInReport = Selector('[data-testid=bulk-delete-summary]');
25+
topKeysTitle = Selector('[data-testid=top-keys-title]');
26+
topKeysKeyName = Selector('[data-testid=top-keys-table-name]');
2427
// TABLE
2528
tableRows = Selector('tr[class*=euiTableRow]');
2629
expandedRow = Selector('#row_test_expansion');

tests/e2e/tests/critical-path/memory-efficiency/memory-efficiency.e2e.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,6 @@ test
249249
await t.click(myRedisDatabasePage.workbenchButton);
250250
await t.click(myRedisDatabasePage.analysisPageButton);
251251
await t.expect(memoryEfficiencyPage.donutTotalKeys.sibling(1).textContent).eql(numberOfKeys[2], 'Context is not saved');
252+
// Verify that user can see top keys table saved as context
253+
await t.expect(memoryEfficiencyPage.topKeysKeyName.count).eql(parseInt(numberOfKeys[2]), 'Top Keys table is not saved as context');
252254
});
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { Chance } from 'chance';
2+
import { Selector } from 'testcafe';
3+
import { MyRedisDatabasePage, MemoryEfficiencyPage, BrowserPage, CliPage } from '../../../pageObjects';
4+
import { rte } from '../../../helpers/constants';
5+
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
6+
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
7+
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
8+
import { populateDBWithHashes } from '../../../helpers/keys';
9+
10+
const memoryEfficiencyPage = new MemoryEfficiencyPage();
11+
const myRedisDatabasePage = new MyRedisDatabasePage();
12+
const browserPage = new BrowserPage();
13+
const cliPage = new CliPage();
14+
const chance = new Chance();
15+
16+
const keyToAddParameters = { keysCount: 13, keyNameStartWith: 'hashKey'};
17+
const members = [...Array(100).keys()].toString().replace(/,/g, ' '); // The smallest key
18+
const keyNamesMemory = ['string', 'list', 'bloom', 'set'];
19+
const keyNamesLength = ['string', 'set', 'list'];
20+
const mbloomCommand = 'bf.add bloom 1';
21+
const listCommand = `rpush list ${members.slice(0, -3)}`;
22+
const stringCommand = `set string "${chance.paragraph({ sentences: 100 })}"`; // The biggest key
23+
const setCommand = `sadd set ${members}`; // Middle key
24+
25+
fixture `Memory Efficiency Top Keys Table`
26+
.meta({ type: 'critical_path', rte: rte.standalone })
27+
.page(commonUrl);
28+
test
29+
.before(async t => {
30+
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName);
31+
// Create keys
32+
await populateDBWithHashes(ossStandaloneConfig.host, ossStandaloneConfig.port, keyToAddParameters);
33+
// Go to Analysis Tools page
34+
await t.click(myRedisDatabasePage.analysisPageButton);
35+
})
36+
.after(async() => {
37+
await cliPage.sendCommandInCli('flushdb');
38+
await deleteStandaloneDatabaseApi(ossStandaloneConfig);
39+
})('Top Keys displaying in Summary of big keys', async t => {
40+
// Verify that user can see “-” as length for all unsupported data types
41+
await cliPage.sendCommandInCli(mbloomCommand);
42+
await t.click(memoryEfficiencyPage.newReportBtn);
43+
await t.expect(Selector('[data-testid=length-empty-bloom]').textContent).eql('-', 'Length is defined for unknown types');
44+
// Verify that user cannot see quantifier if keys are less than 15
45+
await t.expect(memoryEfficiencyPage.topKeysTitle.textContent).eql('TOP KEYS', 'Title is not correct');
46+
// Verify that top 15 keys are displayed per memory
47+
await cliPage.sendCommandInCli(listCommand);
48+
await cliPage.sendCommandInCli(stringCommand);
49+
await cliPage.sendCommandInCli(setCommand);
50+
await t.click(memoryEfficiencyPage.newReportBtn);
51+
await t.expect(memoryEfficiencyPage.topKeysTitle.textContent).eql('TOP 15 KEYS', 'Title is not correct');
52+
await t.expect(memoryEfficiencyPage.topKeysKeyName.count).eql(15, 'Number of lines is not 15');
53+
// Verify that sorting by Key Size DESC applied by default in by Memory tab
54+
for (let i = 0; i < 4; i++) {
55+
await t.expect(memoryEfficiencyPage.topKeysKeyName.nth(i).textContent).eql(keyNamesMemory[i], 'Key name by Memory order is not correct');
56+
}
57+
// Verify that top 15 keys are displayed per length
58+
await t.click(memoryEfficiencyPage.sortByLength);
59+
await t.expect(memoryEfficiencyPage.topKeysKeyName.count).eql(15, 'Number of lines is not 15');
60+
// Verify that sorting by Length DESC applied by default in by Length tab
61+
for (let i = 0; i < 3; i++) {
62+
await t.expect(memoryEfficiencyPage.topKeysKeyName.nth(i).textContent).eql(keyNamesLength[i], 'Key name by Length order is not correct');
63+
}
64+
// Verify that user can click on a key name and see key details in Browser
65+
await t.click(memoryEfficiencyPage.topKeysKeyName.nth(1).find('button'));
66+
await t.expect(browserPage.keyNameFormDetails.find('b').textContent).eql(keyNamesLength[1]);
67+
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test
4343
await t.expect(monitorPage.startMonitorButton.exists).ok('Start profiler button');
4444
//Verify that user can see message inside Monitor "Running Monitor will decrease throughput, avoid running it in production databases." when opens it for the first time
4545
await t.expect(monitorPage.monitorWarningMessage.exists).ok('Profiler warning message');
46-
await t.expect(monitorPage.monitorWarningMessage.withText('Running Profiler will decrease throughput, avoid running it in production databases').exists).ok('Profiler warning message is correct');
46+
await t.expect(monitorPage.monitorWarningMessage.withText('Running Profiler will decrease throughput, avoid running it in production databases.').exists).ok('Profiler warning message is not correct');
4747
//Verify that user can run Monitor by clicking "Run" command in the message inside Monitor
4848
await t.click(monitorPage.startMonitorButton);
4949
await t.expect(monitorPage.monitorIsStartedText.innerText).eql('Profiler is started.');

0 commit comments

Comments
 (0)