Skip to content

Commit 318017a

Browse files
committed
1 parent f3be094 commit 318017a

File tree

2 files changed

+78
-5
lines changed

2 files changed

+78
-5
lines changed

tests/e2e/common-actions/browser-actions.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { t } from 'testcafe';
1+
import {Selector, t} from 'testcafe';
22
import { BrowserPage } from '../pageObjects';
33

44
const browserPage = new BrowserPage();
@@ -29,9 +29,8 @@ export class BrowserActions {
2929
}
3030
}
3131
}
32-
3332
/**
34-
* Verify toolip contains text
33+
* Verify tooltip contains text
3534
* @param expectedText Expected link that is compared with actual
3635
* @param contains Should this tooltip contains or not contains text
3736
*/
@@ -40,4 +39,17 @@ export class BrowserActions {
4039
? await t.expect(browserPage.tooltip.textContent).contains(expectedText, `"${expectedText}" Text is incorrect in tooltip`)
4140
: await t.expect(browserPage.tooltip.textContent).notContains(expectedText, `Tooltip still contains text "${expectedText}"`);
4241
}
42+
/**
43+
* Verify that the new key is displayed at the top of the list of keys and opened and pre-selected in List view
44+
* */
45+
async verifyKeyDisplayedTopAndOpened(keyName: string): Promise<void> {
46+
await t.expect(Selector('[aria-rowindex="1"]').withText(keyName).visible).ok(`element with ${keyName} is not visible in the top of list`);
47+
await t.expect(Selector('[data-testid="key-name-text"]').withText(keyName).visible).ok(`element with ${keyName} is not opened`);
48+
}
49+
/**
50+
* Verify that the new key is not displayed at the top of the list of keys and opened and pre-selected in List view
51+
* */
52+
async verifyKeyIsNotDisplayedTop(keyName: string): Promise<void> {
53+
await t.expect(Selector('[aria-rowindex="1"]').withText(keyName).visible).notOk(`element with ${keyName} is not visible in the top of list`);
54+
}
4355
}

tests/e2e/tests/regression/browser/add-keys.e2e.ts

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
import { rte } from '../../../helpers/constants';
1+
import {keyLength, rte} from '../../../helpers/constants';
22
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
33
import { BrowserPage, CliPage } from '../../../pageObjects';
44
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
55
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
6+
import {addKeysViaCli, deleteKeysViaCli, keyTypes} from '../../../helpers/keys';
7+
import {Common} from '../../../helpers/common';
8+
import {BrowserActions} from '../../../common-actions/browser-actions';
69

710
const browserPage = new BrowserPage();
11+
const browserActions = new BrowserActions();
12+
const common = new Common();
813
const cliPage = new CliPage();
914
const jsonKeys = [['JSON-string', '"test"'], ['JSON-number', '782364'], ['JSON-boolean', 'true'], ['JSON-null', 'null'], ['JSON-array', '[1, 2, 3]']];
15+
const keysData = keyTypes.map(object => ({ ...object }));
16+
let keyNames: string[];
17+
let indexName: string;
18+
keysData.forEach(key => key.keyName = `${key.keyName}` + '-' + `${common.generateWord(keyLength)}`);
1019

11-
fixture `Different JSON types creation`
20+
fixture `Add keys`
1221
.meta({
1322
type: 'regression',
1423
rte: rte.standalone
@@ -44,3 +53,55 @@ test('Verify that user can create different types(string, number, null, array, b
4453
}
4554
}
4655
});
56+
// https://redislabs.atlassian.net/browse/RI-3995
57+
test
58+
.before(async() => {
59+
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName);
60+
await addKeysViaCli(keysData);
61+
})
62+
.after(async() => {
63+
let commandString = 'DEL';
64+
for (const key of keyNames) {
65+
commandString = commandString.concat(` ${key}`);
66+
}
67+
const commands = [`FT.DROPINDEX ${indexName}`, commandString];
68+
await deleteKeysViaCli(keysData);
69+
await cliPage.sendCommandsInCli(commands);
70+
await deleteStandaloneDatabaseApi(ossStandaloneConfig);
71+
})('Verify that the new key is displayed at the top of the list', async t => {
72+
const keyName = common.generateWord(12);
73+
const keyName1 = common.generateWord(12);
74+
const keyName2 = common.generateWord(36); // to be sure element will not be displayed be at the top of list
75+
const keyName3 = common.generateWord(10);
76+
const keyName4 = `${common.generateWord(10)}-test`;
77+
const keyName5 = `hash-${common.generateWord(12)}`;
78+
keyNames = [keyName, keyName1, keyName2, keyName3, keyName4, keyName5];
79+
indexName = `idx:${keyName5}`;
80+
const command = `FT.CREATE ${indexName} ON HASH PREFIX 1 hash- SCHEMA name TEXT`;
81+
await cliPage.sendCommandInCli(command);
82+
83+
await browserPage.addStringKey(keyName);
84+
await browserActions.verifyKeyDisplayedTopAndOpened(keyName);
85+
// Verify displaying added multiple keys
86+
await browserPage.addSetKey(keyName1);
87+
await browserActions.verifyKeyDisplayedTopAndOpened(keyName1);
88+
89+
await browserPage.addHashKey(keyName2);
90+
await browserActions.verifyKeyDisplayedTopAndOpened(keyName2);
91+
// Verify that the new key is not displayed at the top when filter per key name applied
92+
await browserPage.searchByKeyName('*test');
93+
await browserPage.addHashKey(keyName4);
94+
await browserActions.verifyKeyIsNotDisplayedTop(keyName4);
95+
96+
await t.click(browserPage.clearFilterButton);
97+
await t.click(browserPage.treeViewButton);
98+
await browserPage.addHashKey(keyName3);
99+
// Verify that user can see Tree view recalculated when new key is added in Tree view
100+
await browserActions.verifyKeyDisplayedTopAndOpened(keyName3);
101+
102+
await t.click(browserPage.redisearchModeBtn);
103+
await browserPage.selectIndexByName(indexName);
104+
await browserPage.addHashKey(keyName5, '100000', 'name', 'value');
105+
// Verify that the new key is not displayed at the top for the Search capability
106+
await browserActions.verifyKeyIsNotDisplayedTop(keyName3);
107+
});

0 commit comments

Comments
 (0)