Skip to content

Commit 3354081

Browse files
authored
Merge pull request #1157 from RedisInsight/e2e/feature/RI-2904-enablement-area
E2E/feature/RI-2904 enablement area
2 parents f3fa47f + c7950d6 commit 3354081

File tree

6 files changed

+143
-58
lines changed

6 files changed

+143
-58
lines changed

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export class WorkbenchPage {
5151
cancelButton = Selector('[data-testid=cancel-btn]');
5252
applyButton = Selector('[data-testid=apply-btn]');
5353
documentButtonInQuickGuides = Selector('[data-testid=accordion-button-document]');
54+
guidesGraphAccordion = Selector('[data-testid=accordion-button-graph]');
5455
redisStackTutorialsButton = Selector('[data-testid=accordion-button-redis_stack]');
5556
nextPageButton = Selector('[data-testid=enablement-area__next-page-btn]');
5657
prevPageButton = Selector('[data-testid=enablement-area__prev-page-btn]');
@@ -60,6 +61,7 @@ export class WorkbenchPage {
6061
showSalesPerRegiomButton = Selector('[data-testid="preselect-Show all sales per region"]');
6162
queryCardNoModuleButton = Selector('[data-testid=query-card-no-module-button] a');
6263
rawModeBtn = Selector('[data-testid="btn-change-mode"]');
64+
closeEnablementPage = Selector('[data-testid=enablement-area__page-close]');
6365
groupMode = Selector('[data-testid=btn-change-group-mode]');
6466
copyCommand = Selector('[data-testid=copy-command]');
6567
redisStackTimeSeriesLoadMorePoints = Selector('[data-testid=preselect-Load more data points]');
@@ -69,7 +71,9 @@ export class WorkbenchPage {
6971
//LINKS
7072
timeSeriesLink = Selector('[data-testid=internal-link-redis_for_time_series]');
7173
redisStackLinks = Selector('[data-testid=accordion-redis_stack] [data-testid^=internal-link]');
72-
workingWithGraphLink = Selector('[data-testid=internal-link-working_with_graphs]');
74+
tutorialsWorkingWithGraphLink = Selector('[data-testid=internal-link-working_with_graphs]');
75+
guidesWorkingWithGraphLink = Selector('[data-testid=internal-link-working-with-graphs]');
76+
guidesIntroductionGraphLink = Selector('[data-testid=internal-link-introduction]');
7377
internalLinkWorkingWithHashes = Selector('[data-testid=internal-link-working-with-hashes]');
7478
vectorSimilitaritySearchButton = Selector('[data-testid=internal-link-vector_similarity_search]');
7579
//TEXT INPUTS (also referred to as 'Text fields')
@@ -104,6 +108,7 @@ export class WorkbenchPage {
104108
runButtonToolTip = Selector('[data-testid=run-query-tooltip]');
105109
loadedCommand = Selector('[class=euiLoadingContent__singleLine]');
106110
runButtonSpinner = Selector('[data-testid=loading-spinner]');
111+
enablementAreaEmptyContent = Selector('[data-testid=enablement-area__empty-prompt]');
107112
workbenchCommandInHistory = Selector(this.cssWorkbenchCommandInHistory);
108113
workbenchCommandSuccessResultInHistory = Selector(this.cssWorkbenchCommandSuccessResultInHistory);
109114
workbenchCommandFailedResultInHistory = Selector(this.cssWorkbenchCommandFailedResultInHistory);

tests/e2e/tests/critical-path/database/autoupdate-of-json.e2e.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { join } from 'path';
2+
import * as os from 'os';
3+
import * as fs from 'fs';
4+
import * as editJsonFile from 'edit-json-file';
5+
import { acceptLicenseTermsAndAddDatabaseApi} from '../../../helpers/database';
6+
import { MyRedisDatabasePage, WorkbenchPage } from '../../../pageObjects';
7+
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
8+
import { rte, env } from '../../../helpers/constants';
9+
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
10+
11+
const myRedisDatabasePage = new MyRedisDatabasePage();
12+
const workbenchPage = new WorkbenchPage();
13+
14+
const workingDirectory = process.env.APP_FOLDER_ABSOLUTE_PATH
15+
|| (join(os.homedir(), process.env.APP_FOLDER_NAME || '.redisinsight-v2'));
16+
if (fs.existsSync(workingDirectory)) {
17+
// Guides content
18+
const guidesTimestampPath = `${workingDirectory}/guides/build.json`;
19+
const guidesGraphIntroductionFilePath = `${workingDirectory}/guides/quick-guides/graph/introduction.md`;
20+
21+
// Tutorials content
22+
const tutorialsTimestampPath = `${workingDirectory}/tutorials/build.json`;
23+
const tutorialsTimeSeriesFilePath = `${workingDirectory}/tutorials/redis_stack/redis_for_time_series.md`;
24+
25+
// Remove md files from local folder. When desktop tests are started, files will be updated from remote repository
26+
// Need to uncomment when desktop tests are started
27+
// fs.unlinkSync(guidesGraphIntroductionFilePath);
28+
// fs.unlinkSync(tutorialsTimeSeriesFilePath);
29+
30+
// Update timestamp for build files
31+
const guidesTimestampFile = editJsonFile(guidesTimestampPath);
32+
const tutorialsTimestampFile = editJsonFile(tutorialsTimestampPath);
33+
34+
const guidesNewTimestamp = guidesTimestampFile.get('timestamp') - 10;
35+
const tutorialNewTimestamp = tutorialsTimestampFile.get('timestamp') - 10;
36+
37+
guidesTimestampFile.set('timestamp', guidesNewTimestamp);
38+
guidesTimestampFile.save();
39+
tutorialsTimestampFile.set('timestamp', tutorialNewTimestamp);
40+
tutorialsTimestampFile.save();
41+
42+
fixture `Automatically update information`
43+
.meta({ type: 'critical_path' })
44+
.page(commonUrl)
45+
.beforeEach(async() => {
46+
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName);
47+
})
48+
.afterEach(async() => {
49+
await deleteStandaloneDatabaseApi(ossStandaloneConfig);
50+
});
51+
test
52+
.meta({ rte: rte.standalone, env: env.desktop })('Verify that user can see updated info in Enablement Area', async t => {
53+
// Create new file due to cache-ability
54+
const guidesTimestampFileNew = editJsonFile(guidesTimestampPath);
55+
const tutorialsTimestampFileNew = editJsonFile(tutorialsTimestampPath);
56+
57+
// Open Workbench page
58+
await t.click(myRedisDatabasePage.workbenchButton);
59+
60+
// Check Enablement area and validate that removed file is existed in Guides
61+
await t.click(workbenchPage.guidesGraphAccordion);
62+
await t.click(workbenchPage.guidesIntroductionGraphLink.nth(1));
63+
await t.expect(workbenchPage.enablementAreaEmptyContent.visible).notOk('Guides folder is not updated');
64+
await t.click(workbenchPage.closeEnablementPage);
65+
66+
// Check Enablement area and validate that removed file is existed in Tutorials
67+
await t.click(workbenchPage.redisStackTutorialsButton);
68+
await t.click(workbenchPage.timeSeriesLink);
69+
await t.expect(workbenchPage.enablementAreaEmptyContent.visible).notOk('Tutorials folder is not updated');
70+
71+
// Check that timestamp is new
72+
const actualGuidesTimestamp = await guidesTimestampFileNew.get('timestamp');
73+
const actualTutorialTimestamp = await tutorialsTimestampFileNew.get('timestamp');
74+
await t.expect(actualGuidesTimestamp).notEql(guidesNewTimestamp, 'Guides timestamp is not updated');
75+
await t.expect(actualTutorialTimestamp).notEql(tutorialNewTimestamp, 'Tutorials timestamp is not updated');
76+
});
77+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { join } from 'path';
2+
import * as os from 'os';
3+
import * as fs from 'fs';
4+
import { Chance } from 'chance';
5+
import * as editJsonFile from 'edit-json-file';
6+
import { acceptLicenseTerms } from '../../../helpers/database';
7+
import { MyRedisDatabasePage } from '../../../pageObjects';
8+
import { commonUrl } from '../../../helpers/conf';
9+
import { env } from '../../../helpers/constants';
10+
11+
const myRedisDatabasePage = new MyRedisDatabasePage();
12+
const chance = new Chance();
13+
14+
const workingDirectory = process.env.APP_FOLDER_ABSOLUTE_PATH
15+
|| (join(os.homedir(), process.env.APP_FOLDER_NAME || '.redisinsight-v2'));
16+
if (fs.existsSync(workingDirectory)) {
17+
const timestampPromoButtonPath = `${workingDirectory}/content/build.json`;
18+
const contentPromoButtonPath = `${workingDirectory}/content/create-redis.json`;
19+
const timestampPromoButtonFile = editJsonFile(timestampPromoButtonPath);
20+
const contentPromoButtonFile = editJsonFile(contentPromoButtonPath);
21+
const timestampBeforeUpdate = timestampPromoButtonFile.get('timestamp');
22+
const newTimestamp = timestampBeforeUpdate - 1;
23+
const newPromoButtonText = chance.word({ length: 10 });
24+
25+
//Edit json file values
26+
contentPromoButtonFile.set('cloud.title', newPromoButtonText);
27+
contentPromoButtonFile.set('cloud.description', newPromoButtonText);
28+
contentPromoButtonFile.save();
29+
timestampPromoButtonFile.set('timestamp', newTimestamp);
30+
timestampPromoButtonFile.save();
31+
32+
fixture `Automatically update information`
33+
.meta({type: 'critical_path'})
34+
.page(commonUrl)
35+
.beforeEach(async() => {
36+
await acceptLicenseTerms();
37+
});
38+
test
39+
.meta({ env: env.desktop })('Verify that user has the ability to update "Create free database" button without changing the app', async t => {
40+
// Create new file paths due to cache-ability
41+
const timestampPathNew = editJsonFile(timestampPromoButtonPath);
42+
const contentPathNew = editJsonFile(contentPromoButtonPath);
43+
// Check the promo button after the opening of app
44+
await t.expect(myRedisDatabasePage.promoButton.textContent).notContains(newPromoButtonText, 'Promo button text is updated');
45+
// Get the values from build.json and create-redis.json files
46+
const actualTimestamp = await timestampPathNew.get('timestamp');
47+
const actualPromoButtonTitle = await contentPathNew.get('cloud.title');
48+
const actualPromoButtonDescription = await contentPathNew.get('cloud.description');
49+
// Check the json files are automatically updated
50+
console.log(`timestamp: ${actualTimestamp}`);
51+
console.log(`actualPromoButtonTitle: ${actualPromoButtonTitle}`);
52+
console.log(`actualPromoButtonDescription: ${actualPromoButtonDescription}`);
53+
await t.expect(actualPromoButtonTitle).notEql(newPromoButtonText, 'The cloud title in the create-redis.json file is automatically updated');
54+
await t.expect(actualPromoButtonDescription).notEql(newPromoButtonText, 'The cloud description in the create-redis.json file is automatically updated');
55+
await t.expect(actualTimestamp).notEql(newTimestamp, 'The timestamp in the build.json file is automatically updated');
56+
});
57+
}

tests/e2e/tests/critical-path/notifications/notification-center.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const sortedNotifications = jsonNotifications.sort((a, b) => a.timestamp < b.tim
1818
fixture `Notifications`
1919
.meta({ rte: rte.none, type: 'critical_path' })
2020
.page(commonUrl)
21-
.beforeEach(async () => {
21+
.beforeEach(async() => {
2222
await acceptLicenseTerms();
2323
await notificationPage.changeNotificationsSwitcher(true);
2424
await deleteAllNotificationsFromDB();

tests/e2e/tests/regression/workbench/redis-stack-commands.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test.skip
3030
.meta({ env: env.desktop, rte: rte.standalone })('Verify that user can switches between Graph and Text for GRAPH command and see results corresponding to their views', async t => {
3131
//Send Graph command
3232
await t.click(workbenchPage.redisStackTutorialsButton);
33-
await t.click(workbenchPage.workingWithGraphLink);
33+
await t.click(workbenchPage.tutorialsWorkingWithGraphLink);
3434
await t.click(workbenchPage.createGraphBikeButton);
3535
await t.click(workbenchPage.submitCommandButton);
3636
//Switch to Text view and check result
@@ -45,7 +45,7 @@ test
4545
.meta({ env: env.desktop, rte: rte.standalone })('Verify that user can see "No data to visualize" message for Graph command', async t => {
4646
//Send Graph command
4747
await t.click(workbenchPage.redisStackTutorialsButton);
48-
await t.click(workbenchPage.workingWithGraphLink);
48+
await t.click(workbenchPage.tutorialsWorkingWithGraphLink);
4949
await t.click(workbenchPage.preselectModelBikeSalesButton);
5050
await t.click(workbenchPage.submitCommandButton);
5151
//Check result

0 commit comments

Comments
 (0)