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
15 changes: 11 additions & 4 deletions tests/e2e/helpers/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class Common {
* @param length The amount of array elements
*/
async createArrayWithKeyValue(length: number): Promise<string[]> {
const arr = [];
const arr: string[] = [];
for(let i = 1; i <= length * 2; i++) {
arr[i] = `${chance.word({ length: 10 })}-key${i}`;
arr[i + 1] = `${chance.word({ length: 10 })}-value${i}`;
Expand All @@ -49,7 +49,7 @@ export class Common {
* @param length The amount of array elements
*/
async createArrayWithKeyValueForOSSCluster(length: number): Promise<string[]> {
const arr = [];
const arr: string[] = [];
for(let i = 1; i <= length * 2; i++) {
arr[i] = `{user1}:${chance.word({ length: 10 })}-key${i}`;
arr[i + 1] = `${chance.word({ length: 10 })}-value${i}`;
Expand All @@ -64,7 +64,7 @@ export class Common {
* @param keyName The name of the key
*/
async createArrayWithKeyValueAndKeyname(length: number, keyName: string): Promise<string[]> {
const keyNameArray = [];
const keyNameArray: string[] = [];
for(let i = 1; i <= length; i++) {
const key = `${keyName}${i}`;
const value = `value${i}`;
Expand All @@ -86,7 +86,7 @@ export class Common {
* @param length The amount of array elements
*/
async createArray(length: number): Promise<string[]> {
const arr = [];
const arr: string[] = [];
for(let i = 1; i <= length; i++) {
arr[i] = `${i}`;
}
Expand Down Expand Up @@ -123,4 +123,11 @@ export class Common {
getEndpoint(): string {
return apiUrl;
}

/**
* Reload page
*/
async reloadPage(): Promise<void> {
await t.eval(() => location.reload());
}
}
8 changes: 5 additions & 3 deletions tests/e2e/helpers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CliPage
} from '../pageObjects';
import { addNewStandaloneDatabaseApi, discoverSentinelDatabaseApi } from './api/api-database';
import { Common } from './common';

const myRedisDatabasePage = new MyRedisDatabasePage();
const addRedisDatabasePage = new AddRedisDatabasePage();
Expand All @@ -18,6 +19,7 @@ const autoDiscoverREDatabases = new AutoDiscoverREDatabases();
const browserPage = new BrowserPage();
const userAgreementPage = new UserAgreementPage();
const cliPage = new CliPage();
const common = new Common();

/**
* Add a new database manually using host and port
Expand Down Expand Up @@ -126,7 +128,7 @@ export async function acceptLicenseTermsAndAddDatabaseApi(databaseParameters: Ad
await acceptLicenseTerms();
await addNewStandaloneDatabaseApi(databaseParameters);
// Reload Page to see the new added database through api
await t.eval(() => location.reload());
await common.reloadPage();
//Connect to DB
await myRedisDatabasePage.clickOnDBByName(databaseName);
}
Expand All @@ -151,7 +153,7 @@ export async function acceptLicenseTermsAndAddSentinelDatabaseApi(databaseParame
await acceptLicenseTerms();
await discoverSentinelDatabaseApi(databaseParameters);
// Reload Page to see the database added through api
await t.eval(() => location.reload());
await common.reloadPage();
//Connect to DB
await myRedisDatabasePage.clickOnDBByName(databaseParameters.name[1] ?? '');
}
Expand Down Expand Up @@ -182,7 +184,7 @@ export async function acceptLicenseTermsAndAddRECloudDatabase(databaseParameters
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
// Reload page until db appears
do {
await t.eval(() => location.reload());
await common.reloadPage();
}
while (!(await dbSelector.exists) && Date.now() - startTime < searchTimeout);
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseParameters.databaseName ?? '').exists).ok('The existence of the database', { timeout: 5000 });
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/pageObjects/my-redis-databases-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class MyRedisDatabasePage {
await t.click(this.toastCloseButton);
}
const db = this.dbNameList.withExactText(dbName.trim());
await t.expect(db.exists).ok('The database exists', {timeout: 10000});
await t.expect(db.exists).ok(`"${dbName}" database doesn't exist`, {timeout: 10000});
await t.click(db);
}

Expand Down
20 changes: 20 additions & 0 deletions tests/e2e/pageObjects/settings-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ export class SettingsPage {
accordionAppearance = Selector('[data-test-subj=accordion-appearance]');
accordionPrivacySettings = Selector('[data-test-subj=accordion-privacy-settings]');
accordionAdvancedSettings = Selector('[data-test-subj=accordion-advanced-settings]');
accordionWorkbenchSettings = Selector('[data-test-subj=accordion-workbench-settings]');
switchAnalyticsOption = Selector('[data-testid=switch-option-analytics]');
switchEulaOption = Selector('[data-testid=switch-option-eula]');
submitConsentsPopupButton = Selector('[data-testid=consents-settings-popup] [data-testid=btn-submit]');
switchNotificationsOption = Selector('[data-testid=switch-option-notifications]');
switchEditorCleanupOption = Selector('[data-testid=switch-workbench-cleanup]');
//TEXT INPUTS (also referred to as 'Text fields')
keysToScanValue = Selector('[data-testid=keys-to-scan-value]');
keysToScanInput = Selector('[data-testid=keys-to-scan-input]');
Expand Down Expand Up @@ -65,4 +67,22 @@ export class SettingsPage {
async getEulaSwitcherValue(): Promise<string> {
return await this.switchEulaOption.getAttribute('aria-checked');
}

/**
* Get state of Editor Cleanup switcher
*/
async getEditorCleanupSwitcherValue(): Promise<string> {
return await this.switchEditorCleanupOption.getAttribute('aria-checked');
}

/**
* Enable Editor Cleanup switcher
* @param state Enabled(true) or disabled(false)
*/
async changeEditorCleanupSwitcher(state: boolean): Promise<void> {
const currentState = await this.getEditorCleanupSwitcherValue();
if (currentState !== `${state}`) {
await t.click(this.switchEditorCleanupOption);
}
}
}
12 changes: 7 additions & 5 deletions tests/e2e/pageObjects/workbench-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class WorkbenchPage {
cssMonacoCommandPaletteLine = '[aria-label="Command Palette"]';
cssQueryTextResult = '[data-testid=query-cli-result]';
cssQueryTableResult = '[data-testid^=query-table-result-]';
cssQueryPluginResult = '[data-testid^=query-table-result-]';
queryGraphContainer = '[data-testid=query-graph-container]';
cssQueryCardCommand = '[data-testid=query-card-command]';
cssQueryCardCommandResult = '[data-testid=query-common-result]';
Expand Down Expand Up @@ -55,6 +56,7 @@ export class WorkbenchPage {
preselectModelBikeSalesButton = Selector('[data-testid="preselect-Model bike sales"]');
showSalesPerRegiomButton = Selector('[data-testid="preselect-Show all sales per region"]');
queryCardNoModuleButton = Selector('[data-testid=query-card-no-module-button] a');
rawModeBtn = Selector('[data-testid="btn-change-mode"]');
//ICONS
noCommandHistoryIcon = Selector('[data-testid=wb_no-results__icon]');
//LINKS
Expand Down Expand Up @@ -130,7 +132,7 @@ export class WorkbenchPage {
//Select Table view option in Workbench results
async selectViewTypeTable(): Promise<void> {
await t.click(this.selectViewType);
await t.click(this.tableViewTypeOption);
await t.doubleClick(this.tableViewTypeOption);
}

//Select view option in Workbench results
Expand Down Expand Up @@ -161,16 +163,16 @@ export class WorkbenchPage {
}

/**
* Send commands array in Workbench page
* @param command The array of commands to send
* @param result The array of commands to send
* Check the last command and result in workbench
* @param command The command to check
* @param result The result to check
*/
async checkWorkbenchCommandResult(command: string, result: string): Promise<void> {
//Compare the command with executed command
const actualCommand = await this.queryCardContainer.nth(0).find(this.cssQueryCardCommand).textContent;
await t.expect(actualCommand).eql(command);
//Compare the command result with executed command
const actualCommandResult = await this.queryCardContainer.nth(0).find(this.cssQueryCardCommandResult).textContent;
const actualCommandResult = await this.queryCardContainer.nth(0).find(this.cssQueryTextResult).textContent;
await t.expect(actualCommandResult).eql(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test
//Add database with different modules
await t.click(myRedisDatabasePage.myRedisDBButton);
await addNewStandaloneDatabaseApi(ossStandaloneRedisearch);
await t.eval(() => location.reload());
await common.reloadPage();
await myRedisDatabasePage.clickOnDBByName(ossStandaloneRedisearch.databaseName);
countOfModules = await browserPage.modulesButton.count;
for(let i = 0; i < countOfModules; i++) {
Expand Down Expand Up @@ -123,7 +123,7 @@ test
//Add database with more than 1M keys
await t.click(myRedisDatabasePage.myRedisDBButton);
await addNewStandaloneDatabaseApi(ossStandaloneBigConfig);
await t.eval(() => location.reload());
await common.reloadPage();
await myRedisDatabasePage.clickOnDBByName(ossStandaloneBigConfig.databaseName);
//Wait 5 seconds
await t.wait(fiveSecondsTimeout);
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/critical-path/browser/filtering.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ test('Verify that user can see filtering per key name starts when he press Enter
await t.pressKey('enter');
await t.expect(browserPage.searchAdvices.visible).ok('The filtering is set');
//Check the filtering starts by clicks the control
await t.eval(() => location.reload());
await common.reloadPage();
await t.typeText(browserPage.filterByPatterSearchInput, keyName);
await t.click(browserPage.searchButton);
await t.expect(browserPage.searchAdvices.visible).ok('The filtering is set');
Expand Down
3 changes: 1 addition & 2 deletions tests/e2e/tests/critical-path/browser/json-key.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ fixture `JSON Key verification`
await browserPage.deleteKeyByName(keyName);
await deleteStandaloneDatabaseApi(ossStandaloneConfig);
})
//skipped due the issue https://redislabs.atlassian.net/browse/RI-2866
test.skip
test
.meta({ rte: rte.standalone })
('Verify that user can not add invalid JSON structure inside of created JSON', async t => {
keyName = chance.word({ length: 10 });
Expand Down
20 changes: 11 additions & 9 deletions tests/e2e/tests/critical-path/database/clone-databases.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ import {
deleteStandaloneDatabaseApi,
discoverSentinelDatabaseApi
} from '../../../helpers/api/api-database';
import { Common } from '../../../helpers/common';

const addRedisDatabasePage = new AddRedisDatabasePage();
const myRedisDatabasePage = new MyRedisDatabasePage();
const common = new Common();
const newOssDatabaseAlias = 'cloned oss cluster';

fixture `Clone databases`
.meta({ type: 'critical_path' })
.page(commonUrl);
test
.before(async t => {
.before(async () => {
await acceptLicenseTerms();
await addNewStandaloneDatabaseApi(ossStandaloneConfig);
await t.eval(() => location.reload());
await common.reloadPage();
})
.after(async() => {
.after(async () => {
// Delete databases
const dbNumber = await myRedisDatabasePage.dbNameList.withExactText(ossStandaloneConfig.databaseName).count;
for (let i = 0; i < dbNumber; i++) {
Expand All @@ -51,10 +53,10 @@ test
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossStandaloneConfig.databaseName).count).eql(2, 'DB was not cloned');
});
test
.before(async t => {
.before(async () => {
await acceptLicenseTerms();
await addNewOSSClusterDatabaseApi(ossClusterConfig);
await t.eval(() => location.reload());
await common.reloadPage();
})
.after(async() => {
// Delete database
Expand All @@ -75,19 +77,19 @@ test
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossClusterConfig.ossClusterDatabaseName).visible).ok('Original DB is not displayed');
});
test
.before(async t => {
.before(async () => {
await acceptLicenseTerms();
// Add Sentinel databases
await discoverSentinelDatabaseApi(ossSentinelConfig);
await t.eval(() => location.reload());
await common.reloadPage();
})
.after(async t => {
.after(async () => {
// Delete all primary groups
const sentinelCopy = ossSentinelConfig;
sentinelCopy.masters.push(ossSentinelConfig.masters[1]);
sentinelCopy.name.push(ossSentinelConfig.name[1]);
await deleteAllSentinelDatabasesApi(sentinelCopy);
await t.eval(() => location.reload());
await common.reloadPage();
})
.meta({ rte: rte.sentinel })('Verify that user can clone Sentinel', async t => {
await myRedisDatabasePage.clickOnEditDBByName(ossSentinelConfig.name[1]);
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/tests/critical-path/database/modules.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ import { acceptLicenseTerms } from '../../../helpers/database';
import { MyRedisDatabasePage, DatabaseOverviewPage } from '../../../pageObjects';
import { commonUrl, ossStandaloneRedisearch } from '../../../helpers/conf';
import { addNewStandaloneDatabaseApi, deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
import { Common } from '../../../helpers/common';

const myRedisDatabasePage = new MyRedisDatabasePage();
const databaseOverviewPage = new DatabaseOverviewPage();
const common = new Common();

const moduleNameList = ['RediSearch', 'RedisJSON', 'RedisGraph', 'RedisTimeSeries', 'RedisBloom', 'RedisGears', 'RedisAI'];
const moduleList = [myRedisDatabasePage.moduleSearchIcon, myRedisDatabasePage.moduleJSONIcon, myRedisDatabasePage.moduleGraphIcon, myRedisDatabasePage.moduleTimeseriesIcon, myRedisDatabasePage.moduleBloomIcon, myRedisDatabasePage.moduleGearsIcon, myRedisDatabasePage.moduleAIIcon];

fixture `Database modules`
.meta({ type: 'critical_path' })
.page(commonUrl)
.beforeEach(async t => {
.beforeEach(async () => {
await acceptLicenseTerms();
await addNewStandaloneDatabaseApi(ossStandaloneRedisearch);
// Reload Page
await t.eval(() => location.reload());
await common.reloadPage();
})
.afterEach(async() => {
//Delete database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,25 @@ import { commonUrl } from '../../../helpers/conf';
import { rte } from '../../../helpers/constants';
import { NotificationPage, MyRedisDatabasePage } from '../../../pageObjects';
import { NotificationParameters } from '../../../pageObjects/notification-page';
import { Common } from '../../../helpers/common';
const description = require('./notifications.json');
const jsonNotifications: NotificationParameters[] = description.notifications;

const notificationPage = new NotificationPage();
const myRedisDatabasePage = new MyRedisDatabasePage();
const common = new Common();

// Sort all notifications in json file
const sortedNotifications = jsonNotifications.sort((a, b) => a.timestamp < b.timestamp ? 1 : -1);

fixture `Notifications`
.meta({ rte: rte.none, type: 'critical_path' })
.page(commonUrl)
.beforeEach(async t => {
.beforeEach(async () => {
await acceptLicenseTerms();
await notificationPage.changeNotificationsSwitcher(true);
await deleteAllNotificationsFromDB();
await t.eval(() => location.reload());
await common.reloadPage();
});
test('Verify that when manager publishes new notification, it appears in the app', async t => {
// Get number of notifications in the badge
Expand Down Expand Up @@ -108,7 +111,7 @@ test
await acceptLicenseTerms();
await notificationPage.changeNotificationsSwitcher(false);
await deleteAllNotificationsFromDB();
await t.eval(() => location.reload());
await common.reloadPage();
await t.expect(notificationPage.notificationBadge.exists).notOk('No badge');
})('Verify that new popup message is not displayed when notifications are turned off', async t => {
// Verify that user can see notification badge increased when new messages is sent and notifications are turned off
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { commonUrl, ossStandaloneConfig, ossStandaloneV5Config } from '../../../
import { env, rte } from '../../../helpers/constants';
import { verifyMessageDisplayingInPubSub } from '../../../helpers/pub-sub';
import { addNewStandaloneDatabaseApi, deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
import { Common } from '../../../helpers/common';

const myRedisDatabasePage = new MyRedisDatabasePage();
const pubSubPage = new PubSubPage();
const cliPage = new CliPage();
const common = new Common();

fixture `Subscribe/Unsubscribe from a channel`
.meta({ env: env.web, rte: rte.standalone, type: 'critical_path' })
Expand Down Expand Up @@ -65,7 +67,7 @@ test
await acceptLicenseTerms();
await addNewStandaloneDatabaseApi(ossStandaloneV5Config);
await addNewStandaloneDatabaseApi(ossStandaloneConfig);
await t.eval(() => location.reload());
await common.reloadPage();
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
//Go to PubSub page
await t.click(myRedisDatabasePage.pubSubButton);
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/tests/critical-path/settings/settings.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { MyRedisDatabasePage, SettingsPage } from '../../../pageObjects';
import { rte } from '../../../helpers/constants';
import { acceptLicenseTerms } from '../../../helpers/database';
import { commonUrl } from '../../../helpers/conf';
import { Common } from '../../../helpers/common';

const myRedisDatabasePage = new MyRedisDatabasePage();
const settingsPage = new SettingsPage();
const common = new Common();

const explicitErrorHandler = (): void => {
window.addEventListener('error', e => {
Expand All @@ -30,7 +32,7 @@ test
await t.click(settingsPage.accordionAdvancedSettings);
await settingsPage.changeKeysToScanValue('1500');
// Reload Page
await t.eval(() => location.reload());
await common.reloadPage();
// Check that value was set
await t.click(settingsPage.accordionAdvancedSettings);
await t.expect(settingsPage.keysToScanValue.textContent).eql('1500', 'Keys to Scan has proper value');
Expand All @@ -49,7 +51,7 @@ test
for (const value of equalValues) {
await t.click(settingsPage.switchAnalyticsOption);
// Reload Page
await t.eval(() => location.reload());
await common.reloadPage();
await t.click(settingsPage.accordionPrivacySettings);
await t.expect(await settingsPage.getAnalyticsSwitcherValue()).eql(value, 'Analytics was switched properly');
}
Expand Down
Loading