Skip to content

Commit 01470f8

Browse files
committed
add tests for highlight big keys
1 parent 5f04d04 commit 01470f8

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export class MemoryEfficiencyPage {
2626
topKeysKeyName = Selector('[data-testid=top-keys-table-name]');
2727
topNamespacesEmptyContainer = Selector('[data-testid=top-namespaces-empty]');
2828
topNamespacesEmptyMessage = Selector('[data-testid=top-namespaces-message]');
29+
topKeysKeySizeCell = Selector('[data-testid^=nsp-usedMemory-value]');
30+
topKeysLengthCell = Selector('[data-testid^=length-value]');
2931
// TABLE
3032
namespaceTable = Selector('[data-testid=nsp-table-memory]');
3133
nameSpaceTableRows = this.namespaceTable.find('[data-testid^=row-]');

tests/e2e/tests/critical-path/memory-efficiency/top-keys-table.e2e.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ import { rte } from '../../../helpers/constants';
55
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
66
import { commonUrl, ossStandaloneRedisearch } from '../../../helpers/conf';
77
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
8-
import { deleteAllKeysFromDB, populateDBWithHashes } from '../../../helpers/keys';
8+
import { deleteAllKeysFromDB, populateDBWithHashes, populateHashWithFields } from '../../../helpers/keys';
9+
import { Common } from '../../../helpers/common';
910

1011
const memoryEfficiencyPage = new MemoryEfficiencyPage();
1112
const myRedisDatabasePage = new MyRedisDatabasePage();
1213
const browserPage = new BrowserPage();
1314
const cliPage = new CliPage();
15+
const common = new Common();
1416
const chance = new Chance();
1517

1618
const keyToAddParameters = { keysCount: 13, keyNameStartWith: 'hashKey'};
19+
const keyName = `TestHashKey-${common.generateWord(10)}`;
20+
const keyToAddParameters2 = { fieldsCount: 80000, keyName, fieldStartWith: 'hashField', fieldValueStartWith: 'hashValue' };
1721
const members = [...Array(100).keys()].toString().replace(/,/g, ' '); // The smallest key
1822
const keyNamesMemory = ['string', 'list', 'bloom', 'set'];
1923
const keyNamesLength = ['string', 'set', 'list'];
@@ -66,3 +70,25 @@ test
6670
await t.click(memoryEfficiencyPage.topKeysKeyName.nth(1).find('button'));
6771
await t.expect(browserPage.keyNameFormDetails.find('b').textContent).eql(keyNamesLength[1]);
6872
});
73+
test
74+
.before(async t => {
75+
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneRedisearch, ossStandaloneRedisearch.databaseName);
76+
// Create keys
77+
await populateHashWithFields('localhost', '8102', keyToAddParameters2);
78+
// Go to Analysis Tools page
79+
await t.click(myRedisDatabasePage.analysisPageButton);
80+
})
81+
.after(async t => {
82+
await t.click(myRedisDatabasePage.browserButton);
83+
await browserPage.deleteKeyByName(keyName);
84+
await deleteStandaloneDatabaseApi(ossStandaloneRedisearch);
85+
})('Big highlighted key tooltip', async t => {
86+
const tooltipText = 'Consider splitting it into multiple keys';
87+
88+
await t.click(memoryEfficiencyPage.newReportBtn);
89+
// Tooltip with text "Consider splitting it into multiple keys" is displayed for highlighted keys
90+
await t.hover(memoryEfficiencyPage.topKeysKeySizeCell);
91+
await t.expect(browserPage.tooltip.textContent).contains(tooltipText, `"${tooltipText}" is not displayed in Key size tooltip`);
92+
await t.hover(memoryEfficiencyPage.topKeysLengthCell);
93+
await t.expect(browserPage.tooltip.textContent).contains(tooltipText, `"${tooltipText}" is not displayed in Length tooltip`);
94+
});

0 commit comments

Comments
 (0)