Skip to content

Commit c30ff8a

Browse files
authored
Merge pull request #2218 from RedisInsight/e2e/feature/RI-4530-fixed-subscription-autodiscovery
E2e/feature/ri 4530 fixed subscription autodiscovery
2 parents 47fb92a + e06c04b commit c30ff8a

File tree

9 files changed

+85
-54
lines changed

9 files changed

+85
-54
lines changed

tests/e2e/helpers/conf.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ export const cloudDatabaseConfig = {
9999
port: process.env.E2E_CLOUD_DATABASE_PORT || '',
100100
databaseName: `${process.env.E2E_CLOUD_DATABASE_NAME || 'cloud-database'}-${uniqueId}`,
101101
databaseUsername: process.env.E2E_CLOUD_DATABASE_USERNAME,
102-
databasePassword: process.env.E2E_CLOUD_DATABASE_PASSWORD
102+
databasePassword: process.env.E2E_CLOUD_DATABASE_PASSWORD,
103+
accessKey: process.env.E2E_CLOUD_API_ACCESS_KEY || '',
104+
secretKey: process.env.E2E_CLOUD_API_SECRET_KEY || ''
103105
};
104106

105107
export const ossStandaloneNoPermissionsConfig = {

tests/e2e/helpers/database.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ export async function discoverSentinelDatabase(databaseParameters: SentinelParam
5353
*/
5454
export async function addNewREClusterDatabase(databaseParameters: AddNewDatabaseParameters): Promise<void> {
5555
// Fill the add database form
56-
await myRedisDatabasePage.AddRedisDatabase.addAutodiscoverREClucterDatabase(databaseParameters);
56+
await myRedisDatabasePage.AddRedisDatabase.addAutodiscoverREClusterDatabase(databaseParameters);
5757
// Click on submit button
5858
await t
5959
.click(myRedisDatabasePage.AddRedisDatabase.addRedisDatabaseButton)
6060
// Wait for database to be exist in the list of Autodiscover databases and select it
61-
.expect(autoDiscoverREDatabases.databaseNames.withExactText(databaseParameters.databaseName ?? '').exists).ok('The database not displayed', { timeout: 10000 })
61+
.expect(autoDiscoverREDatabases.databaseName.withExactText(databaseParameters.databaseName ?? '').exists).ok('The database not displayed', { timeout: 10000 })
6262
.typeText(autoDiscoverREDatabases.search, databaseParameters.databaseName ?? '')
6363
.click(autoDiscoverREDatabases.databaseCheckbox)
6464
// Click Add selected databases button
@@ -87,20 +87,23 @@ export async function addOSSClusterDatabase(databaseParameters: OSSClusterParame
8787
* @param cloudAPIAccessKey The Cloud API Access Key
8888
* @param cloudAPISecretKey The Cloud API Secret Key
8989
*/
90-
export async function addNewRECloudDatabase(cloudAPIAccessKey: string, cloudAPISecretKey: string): Promise<string> {
90+
export async function autodiscoverRECloudDatabase(cloudAPIAccessKey: string, cloudAPISecretKey: string): Promise<string> {
9191
// Fill the add database form and Submit
9292
await myRedisDatabasePage.AddRedisDatabase.addAutodiscoverRECloudDatabase(cloudAPIAccessKey, cloudAPISecretKey);
9393
await t.click(myRedisDatabasePage.AddRedisDatabase.addRedisDatabaseButton);
94+
await t.expect(autoDiscoverREDatabases.title.withExactText('Redis Enterprise Cloud Subscriptions').exists).ok('Subscriptions list not displayed', { timeout: 120000 });
9495
// Select subscriptions
9596
await t.click(myRedisDatabasePage.AddRedisDatabase.selectAllCheckbox);
9697
await t.click(myRedisDatabasePage.AddRedisDatabase.showDatabasesButton);
9798
// Select databases for adding
98-
const databaseName = await browserPage.getDatabasesName();
99-
await t.click(myRedisDatabasePage.AddRedisDatabase.selectAllCheckbox);
99+
const databaseName = await autoDiscoverREDatabases.getDatabaseName();
100+
await t.click(autoDiscoverREDatabases.databaseCheckbox);
100101
await t.click(autoDiscoverREDatabases.addSelectedDatabases);
101102
// Wait for database to be exist in the My redis databases list
103+
await t.expect(autoDiscoverREDatabases.title.withExactText('Redis Enterprise Databases Added').exists).ok('Added databases list not displayed', { timeout: 20000 });
102104
await t.click(autoDiscoverREDatabases.viewDatabasesButton);
103-
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseName).exists).ok('The database not displayed', { timeout: 10000 });
105+
// uncomment when fixed db will be added to cloud subscription
106+
// await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseName).exists).ok('The database not displayed', { timeout: 10000 });
104107
return databaseName;
105108
}
106109

tests/e2e/pageObjects/auto-discover-redis-enterprise-databases.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@ export class AutoDiscoverREDatabases extends BasePage {
1515
viewDatabasesButton = Selector('[data-testid=btn-view-databases]');
1616
//TEXT INPUTS (also referred to as 'Text fields')
1717
title = Selector('[data-testid=title]');
18-
databaseNames = Selector('[data-testid^=db_name_]');
18+
databaseName = Selector('[data-testid^=db_name_]');
19+
20+
// Get databases name
21+
async getDatabaseName(): Promise<string> {
22+
return this.databaseName.textContent;
23+
}
1924
}

tests/e2e/pageObjects/browser-page.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ export class BrowserPage extends InstancePage {
195195
keySizeDetails = Selector('[data-testid=key-size-text]');
196196
keyLengthDetails = Selector('[data-testid=key-length-text]');
197197
keyNameInTheList = Selector(this.cssSelectorKey);
198-
databaseNames = Selector('[data-testid^=db_name_]');
199198
hashFieldsList = Selector('[data-testid^=hash-field-] span');
200199
hashValuesList = Selector('[data-testid^=hash-field-value-] span');
201200
hashField = Selector('[data-testid^=hash-field-]').nth(0);
@@ -755,11 +754,6 @@ export class BrowserPage extends InstancePage {
755754
.click(this.saveMemberButton);
756755
}
757756

758-
//Get databases name
759-
async getDatabasesName(): Promise<string> {
760-
return this.databaseNames.textContent;
761-
}
762-
763757
//Open key details
764758
async openKeyDetails(keyName: string): Promise<void> {
765759
await this.searchByKeyName(keyName);

tests/e2e/pageObjects/components/myRedisDatabase/add-redis-database.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class AddRedisDatabase {
180180
* Adding a new database from RE Cluster via auto-discover flow
181181
* @param parameters the parameters of the database
182182
*/
183-
async addAutodiscoverREClucterDatabase(parameters: AddNewDatabaseParameters): Promise<void> {
183+
async addAutodiscoverREClusterDatabase(parameters: AddNewDatabaseParameters): Promise<void> {
184184
await t
185185
.click(this.addDatabaseButton)
186186
.click(this.addAutoDiscoverDatabase)
@@ -199,8 +199,7 @@ export class AddRedisDatabase {
199199
async addAutodiscoverRECloudDatabase(cloudAPIAccessKey: string, cloudAPISecretKey: string): Promise<void> {
200200
await t
201201
.click(this.addDatabaseButton)
202-
.click(this.addAutoDiscoverDatabase)
203-
.click(this.redisCloudProType);
202+
.click(this.addAutoDiscoverDatabase);
204203
await t
205204
.typeText(this.accessKeyInput, cloudAPIAccessKey, { replace: true, paste: true })
206205
.typeText(this.secretKeyInput, cloudAPISecretKey, { replace: true, paste: true });

tests/e2e/pageObjects/my-redis-databases-page.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export class MyRedisDatabasePage extends BasePage {
7272
successResultsAccordion = Selector('[data-testid^=success-results-]');
7373
partialResultsAccordion = Selector('[data-testid^=partial-results-]');
7474
failedResultsAccordion = Selector('[data-testid^=failed-results-]');
75+
// CONTAINERS
76+
databaseContainer = Selector('.databaseContainer');
7577

7678
/**
7779
* Click on the database by name

tests/e2e/tests/smoke/database/add-standalone-db.e2e.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
import { t } from 'testcafe';
22
import { Chance } from 'chance';
33
import {
4-
addNewREClusterDatabase,
54
addOSSClusterDatabase,
65
acceptLicenseTerms,
7-
deleteDatabase,
8-
addRECloudDatabase
6+
deleteDatabase
97
} from '../../../helpers/database';
108
import {
119
commonUrl,
1210
ossStandaloneConfig,
13-
ossClusterConfig,
14-
redisEnterpriseClusterConfig,
15-
cloudDatabaseConfig
11+
ossClusterConfig
1612
} from '../../../helpers/conf';
1713
import { env, rte } from '../../../helpers/constants';
1814
import { BrowserPage, MyRedisDatabasePage } from '../../../pageObjects';
@@ -86,16 +82,6 @@ test
8682
await myRedisDatabasePage.clickOnEditDBByName(databaseName);
8783
await t.expect(myRedisDatabasePage.AddRedisDatabase.timeoutInput.value).eql(connectionTimeout, 'Connection timeout is not customized');
8884
});
89-
test
90-
.meta({ rte: rte.reCluster })
91-
.after(async() => {
92-
await deleteDatabase(redisEnterpriseClusterConfig.databaseName);
93-
})('Verify that user can add database from RE Cluster via auto-discover flow', async() => {
94-
await addNewREClusterDatabase(redisEnterpriseClusterConfig);
95-
// Verify that user can see an indicator of databases that are added using autodiscovery and not opened yet
96-
// Verify new connection badge for RE cluster
97-
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(redisEnterpriseClusterConfig.databaseName);
98-
});
9985
test
10086
.meta({ env: env.web, rte: rte.ossCluster })
10187
.after(async() => {
@@ -105,15 +91,3 @@ test
10591
// Verify new connection badge for OSS cluster
10692
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(ossClusterConfig.ossClusterDatabaseName);
10793
});
108-
109-
test
110-
.meta({ rte: rte.reCloud })
111-
.after(async() => {
112-
await deleteDatabase(cloudDatabaseConfig.databaseName);
113-
})('Verify that user can add database from RE Cloud via auto-discover flow', async() => {
114-
await addRECloudDatabase(cloudDatabaseConfig);
115-
// Verify new connection badge for RE cloud
116-
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(cloudDatabaseConfig.databaseName);
117-
// Verify redis stack icon for RE Cloud with all 5 modules
118-
await t.expect(myRedisDatabasePage.redisStackIcon.visible).ok('Redis Stack icon not found for RE Cloud db with all 5 modules');
119-
});
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { t } from 'testcafe';
2+
import {
3+
addNewREClusterDatabase,
4+
acceptLicenseTerms,
5+
deleteDatabase,
6+
addRECloudDatabase,
7+
autodiscoverRECloudDatabase
8+
} from '../../../helpers/database';
9+
import {
10+
commonUrl,
11+
redisEnterpriseClusterConfig,
12+
cloudDatabaseConfig
13+
} from '../../../helpers/conf';
14+
import { rte } from '../../../helpers/constants';
15+
import { MyRedisDatabasePage } from '../../../pageObjects';
16+
import { Common } from '../../../helpers/common';
17+
18+
const myRedisDatabasePage = new MyRedisDatabasePage();
19+
20+
let databaseName: string;
21+
22+
fixture `Add database`
23+
.meta({ type: 'smoke' })
24+
.page(commonUrl)
25+
.beforeEach(async() => {
26+
await acceptLicenseTerms();
27+
});
28+
test
29+
.meta({ rte: rte.reCluster })
30+
.after(async() => {
31+
await deleteDatabase(redisEnterpriseClusterConfig.databaseName);
32+
})('Verify that user can add database from RE Cluster via auto-discover flow', async() => {
33+
await addNewREClusterDatabase(redisEnterpriseClusterConfig);
34+
// Verify that user can see an indicator of databases that are added using autodiscovery and not opened yet
35+
// Verify new connection badge for RE cluster
36+
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(redisEnterpriseClusterConfig.databaseName);
37+
});
38+
test
39+
.meta({ rte: rte.reCloud })
40+
.after(async() => {
41+
await deleteDatabase(cloudDatabaseConfig.databaseName);
42+
})('Verify that user can add database from RE Cloud', async() => {
43+
await addRECloudDatabase(cloudDatabaseConfig);
44+
// Verify new connection badge for RE cloud
45+
await myRedisDatabasePage.verifyDatabaseStatusIsVisible(cloudDatabaseConfig.databaseName);
46+
// Verify redis stack icon for RE Cloud with all 5 modules
47+
await t.expect(myRedisDatabasePage.redisStackIcon.visible).ok('Redis Stack icon not found for RE Cloud db with all 5 modules');
48+
});
49+
test
50+
.meta({ rte: rte.reCloud })
51+
.after(async() => {
52+
// await deleteDatabase(databaseName);
53+
})('Verify that user can connect to the RE Cloud database via auto-discover flow', async t => {
54+
// Verify that user can see the Cloud auto-discovery option selected by default when switching to the auto-discovery of databases
55+
databaseName = await autodiscoverRECloudDatabase(cloudDatabaseConfig.accessKey, cloudDatabaseConfig.secretKey);
56+
// uncomment when fixed db will be added to cloud subscription
57+
// await myRedisDatabasePage.clickOnDBByName(databaseName);
58+
// // Verify that user can add database from fixed subscription
59+
// await t.expect(Common.getPageUrl()).contains('browser', 'The added RE Cloud database not opened');
60+
});

tests/e2e/tests/smoke/database/edit-db.e2e.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ClientFunction } from 'testcafe';
2-
import { acceptLicenseTerms, deleteDatabase, addNewStandaloneDatabase, addNewREClusterDatabase, addNewRECloudDatabase } from '../../../helpers/database';
2+
import { acceptLicenseTerms, deleteDatabase, addNewStandaloneDatabase, addNewREClusterDatabase } from '../../../helpers/database';
33
import { MyRedisDatabasePage } from '../../../pageObjects';
44
import {
55
commonUrl,
@@ -42,11 +42,3 @@ test
4242
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
4343
await t.expect(getPageUrl()).contains('browser', 'Browser page not opened');
4444
});
45-
// skiped until the RE Cloud connection is implemented
46-
test.skip
47-
.meta({ rte: rte.reCloud })('Verify that user can connect to the RE Cloud database', async t => {
48-
// TODO: add api keys from env
49-
const databaseName = await addNewRECloudDatabase('', '');
50-
await myRedisDatabasePage.clickOnDBByName(databaseName);
51-
await t.expect(getPageUrl()).contains('browser', 'The edit view is not opened');
52-
});

0 commit comments

Comments
 (0)