Skip to content

Commit 0f2012f

Browse files
committed
added line breaks after t.
1 parent 6d4c046 commit 0f2012f

21 files changed

+296
-224
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ export async function addNewStandaloneDatabaseApi(databaseParameters: AddNewData
2222
})
2323
.set('Accept', 'application/json');
2424

25-
await t.expect(await response.status).eql(201, 'The creation of new standalone database request failed');
26-
await t.expect(await response.body.name).eql(databaseParameters.databaseName, `Database Name is not equal to ${databaseParameters.databaseName} in response`);
25+
await t
26+
.expect(response.status).eql(201, 'The creation of new standalone database request failed')
27+
.expect(await response.body.name).eql(databaseParameters.databaseName, `Database Name is not equal to ${databaseParameters.databaseName} in response`);
2728
}
2829

2930
/**
3031
* Add a new Standalone databases through api using host and port
3132
* @param databasesParameters The databases parameters array
3233
*/
3334
export async function addNewStandaloneDatabasesApi(databasesParameters: AddNewDatabaseParameters[]): Promise<void> {
34-
if (await databasesParameters.length) {
35+
if (databasesParameters.length) {
3536
await databasesParameters.forEach(async parameter => {
3637
await addNewStandaloneDatabaseApi(parameter);
3738
});
@@ -47,8 +48,8 @@ export async function addNewOSSClusterDatabaseApi(databaseParameters: OSSCluster
4748
.send({ 'name': databaseParameters.ossClusterDatabaseName, 'host': databaseParameters.ossClusterHost, 'port': databaseParameters.ossClusterPort })
4849
.set('Accept', 'application/json');
4950

50-
await t.expect(await response.status).eql(201, 'The creation of new oss cluster database request failed');
51-
await t.expect(await response.body.name).eql(databaseParameters.ossClusterDatabaseName, `Database Name is not equal to ${databaseParameters.ossClusterDatabaseName} in response`);
51+
await t.expect(await response.status).eql(201, 'The creation of new oss cluster database request failed')
52+
.expect(await response.body.name).eql(databaseParameters.ossClusterDatabaseName, `Database Name is not equal to ${databaseParameters.ossClusterDatabaseName} in response`);
5253
}
5354

5455
/**
@@ -206,7 +207,7 @@ export async function getClusterNodesApi(databaseParameters: OSSClusterParameter
206207
.get(`/instance/${databaseId}/cluster-details`)
207208
.set('Accept', 'application/json')
208209
.expect(200);
209-
let nodes = await response.body.nodes;
210-
let nodeNames = await nodes.map((node: ClusterNodes) => (node.host + ':' + node.port));
210+
const nodes = await response.body.nodes;
211+
const nodeNames = await nodes.map((node: ClusterNodes) => (`${node.host }:${ node.port}`));
211212
return nodeNames;
212213
}

tests/e2e/helpers/database.ts

Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ const common = new Common();
2626
* @param databaseParameters The database parameters
2727
*/
2828
export async function addNewStandaloneDatabase(databaseParameters: AddNewDatabaseParameters): Promise<void> {
29-
//Fill the add database form
29+
// Fill the add database form
3030
await addRedisDatabasePage.addRedisDataBase(databaseParameters);
31-
//Click for saving
32-
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
33-
//Wait for database to be exist
34-
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseParameters.databaseName ?? '').exists).ok('The existence of the database', { timeout: 10000 });
35-
//Close message
36-
await t.click(myRedisDatabasePage.toastCloseButton);
31+
// Click for saving
32+
await t
33+
.click(addRedisDatabasePage.addRedisDatabaseButton)
34+
// Wait for database to be exist
35+
.expect(myRedisDatabasePage.dbNameList.withExactText(databaseParameters.databaseName ?? '').exists).ok('The database not displayed', { timeout: 10000 })
36+
// Close message
37+
.click(myRedisDatabasePage.toastCloseButton);
3738
}
3839

3940
/**
@@ -46,7 +47,7 @@ export async function discoverSentinelDatabase(databaseParameters: SentinelParam
4647
// Click for autodiscover
4748
await t
4849
.click(addRedisDatabasePage.discoverSentinelDatabaseButton)
49-
.expect(discoverMasterGroupsPage.addPrimaryGroupButton.exists).ok('Verify that user is on the second step of Sentinel flow', { timeout: 10000 });
50+
.expect(discoverMasterGroupsPage.addPrimaryGroupButton.exists).ok('User is not on the second step of Sentinel flow', { timeout: 10000 });
5051
// Select Master Groups and Add to RedisInsight
5152
await discoverMasterGroupsPage.addMasterGroups();
5253
await t.click(autoDiscoverREDatabases.viewDatabasesButton);
@@ -57,32 +58,34 @@ export async function discoverSentinelDatabase(databaseParameters: SentinelParam
5758
* @param databaseParameters The database parameters
5859
*/
5960
export async function addNewREClusterDatabase(databaseParameters: AddNewDatabaseParameters): Promise<void> {
60-
//Fill the add database form
61+
// Fill the add database form
6162
await addRedisDatabasePage.addAutodiscoverREClucterDatabase(databaseParameters);
62-
//Click on submit button
63-
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
64-
//Wait for database to be exist in the list of Autodiscover databases and select it
65-
await t.expect(autoDiscoverREDatabases.databaseNames.withExactText(databaseParameters.databaseName ?? '').exists).ok('The existence of the database', { timeout: 10000 });
66-
await t.typeText(autoDiscoverREDatabases.search, databaseParameters.databaseName ?? '');
67-
await t.click(autoDiscoverREDatabases.databaseCheckbox);
68-
//Click Add selected databases button
69-
await t.click(autoDiscoverREDatabases.addSelectedDatabases);
70-
await t.click(autoDiscoverREDatabases.viewDatabasesButton);
63+
// Click on submit button
64+
await t
65+
.click(addRedisDatabasePage.addRedisDatabaseButton)
66+
// Wait for database to be exist in the list of Autodiscover databases and select it
67+
.expect(autoDiscoverREDatabases.databaseNames.withExactText(databaseParameters.databaseName ?? '').exists).ok('The database not displayed', { timeout: 10000 })
68+
.typeText(autoDiscoverREDatabases.search, databaseParameters.databaseName ?? '')
69+
.click(autoDiscoverREDatabases.databaseCheckbox)
70+
// Click Add selected databases button
71+
.click(autoDiscoverREDatabases.addSelectedDatabases)
72+
.click(autoDiscoverREDatabases.viewDatabasesButton);
7173
}
7274

7375
/**
7476
* Add a new database from OSS Cluster via auto-discover flow
7577
* @param databaseParameters The database parameters
7678
*/
7779
export async function addOSSClusterDatabase(databaseParameters: OSSClusterParameters): Promise<void> {
78-
//Enter required parameters for OSS Cluster
80+
// Enter required parameters for OSS Cluster
7981
await addRedisDatabasePage.addOssClusterDatabase(databaseParameters);
80-
//Click for saving
81-
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
82-
//Check for info message that DB was added
83-
await t.expect(myRedisDatabasePage.databaseInfoMessage.exists).ok('Check that info message exists', { timeout: 10000 });
84-
//Wait for database to be exist
85-
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseParameters.ossClusterDatabaseName).exists).ok('The existence of the database', { timeout: 10000 });
82+
// Click for saving
83+
await t
84+
.click(addRedisDatabasePage.addRedisDatabaseButton)
85+
// Check for info message that DB was added
86+
.expect(myRedisDatabasePage.databaseInfoMessage.exists).ok('Info message not exists', { timeout: 10000 })
87+
// Wait for database to be exist
88+
.expect(myRedisDatabasePage.dbNameList.withExactText(databaseParameters.ossClusterDatabaseName).exists).ok('The database not displayed', { timeout: 10000 });
8689
}
8790

