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
6 changes: 6 additions & 0 deletions tests/e2e/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,9 @@ export enum ResourcePath {
ClusterDetails = '/cluster-details',
SyncFeatures = '/features/sync',
}

export enum ExploreTabs {
Explore = 'Explore',
Insights = 'Insights',
}

20 changes: 0 additions & 20 deletions tests/e2e/pageObjects/components/base-right-side-panel.ts

This file was deleted.

47 changes: 47 additions & 0 deletions tests/e2e/pageObjects/components/explore-panel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Selector, t } from 'testcafe';
import { ExploreTabs } from '../../helpers/constants';
import { InsightTab } from './insight-tab';
import { TutorialsTab } from './tutorials-tab';

export class ExplorePanel {
// CONTAINERS
sidePanel = Selector('[data-testid=insights-panel]');
explorePanelButton = Selector('[data-testid=explore-trigger]');

/**
* Open/Close Panel
* @param state State of panel
*/
async togglePanel(state: boolean): Promise<void> {
const isPanelExists = await this.sidePanel.exists;

if (state !== isPanelExists) {
await t.click(this.explorePanelButton);
}
}

/**
* Click on Panel tab
* @param type of the tab
*/
async setActiveTab(type: ExploreTabs.Explore): Promise<TutorialsTab>
async setActiveTab(type: ExploreTabs.Insights): Promise<InsightTab>
async setActiveTab(type: ExploreTabs): Promise<TutorialsTab | InsightTab> {
// TODO check active tab
const tabSelector = Selector('[class=euiButton__text]').withExactText(type);
await t.click(tabSelector);
if(type === ExploreTabs.Explore){
return new TutorialsTab();
}

return new InsightTab();
}

/**
* Get Insights panel selector
*/
getInsightsPanel(): Selector {
return Selector('[class=euiButton__text]').withExactText(ExploreTabs.Insights);
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Selector, t } from 'testcafe';
import { RecommendationIds } from '../../helpers/constants';
import { BaseRightSidePanel } from './base-right-side-panel';

export class InsightsPanel extends BaseRightSidePanel {
export class InsightTab {
// CSS Selectors
cssKeyName = '[data-testid=recommendation-key-name]';
// BUTTONS
Expand Down
7 changes: 0 additions & 7 deletions tests/e2e/pageObjects/components/tutorials-panel.ts

This file was deleted.

18 changes: 18 additions & 0 deletions tests/e2e/pageObjects/components/tutorials-tab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Selector, t } from 'testcafe';

export class TutorialsTab {

documentButtonInQuickGuides = Selector('[data-testid=accordion-button-document]');
internalLinkWorkingWithHashes = Selector('[data-testid=internal-link-working-with-hashes]');

/**
* Run code
* @param block Name of the block
*/
async runBlockCode(block: string): Promise<void> {
const runButton = Selector('[data-testid=code-button-block-label]').withExactText(block);
await t.scrollIntoView(runButton);
await t.click(runButton);
}

}
4 changes: 2 additions & 2 deletions tests/e2e/pageObjects/instance-page.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { BasePage } from './base-page';
import { Profiler, Cli, CommandHelper } from './components/bottom-panel';
import { OverviewPanel } from './components/overview-panel';
import { InsightsPanel } from './components/insights-panel';
import { ExplorePanel } from './components/explore-panel';
export class InstancePage extends BasePage {
Profiler = new Profiler();
Cli = new Cli();
CommandHelper = new CommandHelper();
OverviewPanel = new OverviewPanel();
InsightsPanel = new InsightsPanel();
ExplorePanel = new ExplorePanel();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Selector } from 'testcafe';
import { BrowserPage, MyRedisDatabasePage, ClusterDetailsPage, WorkbenchPage } from '../../../pageObjects';
import { rte } from '../../../helpers/constants';
import { ExploreTabs, rte } from '../../../helpers/constants';
import { DatabaseHelper } from '../../../helpers/database';
import { commonUrl, ossClusterConfig } from '../../../helpers/conf';
import { DatabaseAPIRequests } from '../../../helpers/api/api-database';
Expand Down Expand Up @@ -75,12 +75,13 @@ test
for (const node of nodes) {
await t.expect(clusterDetailsPage.tableRow.nth(nodes.indexOf(node)).textContent).contains(node, `Node ${node} is not displayed in table`);
}
// Go to Workbench page
await t.click(myRedisDatabasePage.NavigationPanel.workbenchButton);
//Run Create hash index command to load network and memory
await t.click(workbenchPage.documentButtonInQuickGuides);
await t.click(workbenchPage.internalLinkWorkingWithHashes);
await t.click(workbenchPage.preselectCreateHashIndex);
await clusterDetailsPage.ExplorePanel.togglePanel(true);
const tutorials = await clusterDetailsPage.ExplorePanel.setActiveTab(ExploreTabs.Explore);

await t.click(tutorials.documentButtonInQuickGuides);
await t.click(tutorials.internalLinkWorkingWithHashes);
await tutorials.runBlockCode('Create');
await t.click(workbenchPage.submitCommandButton);
// Go to Analysis Tools page
await t.click(myRedisDatabasePage.NavigationPanel.analysisPageButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test
const connectUrlParams = {
redisUrl: `redis://${databaseUsername}:${databasePassword}@${host}:${port}`,
databaseAlias: databaseName,
redirect: 'workbench?guidePath=/quick-guides/document/introduction.md'
redirect: 'workbench'
};

await t.navigateTo(generateLink(connectUrlParams));
Expand All @@ -39,7 +39,7 @@ test
await t.click(await myRedisDatabasePage.AddRedisDatabase.addRedisDatabaseButton);
// wait for db is added
await t.wait(3_000);
await t.expect(await workbenchPage.closeEnablementPage.exists).ok('Redirection to Workbench tutorial is not correct');
await t.expect(await workbenchPage.submitCommandButton.exists).ok('Redirection to Workbench is not correct');
});

test
Expand Down Expand Up @@ -71,7 +71,7 @@ test

await t.navigateTo(generateLink(connectUrlParams));
await t.wait(3_000);
await t.expect(await workbenchPage.closeEnablementPage.exists).ok('Redirection to Workbench tutorial is not correct');
await t.expect(await workbenchPage.submitCommandButton.exists).ok('Redirection to Workbench is not correct');

//Verify that the same db is not added
await t.navigateTo(generateLink(connectUrlParams));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Chance } from 'chance';
import { DatabaseHelper } from '../../../helpers/database';
import { WorkbenchPage, MyRedisDatabasePage } from '../../../pageObjects';
import { rte } from '../../../helpers/constants';
import { MyRedisDatabasePage, WorkbenchPage } from '../../../pageObjects';
import { ExploreTabs, rte } from '../../../helpers/constants';
import { commonUrl, ossStandaloneRedisearch } from '../../../helpers/conf';
import { DatabaseAPIRequests } from '../../../helpers/api/api-database';
import { Telemetry } from '../../../helpers/telemetry';
Expand All @@ -24,7 +24,7 @@ const expectedProperties = [
];

