Skip to content

Commit 58e5427

Browse files
committed
fixes for tests, deleted await in assertions for stability, added paste and replace to typeText method
1 parent 21b72b3 commit 58e5427

20 files changed

+64
-52
lines changed

tests/e2e/helpers/database.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,17 @@ export async function deleteDatabase(databaseName: string): Promise<void> {
231231
}
232232
}
233233

234+
/**
235+
* Delete database with custom name
236+
* @param databaseName The database name
237+
*/
238+
export async function deleteCustomDatabase(databaseName: string): Promise<void> {
239+
await t.click(myRedisDatabasePage.myRedisDBButton);
240+
if (await addRedisDatabasePage.addDatabaseButton.exists) {
241+
await myRedisDatabasePage.deleteDatabaseByName(databaseName);
242+
}
243+
}
244+
234245
/**
235246
* Accept License terms and add database or connect to the Redis stask database
236247
* @param databaseParameters The database parameters

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class AddRedisDatabasePage {
1818
showDatabasesButton = Selector('[data-testid=btn-show-databases]');
1919
databaseName = Selector('.euiTableCellContent.column_name');
2020
selectAllCheckbox = Selector('[data-test-subj=checkboxSelectAll]');
21-
databaseIndexCheckbox = Selector('[data-testid=showDb]~div');
21+
databaseIndexCheckbox = Selector('[data-testid=showDb]~div', { timeout: 500 });
2222
connectToDatabaseButton = Selector('[data-testid=connect-to-db-btn]');
2323
connectToRedisStackButton = Selector('[aria-label="Connect to database"]');
2424
discoverSentinelDatabaseButton = Selector('[data-testid=btn-submit]');

tests/e2e/tests/critical-path/browser/context.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ test('Verify that user can see saved executed commands in CLI on Browser page wh
8888
// Return back to Browser and check executed command in CLI
8989
await t.click(myRedisDatabasePage.browserButton);
9090
for(const command of commands) {
91-
await t.expect(await cliPage.cliCommandExecuted.withExactText(command).exists).ok(`Executed command '${command}' in CLI is saved`);
91+
await t.expect(cliPage.cliCommandExecuted.withExactText(command).exists).ok(`Executed command '${command}' in CLI is saved`);
9292
}
9393
});
9494
test
@@ -104,7 +104,7 @@ test
104104
await t.click(myRedisDatabasePage.settingsButton);
105105
// Return back to Browser and check key details selected
106106
await t.click(myRedisDatabasePage.browserButton);
107-
await t.expect(await browserPage.keyNameFormDetails.withExactText(keyName).exists).ok('The key details is selected');
107+
await t.expect(browserPage.keyNameFormDetails.withExactText(keyName).exists).ok('The key details is selected');
108108
});
109109
test
110110
.after(async() => {

tests/e2e/tests/critical-path/memory-efficiency/memory-efficiency.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ test
9292
// Verify that user can quickly set the filters per keyspaces in the Browser/Tree View from the list of keyspaces
9393
await t.click(memoryEfficiencyPage.expandedItem);
9494
// Verify filter by data type applied
95-
await t.expect(await browserPage.filteringLabel.textContent).eql('Stream', 'Key type lable is not displayed in search input');
95+
await t.expect(browserPage.filteringLabel.textContent).eql('Stream', 'Key type lable is not displayed in search input');
9696
// Verify keyname in search input prepopulated
97-
await t.expect(await browserPage.filterByPatterSearchInput.withAttribute('value', keySpaces[0]).exists).ok('Filter per key name is not applied');
97+
await t.expect(browserPage.filterByPatterSearchInput.withAttribute('value', keySpaces[0]).exists).ok('Filter per key name is not applied');
9898
// Verify key is displayed
9999
await t.click(browserPage.browserViewButton);
100100
await t.expect(await browserPage.isKeyIsDisplayedInTheList(streamKeyName)).ok('Key is not found');

tests/e2e/tests/critical-path/workbench/autocomplete.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test('Verify that when user have selected a command (via “Enter” from the li
2828
// Start type characters and select command
2929
await t.typeText(workbenchPage.queryInput, 'LI', { replace: true });
3030
// Verify that the list with auto-suggestions is displayed
31-
await t.expect(await workbenchPage.monacoSuggestion.exists).ok('Auto-suggestions are displayed');
31+
await t.expect(workbenchPage.monacoSuggestion.exists).ok('Auto-suggestions are displayed');
3232
// Select command and check result
3333
await t.pressKey('enter');
3434
const script = await workbenchPage.queryInputScriptArea.textContent;

tests/e2e/tests/critical-path/workbench/scripting-area.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ test('Verify that user can resize scripting area in Workbench', async t => {
3636

3737
await workbenchPage.sendCommandInWorkbench(commandForSend);
3838
// Verify that user can run any script from CLI in Workbench and see the results
39-
await t.expect(await workbenchPage.queryCardContainer.exists).ok('Query card was added');
40-
const sentCommandText = await workbenchPage.queryCardCommand.withExactText(commandForSend);
39+
await t.expect(workbenchPage.queryCardContainer.exists).ok('Query card was added');
40+
const sentCommandText = workbenchPage.queryCardCommand.withExactText(commandForSend);
4141
await t.expect(sentCommandText.exists).ok('Result of sent command exists');
4242

4343
await t.hover(workbenchPage.resizeButtonForScriptingAndResults);

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ test('Verify that if user has saved context on Browser page and go to Settings p
3838
await t.pressKey('enter');
3939
await t.click(myRedisDatabasePage.settingsButton);
4040
// Verify that Browser and Workbench icons are displayed
41-
await t.expect(await myRedisDatabasePage.browserButton.visible).ok('Browser icon is not displayed');
42-
await t.expect(await myRedisDatabasePage.workbenchButton.visible).ok('Workbench icon is not displayed');
41+
await t.expect(myRedisDatabasePage.browserButton.visible).ok('Browser icon is not displayed');
42+
await t.expect(myRedisDatabasePage.workbenchButton.visible).ok('Workbench icon is not displayed');
4343
// Open Browser page and verify context
4444
await t.click(myRedisDatabasePage.browserButton);
45-
await t.expect(await browserPage.filterByPatterSearchInput.withAttribute('value', keyName).exists).ok('Filter per key name is not applied');
46-
await t.expect(await browserPage.keyNameFormDetails.withExactText(keyName).exists).ok('The key details is not selected');
47-
await t.expect(await cliPage.cliCommandExecuted.withExactText(command).exists).ok(`Executed command '${command}' in CLI is not saved`);
45+
await t.expect(browserPage.filterByPatterSearchInput.withAttribute('value', keyName).exists).ok('Filter per key name is not applied');
46+
await t.expect(browserPage.keyNameFormDetails.withExactText(keyName).exists).ok('The key details is not selected');
47+
await t.expect(cliPage.cliCommandExecuted.withExactText(command).exists).ok(`Executed command '${command}' in CLI is not saved`);
4848
await t.click(cliPage.cliCollapseButton);
4949
});
5050
test('Verify that when user reload the window with saved context(on any page), context is not saved when he returns back to Browser page', async t => {
@@ -55,13 +55,13 @@ test('Verify that when user reload the window with saved context(on any page), c
5555
await t.click(myRedisDatabasePage.workbenchButton);
5656
// Open Browser page and verify context
5757
await t.click(myRedisDatabasePage.browserButton);
58-
await t.expect(await browserPage.filterByPatterSearchInput.withAttribute('value', keyName).exists).ok('Filter per key name is not applied');
59-
await t.expect(await browserPage.keyNameFormDetails.withExactText(keyName).exists).ok('The key details is not selected');
58+
await t.expect(browserPage.filterByPatterSearchInput.withAttribute('value', keyName).exists).ok('Filter per key name is not applied');
59+
await t.expect(browserPage.keyNameFormDetails.withExactText(keyName).exists).ok('The key details is not selected');
6060
// Navigate to Workbench and reload the window
6161
await t.click(myRedisDatabasePage.workbenchButton);
6262
await common.reloadPage();
6363
// Return back to Browser and check context is not saved
6464
await t.click(myRedisDatabasePage.browserButton);
65-
await t.expect(await browserPage.filterByPatterSearchInput.withAttribute('value', keyName).exists).notOk('Filter per key name is applied');
66-
await t.expect(await browserPage.keyNameFormDetails.withExactText(keyName).exists).notOk('The key details is selected');
65+
await t.expect(browserPage.filterByPatterSearchInput.withAttribute('value', keyName).exists).notOk('Filter per key name is applied');
66+
await t.expect(browserPage.keyNameFormDetails.withExactText(keyName).exists).notOk('The key details is selected');
6767
});

tests/e2e/tests/regression/browser/database-overview-keys.e2e.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { t } from 'testcafe';
2-
import { acceptLicenseTermsAndAddDatabase, acceptLicenseTermsAndAddRECloudDatabase, deleteDatabase } from '../../../helpers/database';
2+
import { acceptLicenseTermsAndAddDatabase, acceptLicenseTermsAndAddRECloudDatabase, deleteCustomDatabase, deleteDatabase } from '../../../helpers/database';
33
import {
44
MyRedisDatabasePage,
55
CliPage,
@@ -11,7 +11,6 @@ import { rte } from '../../../helpers/constants';
1111
import { cloudDatabaseConfig, commonUrl, ossStandaloneRedisearch } from '../../../helpers/conf';
1212
import { Common } from '../../../helpers/common';
1313
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
14-
import { deleteAllKeysFromDB } from '../../../helpers/keys';
1514

1615
const myRedisDatabasePage = new MyRedisDatabasePage();
1716
const workbenchPage = new WorkbenchPage();
@@ -48,7 +47,7 @@ fixture `Database overview`
4847
await t.click(myRedisDatabasePage.myRedisDBButton);
4948
await myRedisDatabasePage.clickOnDBByName(`${ossStandaloneRedisearch.databaseName} [${index}]`);
5049
await cliPage.sendCommandInCli(`DEL ${keys.join(' ')}`);
51-
await deleteDatabase(`${ossStandaloneRedisearch.databaseName} [${index}]`);
50+
await deleteCustomDatabase(`${ossStandaloneRedisearch.databaseName} [${index}]`);
5251
await myRedisDatabasePage.clickOnDBByName(ossStandaloneRedisearch.databaseName);
5352
await browserPage.deleteKeyByName(keyName);
5453
await deleteStandaloneDatabaseApi(ossStandaloneRedisearch);

tests/e2e/tests/regression/browser/filtering.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,6 @@ test
185185
? Selector('[data-testid^=badge-ReJSON]')
186186
: Selector(`[data-testid^=badge-${keyTypes[i].keyName}]`);
187187
// Verify that all results have the same type as in filter
188-
await t.expect(await browserPage.filteringLabel.count).eql(await filteredTypeKeys.count, `The keys of type ${keyTypes[i].textType} not filtered correctly`);
188+
await t.expect(browserPage.filteringLabel.count).eql(await filteredTypeKeys.count, `The keys of type ${keyTypes[i].textType} not filtered correctly`);
189189
}
190190
});

tests/e2e/tests/regression/cli/cli-logical-db.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { acceptLicenseTerms, deleteDatabase } from '../../../helpers/database';
1+
import { acceptLicenseTerms, deleteCustomDatabase } from '../../../helpers/database';
22
import { CliPage, AddRedisDatabasePage, MyRedisDatabasePage } from '../../../pageObjects';
33
import {
44
commonUrl,
@@ -28,7 +28,7 @@ fixture `CLI logical database`
2828
})
2929
.afterEach(async() => {
3030
// Delete database
31-
await deleteDatabase(`${ossStandaloneConfig.databaseName } [${index}]`);
31+
await deleteCustomDatabase(`${ossStandaloneConfig.databaseName} [${index}]`);
3232
});
3333
test
3434
.after(async() => {

0 commit comments

Comments
 (0)