Skip to content

Commit f2ae0a5

Browse files
Merge pull request #2923 from RedisInsight/e2e/feature/RI-5222_show_relevant_tutorial
add test
2 parents f1d08df + c69c371 commit f2ae0a5

File tree

5 files changed

+64
-4
lines changed

5 files changed

+64
-4
lines changed

redisinsight/ui/src/components/database-side-panels/panels/enablement-area/EnablementArea/components/InternalPage/InternalPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const InternalPage = (props: Props) => {
171171
</EuiButtonEmpty>
172172
)}
173173
>
174-
<div>
174+
<div data-testid="explore-capability-popover">
175175
<RocketIcon className={styles.rocketIcon} />
176176
<EuiText className={styles.popoverTitle}>Explore Redis</EuiText>
177177
<EuiText className={styles.popoverText}>

tests/e2e/helpers/api/api-database.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ export class DatabaseAPIRequests {
2323
* @param databaseParameters The database parameters
2424
*/
2525
async addNewStandaloneDatabaseApi(
26-
databaseParameters: AddNewDatabaseParameters
26+
databaseParameters: AddNewDatabaseParameters, isCloud = false
2727
): Promise<void> {
2828
const uniqueId = chance.string({ length: 10 });
29+
const uniqueIdNumber = chance.integer({ min: 1, max: 1000 });
2930
const requestBody: {
3031
name?: string,
3132
host: string,
@@ -42,6 +43,13 @@ export class DatabaseAPIRequests {
4243
name: string,
4344
certificate?: string,
4445
key?: string
46+
},
47+
cloudDetails?: {
48+
cloudId: number,
49+
subscriptionType: string,
50+
planMemoryLimit: number,
51+
memoryLimitMeasurementUnit: string,
52+
free: boolean
4553
}
4654
} = {
4755
name: databaseParameters.databaseName,
@@ -64,6 +72,16 @@ export class DatabaseAPIRequests {
6472
key: databaseParameters.clientCert!.key
6573
};
6674
}
75+
76+
if(isCloud) {
77+
requestBody.cloudDetails = {
78+
cloudId: uniqueIdNumber,
79+
subscriptionType: 'fixed',
80+
planMemoryLimit: 30,
81+
memoryLimitMeasurementUnit: 'mb',
82+
free: true
83+
};
84+
}
6785
const response = await sendPostRequest(
6886
ResourcePath.Databases,
6987
requestBody

tests/e2e/pageObjects/browser-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ export class BrowserPage extends InstancePage {
261261
keyListItem = Selector('[role=rowgroup] [role=row]');
262262
// Dialog
263263
noReadySearchDialogTitle = Selector('[data-testid=welcome-page-title]');
264+
closeDialogButton = Selector('[class*=euiModal__closeIcon]');
264265

265266
/**
266267
* Common part for Add any new key

tests/e2e/pageObjects/components/insights-panel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export class InsightsPanel {
1313
recommendationsTab = Selector('[data-testid=recommendations-tab]');
1414
exploreTab = Selector('[data-testid=explore-tab]');
1515

16+
existsCompatibilityPopover = Selector('[data-testid=explore-capability-popover]');
17+
1618
/**
1719
* Open/Close Panel
1820
* @param state State of panel

tests/e2e/tests/web/regression/insights/open-insights-panel.e2e.ts

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
import { BrowserPage, WorkbenchPage } from '../../../../pageObjects';
1+
import { BrowserPage, MyRedisDatabasePage, WorkbenchPage } from '../../../../pageObjects';
22
import { ExploreTabs, rte } from '../../../../helpers/constants';
33
import { DatabaseHelper } from '../../../../helpers/database';
4-
import { commonUrl, ossStandaloneConfig } from '../../../../helpers/conf';
4+
import {
5+
commonUrl,
6+
ossStandaloneConfig,
7+
ossStandaloneV5Config
8+
} from '../../../../helpers/conf';
59
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
610

711
const browserPage = new BrowserPage();
812
const workbenchPage = new WorkbenchPage();
13+
const myRedisDatabasePage = new MyRedisDatabasePage();
914

1015
const databaseHelper = new DatabaseHelper();
1116
const databaseAPIRequests = new DatabaseAPIRequests();
@@ -30,3 +35,37 @@ test('Verify Explore redis tab is opened from empty screens', async t => {
3035
await t.click(workbenchPage.exploreRedisBtn);
3136
await t.expect(await browserPage.InsightsPanel.getActiveTabName()).eql(ExploreTabs.Explore);
3237
});
38+
test
39+
.before(async t => {
40+
await databaseHelper.acceptLicenseTerms();
41+
await databaseAPIRequests.deleteAllDatabasesApi();
42+
await databaseAPIRequests.addNewStandaloneDatabaseApi(ossStandaloneV5Config);
43+
await databaseAPIRequests.addNewStandaloneDatabaseApi(ossStandaloneConfig, true);
44+
await browserPage.reloadPage();
45+
46+
await myRedisDatabasePage.clickOnDBByName(ossStandaloneV5Config.databaseName);
47+
48+
})
49+
.after(async() => {
50+
await databaseAPIRequests.deleteAllDatabasesApi();
51+
})('Verify that insights panel is opened in cloud db if users db does not have some module', async t => {
52+
await t.click(browserPage.redisearchModeBtn);
53+
await t.click(browserPage.closeDialogButton);
54+
await t.click(browserPage.NavigationPanel.myRedisDBButton);
55+
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
56+
await t.expect(browserPage.InsightsPanel.sidePanel.exists).ok('the panel is opened');
57+
await t.expect(await browserPage.InsightsPanel.existsCompatibilityPopover.textContent).contains('Search and Query capability', 'popover is not displayed');
58+
const tab = await browserPage.InsightsPanel.setActiveTab(ExploreTabs.Explore);
59+
await t.expect(tab.preselectArea.textContent).contains('VECTOR SIMILARITY SEARCH', 'the tutorial is incorrect');
60+
61+
await t.click(browserPage.NavigationPanel.myRedisDBButton);
62+
await myRedisDatabasePage.clickOnDBByName(ossStandaloneV5Config.databaseName);
63+
await t.click(browserPage.NavigationPanel.workbenchButton);
64+
await workbenchPage.sendCommandInWorkbench('TS.');
65+
66+
await t.click(browserPage.NavigationPanel.myRedisDBButton);
67+
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
68+
await t.expect(browserPage.InsightsPanel.sidePanel.exists).ok('the panel is opened');
69+
await t.expect(await browserPage.InsightsPanel.existsCompatibilityPopover.textContent).contains('time series', 'popover is not displayed');
70+
await t.expect(tab.preselectArea.textContent).contains('REDIS FOR TIME SERIES', 'the tutorial is incorrect');
71+
});

0 commit comments

Comments
 (0)