Skip to content

Commit 9af7dc0

Browse files
author
ALENA NABOKA
committed
initial test for auto-update Enablement Area
1 parent 583d526 commit 9af7dc0

File tree

6 files changed

+149
-58
lines changed

6 files changed

+149
-58
lines changed

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class WorkbenchPage {
4848
cancelButton = Selector('[data-testid=cancel-btn]');
4949
applyButton = Selector('[data-testid=apply-btn]');
5050
documentButtonInQuickGuides = Selector('[data-testid=accordion-button-document]');
51+
guidesGraphAccordion = Selector('[data-testid=accordion-button-graph]');
5152
redisStackTutorialsButton = Selector('[data-testid=accordion-button-redis_stack]');
5253
nextPageButton = Selector('[data-testid=enablement-area__next-page-btn]');
5354
prevPageButton = Selector('[data-testid=enablement-area__prev-page-btn]');
@@ -62,7 +63,9 @@ export class WorkbenchPage {
6263
//LINKS
6364
timeSeriesLink = Selector('[data-testid=internal-link-redis_for_time_series]');
6465
redisStackLinks = Selector('[data-testid=accordion-redis_stack] [data-testid^=internal-link]');
65-
workingWithGraphLink = Selector('[data-testid=internal-link-working_with_graphs]');
66+
tutorialsWorkingWithGraphLink = Selector('[data-testid=internal-link-working_with_graphs]');
67+
guidesWorkingWithGraphLink = Selector('[data-testid=internal-link-working-with-graphs]');
68+
guidesIntroductionGraphLink = Selector('[data-testid=accordion-button-graph] [data-testid=internal-link-introduction]');
6669
internalLinkWorkingWithHashes = Selector('[data-testid=internal-link-working-with-hashes]');
6770
vectorSimilitaritySearchButton = Selector('[data-testid=internal-link-vector_similarity_search]');
6871
//TEXT INPUTS (also referred to as 'Text fields')
@@ -97,6 +100,7 @@ export class WorkbenchPage {
97100
runButtonToolTip = Selector('[data-testid=run-query-tooltip]');
98101
loadedCommand = Selector('[class=euiLoadingContent__singleLine]');
99102
runButtonSpinner = Selector('[data-testid=loading-spinner]');
103+
enablementAreaEmptyContent = Selector('[data-testid=enablement-area__empty-prompt]');
100104
//MONACO ELEMENTS
101105
monacoCommandDetails = Selector('div.suggest-details-container');
102106
monacoCloseCommandDetails = Selector('span.codicon-close');

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

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
const guidesTimestampPath = 'E:\\Redis\\RedisInsight\\tests\\e2e\\.redisinsight-v2\\guides\\build.json';
21+
const guidesGraphIntroductionFilePath = 'E:\\Redis\\RedisInsight\\tests\\e2e\\.redisinsight-v2\\guides\\quick-guides\\graph\\introduction.md';
22+
23+
// Tutorials content
24+
// const tutorialsTimestampPath = `${workingDirectory}/tutorials/build.json`;
25+
// const tutorialsTimeSeriesFilePath = `${workingDirectory}/guides/quick-guides/graph/introduction.md`;
26+
const tutorialsTimestampPath = 'E:\\Redis\\RedisInsight\\tests\\e2e\\.redisinsight-v2\\tutorials\\build.json';
27+
const tutorialsTimeSeriesFilePath = 'E:\\Redis\\RedisInsight\\tests\\e2e\\.redisinsight-v2\\tutorials\\redis_stack\\redis_for_time_series.md';
28+
29+
// Remove md files
30+
// fs.unlinkSync(guidesGraphIntroductionFilePath);
31+
// fs.unlinkSync(tutorialsTimeSeriesFilePath);
32+
33+
// Update timestamp for build files
34+
const guidesTimestampFile = editJsonFile(guidesTimestampPath);
35+
const tutorialsTimestampFile = editJsonFile(tutorialsTimestampPath);
36+
37+
console.log(`guide timestampBeforeUpdate: ${guidesTimestampFile.get('timestamp')}`);
38+
console.log(`tutorial timestampBeforeUpdate: ${tutorialsTimestampFile.get('timestamp')}`);
39+
const guidesNewTimestamp = guidesTimestampFile.get('timestamp') - 10;
40+
const tutorialNewTimestamp = tutorialsTimestampFile.get('timestamp') - 10;
41+
42+
guidesTimestampFile.set('timestamp', guidesNewTimestamp);
43+
guidesTimestampFile.save();
44+
tutorialsTimestampFile.set('timestamp', tutorialNewTimestamp);
45+
tutorialsTimestampFile.save();
46+
47+
console.log(`guide timestamp after file update: ${guidesTimestampFile.get('timestamp')}`);
48+
console.log(`tutorial timestamp after file update: ${tutorialsTimestampFile.get('timestamp')}`);
49+
50+
fixture `Automatically update information`
51+
.meta({ type: 'critical_path' })
52+
.page(commonUrl)
53+
.beforeEach(async() => {
54+
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName);
55+
})
56+
.afterEach(async() => {
57+
await deleteStandaloneDatabaseApi(ossStandaloneConfig);
58+
});
59+
test.only
60+
.meta({ rte: rte.standalone, env: env.desktop })('Verify that user can see updated info in Enablement Area', async t => {
61+
// Create new file due to cache-ability
62+
const guidesTimestampFileNew = editJsonFile(guidesTimestampPath);
63+
const tutorialsTimestampFileNew = editJsonFile(tutorialsTimestampPath);
64+
65+
// Open Workbench page
66+
await t.click(myRedisDatabasePage.workbenchButton);
67+
68+
// Check Enablement area and validate that removed file is existed in Guides
69+
await t.click(workbenchPage.guidesGraphAccordion);
70+
await t.click(workbenchPage.guidesIntroductionGraphLink);
71+
await t.expect(workbenchPage.enablementAreaEmptyContent.visible).notOk('Guides folder is not updated');
72+
73+
// Check Enablement area and validate that removed file is existed in Tutorials
74+
await t.click(workbenchPage.redisStackTutorialsButton);
75+
await t.click(workbenchPage.timeSeriesLink);
76+
await t.expect(workbenchPage.enablementAreaEmptyContent.visible).notOk('Tutorials folder is not updated');
77+
78+
// Check that timestamp is new
79+
const actualGuidesTimestamp = await guidesTimestampFileNew.get('timestamp');
80+
const actualTutorialTimestamp = await tutorialsTimestampFileNew.get('timestamp');
81+
await t.expect(actualGuidesTimestamp).notEql(guidesNewTimestamp, 'Guides timestamp is not updated');
82+
await t.expect(actualTutorialTimestamp).notEql(tutorialNewTimestamp, 'Tutorials timestamp is not updated');
83+
});
84+
}
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)