Skip to content

Commit 77743d8

Browse files
authored
Merge pull request #1855 from RedisInsight/e2e/feature/RI-4181_open-guides-and-tutorials-by-link
E2E/RI-4309 open guides and tutorials link in recommendations
2 parents 785278a + 6bda90f commit 77743d8

File tree

4 files changed

+54
-6
lines changed

4 files changed

+54
-6
lines changed

tests/e2e/pageObjects/browser-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,9 @@ export class BrowserPage {
365365
/**
366366
* Adding a new ZSet key
367367
* @param keyName The name of the key
368+
* @param scores The score of the key member
368369
* @param TTL The Time to live value of the key
369370
* @param members The key members
370-
* @param scores The score of the key member
371371
*/
372372
async addZSetKey(keyName: string, scores = ' ', TTL = ' ', members = ' '): Promise<void> {
373373
await common.waitForElementNotVisible(this.progressLine);

tests/e2e/pageObjects/memory-efficiency-page.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export class MemoryEfficiencyPage {
1111
cssCodeChangesLabel = '[data-testid=code_changes]';
1212
cssConfigurationChangesLabel = '[data-testid=configuration_changes]';
1313
cssReadMoreLink = '[data-testid=read-more-link]';
14+
cssToTutorialsBtn = '[data-testid=RTS-to-tutorial-btn]';
1415
// BUTTONS
1516
newReportBtn = Selector('[data-testid=start-database-analysis-btn]');
1617
expandArrowBtn = Selector('[data-testid^=expand-arrow-]');
@@ -69,4 +70,14 @@ export class MemoryEfficiencyPage {
6970
usefulVoteBtn = Selector('[data-testid=useful-vote-btn]').nth(0);
7071
notUsefulVoteBtn = Selector('[data-testid=not-useful-vote-btn]').nth(0);
7172
recommendationsFeedbackBtn = Selector('[data-testid=recommendation-feedback-btn]');
73+
toTutorialsBtn = Selector('[data-testid=RTS-to-tutorial-btn]');
74+
rtsAccordeon = Selector('[data-testid=RTS-accordion]');
75+
76+
/**
77+
* Find recommendation selector by name
78+
* @param name A recommendation name
79+
*/
80+
async getRecommendationByName(name: string): Promise<Selector> {
81+
return Selector('div').withExactText(name).parent('[data-testid=RTS-accordion]').parent();
82+
}
7283
}

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,24 +232,31 @@ export class WorkbenchPage {
232232
await t.expect(actualCommandResult).contains(result, 'Actual command result is not equal to executed');
233233
}
234234
/**
235-
* get selector with tutorial name
235+
* Get selector with tutorial name
236236
* @param tutorialName name of the uploaded tutorial
237237
*/
238238
async getAccordionButtonWithName(tutorialName: string): Promise<Selector> {
239239
return Selector(`[data-testid=accordion-button-${tutorialName}]`);
240240
}
241241
/**
242-
* get internal tutorial link with .md name
242+
* Get internal tutorial link with .md name
243243
* @param internalLink name of the .md file
244244
*/
245245
async getInternalLinkWithManifest(internalLink: string): Promise<Selector> {
246246
return Selector(`[data-testid="internal-link-${internalLink}.md"]`);
247247
}
248248
/**
249-
* get internal tutorial link without .md name
249+
* Get internal tutorial link without .md name
250250
* @param internalLink name of the label
251251
*/
252252
async getInternalLinkWithoutManifest(internalLink: string): Promise<Selector> {
253253
return Selector(`[data-testid="internal-link-${internalLink}"]`);
254254
}
255+
/**
256+
* Find tutorial selector by name
257+
* @param name A tutorial name
258+
*/
259+
async getTutorialByName(name: string): Promise<Selector> {
260+
return Selector('div').withText(name);
261+
}
255262
}

tests/e2e/tests/critical-path/memory-efficiency/recommendations.e2e.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { MyRedisDatabasePage, MemoryEfficiencyPage, BrowserPage, CliPage, AddRedisDatabasePage } from '../../../pageObjects';
1+
import { Selector } from 'testcafe';
2+
import { MyRedisDatabasePage, MemoryEfficiencyPage, BrowserPage, CliPage, AddRedisDatabasePage, WorkbenchPage } from '../../../pageObjects';
23
import { rte } from '../../../helpers/constants';
34
import { acceptLicenseTermsAndAddDatabaseApi, deleteCustomDatabase } from '../../../helpers/database';
45
import { commonUrl, ossStandaloneBigConfig, ossStandaloneConfig } from '../../../helpers/conf';
@@ -15,6 +16,7 @@ const browserPage = new BrowserPage();
1516
const cliPage = new CliPage();
1617
const addRedisDatabasePage = new AddRedisDatabasePage();
1718
const memoryEfficiencyActions = new MemoryEfficiencyActions();
19+
const workbenchPage = new WorkbenchPage();
1820

1921
const externalPageLink = 'https://docs.redis.com/latest/ri/memory-optimizations/';
2022
let keyName = `recomKey-${common.generateWord(10)}`;
@@ -80,7 +82,7 @@ test
8082
// Close the window with external link to switch to the application window
8183
await t.closeWindow();
8284
});
83-
// skipped due to inability to receive no recommendations for now
85+
// skipped due to inability to receive no recommendations for now
8486
test.skip('No recommendations message', async t => {
8587
keyName = `recomKey-${common.generateWord(10)}`;
8688
const noRecommendationsMessage = 'No recommendations at the moment, run a new report later to keep up the good work!';
@@ -146,3 +148,31 @@ test
146148
// Verify that user can see the popup with link when he votes for “Not useful”
147149
await t.expect(memoryEfficiencyPage.recommendationsFeedbackBtn.visible).ok('popup did not appear after voting for not useful');
148150
});
151+
test
152+
.before(async t => {
153+
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName);
154+
keyName = `recomKey-${common.generateWord(10)}`;
155+
await browserPage.addZSetKey(keyName, '151153320500121', '2147476121', '1511533205001:21');
156+
// Go to Analysis Tools page
157+
await t.click(myRedisDatabasePage.analysisPageButton);
158+
await t.click(memoryEfficiencyPage.newReportBtn);
159+
// Go to Recommendations tab
160+
await t.click(memoryEfficiencyPage.recommendationsTab);
161+
})
162+
.after(async t => {
163+
// Clear and delete database
164+
await t.click(myRedisDatabasePage.browserButton);
165+
await browserPage.deleteKeyByName(keyName);
166+
await deleteStandaloneDatabaseApi(ossStandaloneConfig);
167+
})('Verify that user can see the Tutorial opened when clicking on "To Tutorial" for recommendations', async t => {
168+
const optimizeTsRecommendation = await memoryEfficiencyPage.getRecommendationByName('Optimize the use of time series');
169+
const toTutorialBtn = optimizeTsRecommendation.find(memoryEfficiencyPage.cssToTutorialsBtn);
170+
171+
// Verify that Optimize the use of time series recommendation displayed
172+
await t.expect(optimizeTsRecommendation.exists).ok('Optimize the use of time series recommendation not displayed');
173+
// Verify that tutorial opened
174+
await t.click(toTutorialBtn);
175+
await t.expect(workbenchPage.preselectArea.visible).ok('Workbench Enablement area not opened');
176+
// Verify that REDIS FOR TIME SERIES tutorial expanded
177+
await t.expect((await workbenchPage.getTutorialByName('REDIS FOR TIME SERIES')).visible).ok('REDIS FOR TIME SERIES tutorial is not expanded');
178+
});

0 commit comments

Comments
 (0)