8891
/**
@@ -91,19 +94,21 @@ export async function addOSSClusterDatabase(databaseParameters: OSSClusterParame
9194
* @param cloudAPISecretKey The Cloud API Secret Key
9295
*/
9396
export async function addNewRECloudDatabase(cloudAPIAccessKey: string, cloudAPISecretKey: string): Promise<string> {
94-
//Fill the add database form and Submit
97+
// Fill the add database form and Submit
9598
await addRedisDatabasePage.addAutodiscoverRECloudDatabase(cloudAPIAccessKey, cloudAPISecretKey);
96-
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
97-
//Select subscriptions
98-
await t.click(addRedisDatabasePage.selectAllCheckbox);
99-
await t.click(addRedisDatabasePage.showDatabasesButton);
100-
//Select databases for adding
99+
await t
100+
.click(addRedisDatabasePage.addRedisDatabaseButton)
101+
// Select subscriptions
102+
.click(addRedisDatabasePage.selectAllCheckbox)
103+
.click(addRedisDatabasePage.showDatabasesButton);
104+
// Select databases for adding
101105
const databaseName = await browserPage.getDatabasesName();
102-
await t.click(addRedisDatabasePage.selectAllCheckbox);
103-
await t.click(autoDiscoverREDatabases.addSelectedDatabases);
104-
//Wait for database to be exist in the My redis databases list
105-
await t.click(autoDiscoverREDatabases.viewDatabasesButton);
106-
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseName).exists).ok('The existence of the database', { timeout: 10000 });
106+
await t
107+
.click(addRedisDatabasePage.selectAllCheckbox)
108+
.click(autoDiscoverREDatabases.addSelectedDatabases)
109+
// Wait for database to be exist in the My redis databases list
110+
.click(autoDiscoverREDatabases.viewDatabasesButton)
111+
.expect(myRedisDatabasePage.dbNameList.withExactText(databaseName).exists).ok('The database not displayed', { timeout: 10000 });
107112
return databaseName;
108113
}
109114

