Skip to content

Commit 21b72b3

Browse files
committed
fixes for failed tests on ci
1 parent 1e448ee commit 21b72b3

21 files changed

+105
-89
lines changed

tests/e2e/helpers/database.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { t } from 'testcafe';
1+
import { Selector, t } from 'testcafe';
22
import { AddNewDatabaseParameters, SentinelParameters, OSSClusterParameters } from '../pageObjects/add-redis-database-page';
33
import { DiscoverMasterGroupsPage } from '../pageObjects/sentinel/discovered-sentinel-master-groups-page';
44
import {
@@ -9,7 +9,7 @@ import {
99
UserAgreementPage,
1010
CliPage
1111
} from '../pageObjects';
12-
import { addNewStandaloneDatabaseApi, discoverSentinelDatabaseApi } from './api/api-database';
12+
import { addNewStandaloneDatabaseApi, discoverSentinelDatabaseApi, getDatabaseByName } from './api/api-database';
1313
import { Common } from './common';
1414

1515
const myRedisDatabasePage = new MyRedisDatabasePage();
@@ -96,19 +96,17 @@ export async function addOSSClusterDatabase(databaseParameters: OSSClusterParame
9696
export async function addNewRECloudDatabase(cloudAPIAccessKey: string, cloudAPISecretKey: string): Promise<string> {
9797
// Fill the add database form and Submit
9898
await addRedisDatabasePage.addAutodiscoverRECloudDatabase(cloudAPIAccessKey, cloudAPISecretKey);
99-
await t
100-
.click(addRedisDatabasePage.addRedisDatabaseButton)
99+
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
101100
// Select subscriptions
102-
.click(addRedisDatabasePage.selectAllCheckbox)
103-
.click(addRedisDatabasePage.showDatabasesButton);
101+
await t.click(addRedisDatabasePage.selectAllCheckbox);
102+
await t.click(addRedisDatabasePage.showDatabasesButton);
104103
// Select databases for adding
105104
const databaseName = await browserPage.getDatabasesName();
106-
await t
107-
.click(addRedisDatabasePage.selectAllCheckbox)
108-
.click(autoDiscoverREDatabases.addSelectedDatabases)
105+
await t.click(addRedisDatabasePage.selectAllCheckbox);
106+
await t.click(autoDiscoverREDatabases.addSelectedDatabases);
109107
// 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 });
108+
await t.click(autoDiscoverREDatabases.viewDatabasesButton);
109+
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseName).exists).ok('The database not displayed', { timeout: 10000 });
112110
return databaseName;
113111
}
114112

@@ -229,7 +227,7 @@ export async function clearDatabaseInCli(): Promise<void> {
229227
export async function deleteDatabase(databaseName: string): Promise<void> {
230228
await t.click(myRedisDatabasePage.myRedisDBButton);
231229
if (await addRedisDatabasePage.addDatabaseButton.exists) {
232-
await myRedisDatabasePage.deleteDatabaseByName(databaseName);
230+
await deleteDatabaseByNameApi(databaseName);
233231
}
234232
}
235233

@@ -246,3 +244,28 @@ export async function acceptTermsAddDatabaseOrConnectToRedisStack(databaseParame
246244
await acceptLicenseAndConnectToRedisStack();
247245
}
248246
}
247+
248+
/**
249+
* Click on the edit database button by name
250+
* @param databaseName The name of the database
251+
*/
252+
export async function clickOnEditDatabaseByName(databaseName: string): Promise<void> {
253+
const databaseId = await getDatabaseByName(databaseName);
254+
const databaseEditBtn = Selector(`[data-testid=edit-instance-${databaseId}]`);
255+
256+
await t.expect(databaseEditBtn.exists).ok(`"${databaseName}" database not displayed`);
257+
await t.click(databaseEditBtn);
258+
}
259+
260+
/**
261+
* Delete database button by name
262+
* @param databaseName The name of the database
263+
*/
264+
export async function deleteDatabaseByNameApi(databaseName: string): Promise<void> {
265+
const databaseId = await getDatabaseByName(databaseName);
266+
const databaseDeleteBtn = Selector(`[data-testid=delete-instance-${databaseId}-icon]`);
267+
268+
await t.expect(databaseDeleteBtn.exists).ok(`"${databaseName}" database not displayed`);
269+
await t.click(databaseDeleteBtn);
270+
await t.click(myRedisDatabasePage.confirmDeleteButton);
271+
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ export class MyRedisDatabasePage {
6565
await t.click(this.toastCloseButton);
6666
}
6767
const db = this.dbNameList.withExactText(dbName.trim());
68-
await t
69-
.expect(db.exists).ok(`"${dbName}" database doesn't exist`, {timeout: 10000})
70-
.click(db);
68+
await t.expect(db.exists).ok(`"${dbName}" database doesn't exist`, {timeout: 10000});
69+
await t.click(db);
7170
}
7271

