Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions tests/e2e/common-actions/browser-actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { t } from 'testcafe';
import {Selector, t} from 'testcafe';
import { BrowserPage } from '../pageObjects';

const browserPage = new BrowserPage();
Expand Down Expand Up @@ -29,9 +29,8 @@ export class BrowserActions {
}
}
}

/**
* Verify toolip contains text
* Verify tooltip contains text
* @param expectedText Expected link that is compared with actual
* @param contains Should this tooltip contains or not contains text
*/
Expand All @@ -40,4 +39,17 @@ export class BrowserActions {
? await t.expect(browserPage.tooltip.textContent).contains(expectedText, `"${expectedText}" Text is incorrect in tooltip`)
: await t.expect(browserPage.tooltip.textContent).notContains(expectedText, `Tooltip still contains text "${expectedText}"`);
}
/**
* Verify that the new key is displayed at the top of the list of keys and opened and pre-selected in List view
* */
async verifyKeyDisplayedTopAndOpened(keyName: string): Promise<void> {
await t.expect(Selector('[aria-rowindex="1"]').withText(keyName).visible).ok(`element with ${keyName} is not visible in the top of list`);
await t.expect(browserPage.keyNameFormDetails.withText(keyName).visible).ok(`element with ${keyName} is not opened`);
}
/**
* Verify that the new key is not displayed at the top of the list of keys and opened and pre-selected in List view
* */
async verifyKeyIsNotDisplayedTop(keyName: string): Promise<void> {
await t.expect(Selector('[aria-rowindex="1"]').withText(keyName).exists).notOk(`element with ${keyName} is not visible in the top of list`);
}
}
65 changes: 62 additions & 3 deletions tests/e2e/tests/regression/browser/add-keys.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { rte } from '../../../helpers/constants';
import {rte} from '../../../helpers/constants';
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
import { BrowserPage, CliPage } from '../../../pageObjects';
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
import {commonUrl, ossStandaloneBigConfig, ossStandaloneConfig} from '../../../helpers/conf';
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
import {Common} from '../../../helpers/common';
import {BrowserActions} from '../../../common-actions/browser-actions';

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

fixture `Different JSON types creation`
fixture `Add keys`
.meta({
type: 'regression',
rte: rte.standalone
Expand Down Expand Up @@ -44,3 +50,56 @@ test('Verify that user can create different types(string, number, null, array, b
}
}
});
// https://redislabs.atlassian.net/browse/RI-3995
test
.before(async() => {
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneBigConfig, ossStandaloneBigConfig.databaseName);
})
.after(async() => {
let commandString = 'DEL';
for (const key of keyNames) {
commandString = commandString.concat(` ${key}`);
}
const commands = [`FT.DROPINDEX ${indexName}`, commandString];
await cliPage.sendCommandsInCli(commands);
await deleteStandaloneDatabaseApi(ossStandaloneBigConfig);
})('Verify that the new key is displayed at the top of the list', async t => {
const keyName = common.generateWord(12);
const keyName1 = common.generateWord(12);
const keyName2 = common.generateWord(36);
const keyName3 = common.generateWord(10);
const keyName4 = `${common.generateWord(10)}-test`;
const keyName5 = `hash-${common.generateWord(12)}`;
keyNames = [keyName, keyName1, keyName2, keyName3, keyName4, keyName5];
indexName = `idx:${keyName5}`;
const command = `FT.CREATE ${indexName} ON HASH PREFIX 1 hash- SCHEMA name TEXT`;
await cliPage.sendCommandInCli(command);

await browserPage.addStringKey(keyName);
await browserActions.verifyKeyDisplayedTopAndOpened(keyName);
// Verify displaying added multiple keys
await browserPage.addSetKey(keyName1);
await browserActions.verifyKeyDisplayedTopAndOpened(keyName1);

await browserPage.addHashKey(keyName2);
await browserActions.verifyKeyDisplayedTopAndOpened(keyName2);
// Verify that user can see the key removed from the top when refresh List view
await t.click(browserPage.refreshKeysButton);
await browserActions.verifyKeyIsNotDisplayedTop(keyName1);
// Verify that the new key is not displayed at the top when filter per key name applied
await browserPage.searchByKeyName('*test');
await browserPage.addHashKey(keyName4);
await browserActions.verifyKeyIsNotDisplayedTop(keyName4);

await t.click(browserPage.clearFilterButton);
await t.click(browserPage.treeViewButton);
await browserPage.addHashKey(keyName3);
// Verify that user can see Tree view recalculated when new key is added in Tree view
await browserActions.verifyKeyDisplayedTopAndOpened(keyName3);

await t.click(browserPage.redisearchModeBtn);
await browserPage.selectIndexByName(indexName);
await browserPage.addHashKey(keyName5, '100000', 'name', 'value');
// Verify that the new key is not displayed at the top for the Search capability
await browserActions.verifyKeyIsNotDisplayedTop(keyName3);
});