@@ -115,7 +120,7 @@ export async function addNewRECloudDatabase(cloudAPIAccessKey: string, cloudAPIS
115120
export async function acceptLicenseTermsAndAddDatabase(databaseParameters: AddNewDatabaseParameters, databaseName: string): Promise<void> {
116121
await acceptLicenseTerms();
117122
await addNewStandaloneDatabase(databaseParameters);
118-
//Connect to DB
123+
// Connect to DB
119124
await myRedisDatabasePage.clickOnDBByName(databaseName);
120125
}
121126

@@ -129,7 +134,7 @@ export async function acceptLicenseTermsAndAddDatabaseApi(databaseParameters: Ad
129134
await addNewStandaloneDatabaseApi(databaseParameters);
130135
// Reload Page to see the new added database through api
131136
await common.reloadPage();
132-
//Connect to DB
137+
// Connect to DB
133138
await myRedisDatabasePage.clickOnDBByName(databaseName);
134139
}
135140

@@ -141,7 +146,7 @@ export async function acceptLicenseTermsAndAddDatabaseApi(databaseParameters: Ad
141146
export async function acceptLicenseTermsAndAddOSSClusterDatabase(databaseParameters: OSSClusterParameters, databaseName: string): Promise<void> {
142147
await acceptLicenseTerms();
143148
await addOSSClusterDatabase(databaseParameters);
144-
//Connect to DB
149+
// Connect to DB
145150
await myRedisDatabasePage.clickOnDBByName(databaseName);
146151
}
147152

@@ -154,7 +159,7 @@ export async function acceptLicenseTermsAndAddSentinelDatabaseApi(databaseParame
154159
await discoverSentinelDatabaseApi(databaseParameters);
155160
// Reload Page to see the database added through api
156161
await common.reloadPage();
157-
//Connect to DB
162+
// Connect to DB
158163
await myRedisDatabasePage.clickOnDBByName(databaseParameters.name[1] ?? '');
159164
}
160165

@@ -165,7 +170,7 @@ export async function acceptLicenseTermsAndAddSentinelDatabaseApi(databaseParame
165170
export async function acceptLicenseTermsAndAddREClusterDatabase(databaseParameters: AddNewDatabaseParameters): Promise<void> {
166171
await acceptLicenseTerms();
167172
await addNewREClusterDatabase(databaseParameters);
168-
//Connect to DB
173+
// Connect to DB
169174
await myRedisDatabasePage.clickOnDBByName(databaseParameters.databaseName ?? '');
170175
}
171176

@@ -180,38 +185,40 @@ export async function acceptLicenseTermsAndAddRECloudDatabase(databaseParameters
180185

181186
await acceptLicenseTerms();
182187
await addRedisDatabasePage.addRedisDataBase(databaseParameters);
183-
//Click for saving
188+
// Click for saving
184189
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
185190
// Reload page until db appears
186191
do {
187192
await common.reloadPage();
188193
}
189194
while (!(await dbSelector.exists) && Date.now() - startTime < searchTimeout);
190-
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseParameters.databaseName ?? '').exists).ok('The existence of the database', { timeout: 5000 });
195+
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseParameters.databaseName ?? '').exists).ok('The database not displayed', { timeout: 5000 });
191196
await myRedisDatabasePage.clickOnDBByName(databaseParameters.databaseName ?? '');
192197
}
193198

