Skip to content

Commit 7d4095b

Browse files
authored
Merge pull request #1738 from RedisInsight/e2e/feature/RI-3995_add_keys
add test for https://redislabs.atlassian.net/browse/RI-3995
2 parents f3be094 + dac16c8 commit 7d4095b

File tree

2 files changed

+77
-6
lines changed

2 files changed

+77
-6
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(browserPage.keyNameFormDetails.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).exists).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: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
import { rte } from '../../../helpers/constants';
1+
import {rte} from '../../../helpers/constants';
22
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
33
import { BrowserPage, CliPage } from '../../../pageObjects';
4-
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
4+
import {commonUrl, ossStandaloneBigConfig, ossStandaloneConfig} from '../../../helpers/conf';
55
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
6+
import {Common} from '../../../helpers/common';
7+
import {BrowserActions} from '../../../common-actions/browser-actions';
68

79
const browserPage = new BrowserPage();
10+
const browserActions = new BrowserActions();
11+
const common = new Common();
812
const cliPage = new CliPage();
913
const jsonKeys = [['JSON-string', '"test"'], ['JSON-number', '782364'], ['JSON-boolean', 'true'], ['JSON-null', 'null'], ['JSON-array', '[1, 2, 3]']];
14+
let keyNames: string[];
15+
let indexName: string;
1016

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

0 commit comments

Comments
 (0)