fixture `Default scripts area at Workbench`
.meta({type: 'critical_path', rte: rte.standalone})
.meta({ type: 'critical_path', rte: rte.standalone })
.page(commonUrl)
.beforeEach(async t => {
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneRedisearch);
Expand Down Expand Up @@ -106,9 +106,12 @@ test('Verify that user can edit and run automatically added "Aggregate" script i
// Send commands
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'), 0.5);
// Run automatically added FT.Aggregate script with edits
await t.click(workbenchPage.documentButtonInQuickGuides);
await t.click(workbenchPage.internalLinkWorkingWithHashes);
await t.click(workbenchPage.preselectGroupBy);
await workbenchPage.ExplorePanel.togglePanel(true);
const tab = await workbenchPage.ExplorePanel.setActiveTab(ExploreTabs.Explore);
await t.click(tab.documentButtonInQuickGuides);
await t.click(tab.internalLinkWorkingWithHashes);
await tab.runBlockCode('Group by & sort by aggregation: COUNT');
//await t.click(workbenchPage.preselectGroupBy);
await t.pressKey('ctrl+a delete');
await workbenchPage.sendCommandInWorkbench(searchCommand);
// Check the FT.Aggregate result
Expand Down
41 changes: 26 additions & 15 deletions tests/e2e/tests/regression/insights/feature-flag.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import { BrowserPage, MyRedisDatabasePage, SettingsPage } from '../../../pageObjects';
import { RecommendationIds, rte, env } from '../../../helpers/constants';
import { RecommendationIds, rte, env, ExploreTabs } from '../../../helpers/constants';
import { DatabaseHelper } from '../../../helpers/database';
import { commonUrl, ossStandaloneConfig, ossStandaloneV5Config } from '../../../helpers/conf';
import { DatabaseAPIRequests } from '../../../helpers/api/api-database';
Expand Down Expand Up @@ -45,7 +45,8 @@ test('Verify that default config applied when remote config version is lower', a
const featureVersion = await JSON.parse(await getColumnValueFromTableInDB(featuresConfigTable, 'data')).version;

await t.expect(featureVersion).eql(2.3401, 'Config with lowest version applied');
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).notOk('Insights panel displayed when disabled in default config');
await browserPage.ExplorePanel.togglePanel(true);
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).notOk('Insights panel displayed when disabled in default config');
});
test('Verify that invaid remote config not applied even if its version is higher than in the default config', async t => {
// Update remote config .json to invalid
Expand All @@ -55,7 +56,8 @@ test('Verify that invaid remote config not applied even if its version is higher
const featureVersion = await JSON.parse(await getColumnValueFromTableInDB(featuresConfigTable, 'data')).version;

await t.expect(featureVersion).eql(2.3401, 'Config highest version not applied');
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).notOk('Insights panel displayed when disabled in default config');
await browserPage.ExplorePanel.togglePanel(true);
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).notOk('Insights panel displayed when disabled in default config');
});
test
.before(async() => {
Expand All @@ -81,49 +83,56 @@ test

await t.expect(featureVersion).eql(versionFromConfig, 'Config with invalid data applied');
// Verify that Insights panel displayed if user's controlNumber is in range from config file
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).ok('Insights panel not displayed when enabled from remote config');
await browserPage.ExplorePanel.togglePanel(true);
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).ok('Insights panel not displayed when enabled from remote config');