194-
//Accept License terms
199+
// Accept License terms
195200
export async function acceptLicenseTerms(): Promise<void> {
196201
await t.maximizeWindow();
197202
await userAgreementPage.acceptLicenseTerms();
198203
}
199204

200-
//Accept License terms and connect to the RedisStack database
205+
// Accept License terms and connect to the RedisStack database
201206
export async function acceptLicenseAndConnectToRedisStack(): Promise<void> {
202207
await acceptLicenseTerms();
203208
//Connect to DB
204-
await t.click(myRedisDatabasePage.myRedisDBButton);
205-
await t.click(addRedisDatabasePage.connectToRedisStackButton);
209+
await t
210+
.click(myRedisDatabasePage.myRedisDBButton)
211+
.click(addRedisDatabasePage.connectToRedisStackButton);
206212
}
207213

208-
//Clear database data
214+
// Clear database data
209215
export async function clearDatabaseInCli(): Promise<void> {
210216
if (await cliPage.cliCollapseButton.exists === false) {
211217
await t.click(cliPage.cliExpandButton);
212218
}
213-
await t.typeText(cliPage.cliCommandInput, 'FLUSHDB');
214-
await t.pressKey('enter');
219+
await t
220+
.typeText(cliPage.cliCommandInput, 'FLUSHDB')
221+
.pressKey('enter');
215222
}
216223

217224
/**

tests/e2e/helpers/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ export type Arguments = {
3030
ossClusterPort?: string,
3131
ossClusterDatabaseName?: string,
3232
[key: string]: any
33-
}
33+
};

tests/e2e/helpers/keys.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ export async function addKeysViaCli(keyData: KeyData, keyValue?: string, keyFiel
5757
await t.pressKey('enter');
5858
}
5959
}
60-
await t.click(cliPage.cliCollapseButton);
61-
await t.click(browserPage.refreshKeysButton);
60+
await t
61+
.click(cliPage.cliCollapseButton)
62+
.click(browserPage.refreshKeysButton);
6263
}
6364

6465
/**

tests/e2e/helpers/notifications.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ export function insertNotificationInDB(notifications: NotificationParameters[]):
3131
for (let i = 0; i < notifications.length; i++) {
3232
const messageWithQuotes = `${notifications[i].type}, ${notifications[i].timestamp},
3333
${notifications[i].title}, ${notifications[i].body}, ${notifications[i].isRead}`;
34-
console.log(`messageWithQuotes: ${messageWithQuotes}`);
3534
if (i === notifications.length - 1) {
3635
query = `${query} (${messageWithQuotes})`;
3736
}
3837
else {
3938
query = `${query} (${messageWithQuotes}),`;
4039
}
4140
}
42-
console.log(`query: ${query}`);
4341
db.run(query, function(err: { message: string }) {
4442
if (err) {
4543
return console.log(`error during notification creation: ${err.message}`);

tests/e2e/pageObjects/add-redis-database-page.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,12 @@ export class AddRedisDatabasePage {
8787
if (!!parameters.databasePassword) {
8888
await t.typeText(this.passwordInput, parameters.databasePassword, { replace: true, paste: true });
8989
}
90-
//Enter logical index
91-
await t.click(this.databaseIndexCheckbox);
92-
await t.typeText(this.databaseIndexInput, index, { replace: true, paste: true});
93-
//Click for saving
94-
await t.click(this.addRedisDatabaseButton);
90+
// Enter logical index
91+
await t
92+
.click(this.databaseIndexCheckbox)
93+
.typeText(this.databaseIndexInput, index, { replace: true, paste: true})
94+
// Click for saving
95+
.click(this.addRedisDatabaseButton);
9596
}
9697

9798
/**
@@ -230,7 +231,7 @@ export type databaseParameters = {
230231
* @param host The host of the node
231232
* @param port The port of the node
232233
*/
233-
export type ClusterNodes = {
234+
export type ClusterNodes = {
234235
host: string,
235236
port: string
236237
};

0 commit comments

Comments
 (0)