7372
//Delete all the databases from the list
@@ -115,8 +114,8 @@ export class MyRedisDatabasePage {
115114
*/
116115
async clickOnEditDBByName(databaseName: string): Promise<void> {
117116
const dbNames = this.dbNameList;
118-
const count = await dbNames.count;
119-
for (let i = 0; i < count; i++) {
117+
const count = dbNames.count;
118+
for (let i = 0; i < await count; i++) {
120119
if ((await dbNames.nth(i).innerText || '').includes(databaseName)) {
121120
await t.click(this.editDatabaseButton.nth(i));
122121
break;

tests/e2e/tests/critical-path/browser/stream-key.e2e.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ test('Verify that user can add several fields and values during Stream key creat
5353
// Verify that user can see Entity ID filled by * by default on add Stream key form
5454
await t.expect(browserPage.streamEntryId.withAttribute('value', '*').exists).ok('Preselected Stream Entity ID field not correct');
5555
// Verify that user can specify valid custom value for Entry ID
56-
await t.typeText(browserPage.streamEntryId, '0-1', {replace: true});
56+
await t.typeText(browserPage.streamEntryId, '0-1', { replace: true, paste: true});
5757
// Filled fields and value by different data types
5858
for (let i = 0; i < Object.keys(streamData).length; i++) {
59-
await t.typeText(browserPage.streamField.nth(-1), Object.keys(streamData)[i]);
60-
await t.typeText(browserPage.streamValue.nth(-1), Object.values(streamData)[i]);
59+
await t.typeText(browserPage.streamField.nth(-1), Object.keys(streamData)[i], { replace: true, paste: true});
60+
await t.typeText(browserPage.streamValue.nth(-1), Object.values(streamData)[i], { replace: true, paste: true});
6161
await t.scroll(scrollSelector, 'bottom');
6262
await t.expect(browserPage.streamField.count).eql(i + 1, 'Number of added fields not correct');
6363
if (i < Object.keys(streamData).length - 1) {

tests/e2e/tests/critical-path/browser/stream-pending-messages.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ test('Verify that claim with optional parameters, the message removed from this
9797
await t.click(browserPage.claimPendingMessageButton);
9898
await t.expect(browserPage.optionalParametersSwitcher.withAttribute('aria-checked', 'false').exists).ok('By default toggle for optional parameters is off');
9999
await t.click(browserPage.optionalParametersSwitcher);
100-
await t.typeText(browserPage.claimIdleTimeInput, '100', { replace: true });
100+
await t.typeText(browserPage.claimIdleTimeInput, '100', { replace: true, paste: true});
101101
await t.click(browserPage.forceClaimCheckbox);
102102
await t.click(browserPage.submitButton);
103103
await t.expect(browserPage.streamMessagesContainer.textContent).contains('Your Consumer has no pending messages.', 'The messages is claimed and removed from the table');

tests/e2e/tests/critical-path/cli/cli-command-helper.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test('Verify Command Helper search and filter', async t => {
3030
// Verify default text
3131
await t.expect(cliPage.cliHelperText.textContent).eql(defaultHelperText, 'Default text for CLI Helper is not shown');
3232
// Search any command
33-
await t.typeText(cliPage.cliHelperSearch, 'SET');
33+
await t.typeText(cliPage.cliHelperSearch, 'SET', { replace: true, paste: true });
3434
await t.expect(cliPage.cliHelperOutputTitles.count).gt(0, 'List of commands were not found');
3535
// Clear search input
3636
const clearButton = cliPage.cliHelper.find('[aria-label="Clear input"]');
@@ -66,7 +66,7 @@ test('Verify Command Helper search and filter', async t => {
6666
// Verify that Command helper cleared when user runs the command in CLI
6767
await t.click(cliPage.cliExpandButton);
6868
// Enter command into CLI
69-
await t.typeText(cliPage.cliCommandInput, COMMAND_APPEND, { speed: 0.5 });
69+
await t.typeText(cliPage.cliCommandInput, COMMAND_APPEND, { speed: 0.5, replace: true, paste: true });
7070
await t.expect(cliPage.filterGroupTypeButton.textContent).notContains(COMMAND_GROUP_SET, 'Filter was not cleared');
7171
await t.expect(cliPage.cliHelperSearch.value).eql('', 'Search was not cleared');
7272

tests/e2e/tests/critical-path/cli/cli-critical.e2e.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test
4848
await t.click(cliPage.cliExpandButton);
4949
// Add key from CLI
5050
for ([keyName, value] of pairsToSet) {
51-
await t.typeText(cliPage.cliCommandInput, `SET ${keyName} ${value}`);
51+
await t.typeText(cliPage.cliCommandInput, `SET ${keyName} ${value}`, { replace: true, paste: true});
5252
await t.pressKey('enter');
5353
}
5454
// Check that user is redirected
@@ -59,13 +59,13 @@ test
5959
//Open CLI
6060
await t.click(cliPage.cliExpandButton);
6161

62-
await t.typeText(cliPage.cliCommandInput, 'SET key');
62+
await t.typeText(cliPage.cliCommandInput, 'SET key', { replace: true, paste: true});
6363
await t.pressKey('enter');
6464
// Check error
6565
const errWrongArgs = cliPage.cliOutputResponseFail.withText('ERR wrong number of arguments for \'set\' command');
6666
await t.expect(errWrongArgs.exists).ok('Error with wrong number of arguments was not shown');
6767

68-
await t.typeText(cliPage.cliCommandInput, 'lorem');
68+
await t.typeText(cliPage.cliCommandInput, 'lorem', { replace: true, paste: true});
6969
await t.pressKey('enter');
7070
// Check error
7171
const errWrongCmnd = cliPage.cliOutputResponseFail.withText('ERR unknown command');
@@ -77,7 +77,7 @@ test
7777
const commandStartsWith = 'I';
7878
// Open CLI
7979
await t.click(cliPage.cliExpandButton);
80-
await t.typeText(cliPage.cliCommandInput, commandStartsWith);
80+
await t.typeText(cliPage.cliCommandInput, commandStartsWith, { replace: true, paste: true});
8181
// Press tab while we won't find 'INFO' command
8282
// Avoid endless cycle
8383
let operationsCount = 0;
@@ -108,13 +108,13 @@ test
108108

109109
// Open CLI
110110
await t.click(cliPage.cliExpandButton);
111-
await t.typeText(cliPage.cliCommandInput, command, { replace: true });
111+
await t.typeText(cliPage.cliCommandInput, command, { replace: true, paste: true});
112112
// Verify that user can type AI command in CLI and see agruments in hints from RedisAI commands.json
113113
await t.expect(cliPage.cliCommandAutocomplete.textContent).eql(commandHint, `The hints with arguments for command ${command} not shown`);
114114

115115
// Enter commands and check hints with arguments
116116
for(const command of commands) {
117-
await t.typeText(cliPage.cliCommandInput, command, { replace: true });
117+
await t.typeText(cliPage.cliCommandInput, command, { replace: true, paste: true});
118118
await t.expect(cliPage.cliCommandAutocomplete.textContent).eql(commandHints[commands.indexOf(command)], `The hints with arguments for command ${command} not shown`);
119119
}
120120
});

tests/e2e/tests/critical-path/database/clone-databases.e2e.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { rte } from '../../../helpers/constants';
22
import { AddRedisDatabasePage, MyRedisDatabasePage } from '../../../pageObjects';
33
import { commonUrl, ossClusterConfig, ossSentinelConfig, ossStandaloneConfig } from '../../../helpers/conf';
4-
import { acceptLicenseTerms } from '../../../helpers/database';
4+
import { acceptLicenseTerms, clickOnEditDatabaseByName } from '../../../helpers/database';
55
import {
66
addNewOSSClusterDatabaseApi,
77
addNewStandaloneDatabaseApi,
@@ -34,12 +34,12 @@ test
3434
}
3535
})
3636
.meta({ rte: rte.standalone })('Verify that user can clone Standalone db', async t => {
37-
await myRedisDatabasePage.clickOnEditDBByName(ossStandaloneConfig.databaseName);
37+
await clickOnEditDatabaseByName(ossStandaloneConfig.databaseName);
3838
// Verify that user can cancel the Clone by clicking the “Cancel” or the “x” button
3939
await t.click(addRedisDatabasePage.cloneDatabaseButton);
4040
await t.click(addRedisDatabasePage.cancelButton);
4141
await t.expect(myRedisDatabasePage.editAliasButton.withText('Clone ').exists).notOk('Clone panel is still displayed', { timeout: 2000 });
42-
await myRedisDatabasePage.clickOnEditDBByName(ossStandaloneConfig.databaseName);
42+
await clickOnEditDatabaseByName(ossStandaloneConfig.databaseName);
4343
await t.click(addRedisDatabasePage.cloneDatabaseButton);
4444
// Verify that user see the “Add Database Manually” form pre-populated with all the connection data when cloning DB
4545
await t
@@ -64,7 +64,7 @@ test
6464
await myRedisDatabasePage.deleteDatabaseByName(newOssDatabaseAlias);
6565
})
6666
.meta({ rte: rte.ossCluster })('Verify that user can clone OSS Cluster', async t => {
67-
await myRedisDatabasePage.clickOnEditDBByName(ossClusterConfig.ossClusterDatabaseName);
67+
await clickOnEditDatabaseByName(ossClusterConfig.ossClusterDatabaseName);
6868
await t.click(addRedisDatabasePage.cloneDatabaseButton);
6969
await t
7070
.expect(myRedisDatabasePage.editAliasButton.withText('Clone ').exists).ok('Clone panel is not displayed')
@@ -92,7 +92,7 @@ test
9292
await common.reloadPage();
9393
})
9494
.meta({ rte: rte.sentinel })('Verify that user can clone Sentinel', async t => {
95-
await myRedisDatabasePage.clickOnEditDBByName(ossSentinelConfig.name[1]);
95+
await clickOnEditDatabaseByName(ossSentinelConfig.name[1]);
9696
await t.click(addRedisDatabasePage.cloneDatabaseButton);
9797
// Verify that for Sentinel Host and Port fields are replaced with editable Primary Group Name field
9898
await t

tests/e2e/tests/regression/browser/consumer-group.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ test('Verify that user can see error message if enter invalid last delivered ID'
145145
for(const id of invalidEntryIds){
146146
const idBefore = await browserPage.streamGroupId.textContent;
147147
await t.click(browserPage.editStreamLastIdButton);
148-
await t.typeText(browserPage.lastIdInput, id, { replace: true });
148+
await t.typeText(browserPage.lastIdInput, id, { replace: true, paste: true });
149149
await t.click(browserPage.saveButton);
150150
await t.expect(browserPage.streamGroupId.textContent).eql(idBefore, 'The last delivered ID is not modified');
151151
await t.expect(browserPage.entryIdError.textContent).eql(errorMessage, 'The error message not displayed');

tests/e2e/tests/regression/browser/context.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test('Verify that if user has saved context on Browser page and go to Settings p
3434
await browserPage.addStringKey(keyName);
3535
await browserPage.openKeyDetails(keyName);
3636
await t.click(cliPage.cliExpandButton);
37-
await t.typeText(cliPage.cliCommandInput, command);
37+
await t.typeText(cliPage.cliCommandInput, command, { replace: true, paste: true });
3838
await t.pressKey('enter');
3939
await t.click(myRedisDatabasePage.settingsButton);
4040
// Verify that Browser and Workbench icons are displayed

tests/e2e/tests/regression/browser/stream-pending-messages.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ test('Verify that the message is claimed only if its idle time is greater than t
7575
const streamMessageBefore = await browserPage.streamMessage.count;
7676
// Claim message and check result when Min Idle Time is greater than the idle time
7777
await t.click(browserPage.claimPendingMessageButton);
78-
await t.typeText(browserPage.streamMinIdleTimeInput, '100000000');
78+
await t.typeText(browserPage.streamMinIdleTimeInput, '100000000', { replace: true, paste: true });
7979
await t.click(browserPage.submitButton);
8080
await t.expect(browserPage.notificationMessage.textContent).contains('No messages claimed', 'The message is not claimed notification');
8181
await t.expect(browserPage.streamMessage.count).eql(streamMessageBefore, 'The number of pendings in the table not correct');

0 commit comments

Comments
 (0)