// Verify that recommendations displayed for all databases if option enabled
await t.click(browserPage.OverviewPanel.myRedisDBLink);
await myRedisDatabasePage.clickOnDBByName(ossStandaloneV5Config.databaseName);
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).ok('Insights panel not displayed for the other db connection');
await browserPage.InsightsPanel.toggleInsightsPanel(true);
await t.expect(browserPage.InsightsPanel.getRecommendationByName(redisVersionRecom).exists).ok('Redis Version recommendation not displayed');
await browserPage.ExplorePanel.togglePanel(true);
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).ok('Insights panel not displayed for the other db connection');
await browserPage.ExplorePanel.togglePanel(true);
const tab = await browserPage.ExplorePanel.setActiveTab(ExploreTabs.Insights);
await t.expect(tab.getRecommendationByName(redisVersionRecom).exists).ok('Redis Version recommendation not displayed');

await browserPage.InsightsPanel.toggleInsightsPanel(false);
await browserPage.ExplorePanel.togglePanel(false);
// Verify that Insights panel can be displayed for Telemetry enabled/disabled according to filters
await t.click(browserPage.NavigationPanel.settingsButton);
await settingsPage.changeAnalyticsSwitcher(false);
await t.click(myRedisDatabasePage.NavigationPanel.browserButton);
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).notOk('Insights panel displayed without analytics when its filter is on');
await browserPage.ExplorePanel.togglePanel(true);
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).notOk('Insights panel displayed without analytics when its filter is on');

// Update remote config .json to config without analytics filter
await modifyFeaturesConfigJson(pathes.analyticsConfig);
await updateControlNumber(48.2);
await browserPage.ExplorePanel.togglePanel(true);
// Verify that Insights panel can be displayed for WebStack app according to filters
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).ok('Insights panel not displayed without analytics when its filter is off');
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).ok('Insights panel not displayed without analytics when its filter is off');

// Verify that Insights panel not displayed if user's controlNumber is out of range from config file
await updateControlNumber(30.1);
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).notOk('Insights panel displayed for user with control number out of the config');
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).notOk('Insights panel displayed for user with control number out of the config');

// Update remote config .json to config with buildType filter excluding current app build
await modifyFeaturesConfigJson(pathes.buildTypeConfig);
await updateControlNumber(48.2);
await browserPage.ExplorePanel.togglePanel(true);
// Verify that buildType filter applied
featureVersion = await JSON.parse(await getColumnValueFromTableInDB(featuresConfigTable, 'data')).version;
versionFromConfig = await Common.getJsonPropertyValue('version', pathes.buildTypeConfig);
await t.expect(featureVersion).eql(versionFromConfig, 'Config highest version not applied');
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).notOk('Insights panel displayed when filter excludes this buildType');
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).notOk('Insights panel displayed when filter excludes this buildType');

// Update remote config .json to config with insights feature disabled
await modifyFeaturesConfigJson(pathes.flagOffConfig);
await updateControlNumber(48.2);
await browserPage.ExplorePanel.togglePanel(true);
// Verify that Insights panel not displayed if the remote config file has it disabled
featureVersion = await JSON.parse(await getColumnValueFromTableInDB(featuresConfigTable, 'data')).version;
versionFromConfig = await Common.getJsonPropertyValue('version', pathes.flagOffConfig);
await t.expect(featureVersion).eql(versionFromConfig, 'Config highest version not applied');
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).notOk('Insights panel displayed when filter excludes this buildType');
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).notOk('Insights panel displayed when filter excludes this buildType');
});
test
.meta({ env: env.desktop })
Expand All @@ -140,10 +149,12 @@ test
// Update remote config .json to config with buildType filter excluding current app build
await modifyFeaturesConfigJson(pathes.dockerConfig);
await updateControlNumber(48.2);
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).notOk('Insights panel displayed when filter excludes this buildType');
await browserPage.ExplorePanel.togglePanel(true);
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).notOk('Insights panel displayed when filter excludes this buildType');

// Update remote config .json to config with buildType filter including current app build
await modifyFeaturesConfigJson(pathes.electronConfig);
await updateControlNumber(48.2);
await t.expect(browserPage.InsightsPanel.insightsBtn.exists).ok('Insights panel not displayed when filter includes this buildType');
await browserPage.ExplorePanel.togglePanel(true);
await t.expect(browserPage.ExplorePanel.getInsightsPanel().exists).ok('Insights panel not displayed when filter includes this buildType');
});
Loading