Skip to content

Commit fdff988

Browse files
committed
fixes for e2e
1 parent 67f4a45 commit fdff988

File tree

10 files changed

+41
-42
lines changed

10 files changed

+41
-42
lines changed

tests/e2e/common-actions/browser-actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export class BrowserActions {
3737
*/
3838
async verifyTooltipContainsText(expectedText: string, contains: boolean): Promise<void> {
3939
contains
40-
? await t.expect(browserPage.tooltip.textContent).contains(expectedText, `"${expectedText}" Text is incorrect in tooltip`)
41-
: await t.expect(browserPage.tooltip.textContent).notContains(expectedText, `Tooltip still contains text "${expectedText}"`);
40+
? await t.expect(browserPage.tooltip.innerText).contains(expectedText, `"${expectedText}" Text is incorrect in tooltip`)
41+
: await t.expect(browserPage.tooltip.innerText).notContains(expectedText, `Tooltip still contains text "${expectedText}"`);
4242
}
4343

4444
/**

tests/e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"build:ui": "yarn --cwd ../../ build:ui",
1414
"redis:last": "docker run --name redis-last-version -p 7777:6379 -d redislabs/redismod",
1515
"start:app": "cross-env yarn start:api",
16-
"test:chrome": "testcafe --compiler-options typescript.configPath=tsconfig.testcafe.json --cache --disable-multiple-windows --concurrency 1 chrome tests/ -r html:./report/report.html,spec -e -s takeOnFails=true,path=report/screenshots/,pathPattern=${OS}_${BROWSER}/${DATE}_${TIME}/${FIXTURE}_${TEST}_${FILE_INDEX}.png",
16+
"test:chrome": "testcafe --compiler-options typescript.configPath=tsconfig.testcafe.json --cache --allow-insecure-localhost --ignore-certificate-errors --disable-multiple-windows --concurrency 1 chrome tests/ -r html:./report/report.html,spec -e -s takeOnFails=true,path=report/screenshots/,pathPattern=${OS}_${BROWSER}/${DATE}_${TIME}/${FIXTURE}_${TEST}_${FILE_INDEX}.png",
1717
"test:chrome:ci": "ts-node ./web.runner.ts",
1818
"test": "yarn test:chrome",
1919
"lint": "eslint . --ext .ts,.js,.tsx,.jsx",

tests/e2e/pageObjects/browser-page.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class BrowserPage extends InstancePage {
6464
expandJsonObject = Selector('[data-testid=expand-object]');
6565
scoreButton = Selector('[data-testid=score-button]');
6666
sortingButton = Selector('[data-testid=header-sorting-button]');
67-
editJsonObjectButton = Selector('[data-testid=edit-object-btn]');
67+
editJsonObjectButton = Selector('[data-testid=edit-json-field]');
6868
applyEditButton = Selector('[data-testid=apply-edit-btn]');
6969
scanMoreButton = Selector('[data-testid=scan-more]');
7070
resizeBtnKeyList = Selector('[data-test-subj=resize-btn-keyList-keyDetails]');
@@ -864,7 +864,9 @@ export class BrowserPage extends InstancePage {
864864
* @param jsonStructure The structure of the json key
865865
*/
866866
async addJsonStructure(jsonStructure: string): Promise<void> {
867-
await t.click(this.expandJsonObject);
867+
if (await this.expandJsonObject.exists) {
868+
await t.click(this.expandJsonObject);
869+
}
868870
await t.click(this.editJsonObjectButton);
869871
await t.typeText(this.jsonValueInput, jsonStructure, { replace: true, paste: true });
870872
await t.click(this.applyEditButton);
@@ -970,7 +972,7 @@ export class BrowserPage extends InstancePage {
970972
* @param guide The guide name
971973
*/
972974
async clickGuideLinksByName(guide: string): Promise<void> {
973-
const linkGuide = Selector(`[data-testid^="guide-button-"]`).withExactText(guide);
975+
const linkGuide = Selector('[data-testid^="guide-button-"]').withExactText(guide);
974976
await t.click(linkGuide);
975977
}
976978
}

tests/e2e/tests/web/critical-path/browser/bulk-delete.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ test('Verify that user can access the bulk actions screen in the Browser', async
4444
// Verify that user can hover over info icon in Bulk Delete preview and see info about accuracy of the calculation
4545
const tooltipText = 'Expected amount is estimated based on the number of keys scanned and the scan percentage. The final number may be different.';
4646
await t.hover(browserPage.BulkActions.bulkDeleteTooltipIcon);
47-
await t.expect(browserPage.tooltip.textContent).eql(tooltipText, 'Tooltip is not displayed or text is invalid');
47+
await t.expect(browserPage.tooltip.innerText).eql(tooltipText, 'Tooltip is not displayed or text is invalid');
4848
// Verify that user can see warning message clicking on Delete button for Bulk Deletion
4949
const warningTooltipTitle = 'Are you sure you want to perform this action?';
5050
const warningTooltipMessage = 'All keys with HASH key type and selected pattern will be deleted.';

tests/e2e/tests/web/critical-path/monitor/save-commands.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test('Verify that user can see a tooltip and toggle that allows to save Profiler
4141
await t.hover(browserPage.Profiler.saveLogSwitchButton);
4242
for (const message of toolTip) {
4343
await t.click(browserPage.Profiler.saveLogSwitchButton);
44-
await t.expect(browserPage.Profiler.saveLogToolTip.textContent).contains(message, 'The toolTip for save log in Profiler is not displayed');
44+
await t.expect(browserPage.Profiler.saveLogToolTip.innerText).contains(message, 'The toolTip for save log in Profiler is not displayed');
4545
}
4646
// Check toggle state
4747
await t.expect(browserPage.Profiler.saveLogSwitchButton.getAttribute('aria-checked')).eql('false', 'The toggle state is not OFF when Profiler opened');

tests/e2e/tests/web/regression/browser/full-screen.e2e.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { DatabaseHelper } from '../../../../helpers/database';
22
import { BrowserPage } from '../../../../pageObjects';
33
import { rte } from '../../../../helpers/constants';
4-
import { commonUrl, ossStandaloneConfig } from '../../../../helpers/conf';
4+
import { commonUrl, ossStandaloneConfig, ossStandaloneConfigEmpty } from '../../../../helpers/conf';
55
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
66
import { Common } from '../../../../helpers/common';
77
import { APIKeyRequests } from '../../../../helpers/api/api-keys';
@@ -48,21 +48,25 @@ test
4848
const widthAfterExitFullScreen = await browserPage.keyDetailsTable.clientWidth;
4949
await t.expect(widthAfterExitFullScreen).lt(widthAfterFullScreen, 'Width after switching from full screen not less then before');
5050
});
51-
test.before(async() => {
52-
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig);
53-
await browserPage.Cli.sendCommandInCli('flushdb');
54-
})('Verify that when no keys are selected user can click on "Close" control for right table and see key list in full screen', async t => {
51+
test
52+
.before(async() => {
53+
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfigEmpty);
54+
await browserPage.Cli.sendCommandInCli('flushdb');
55+
})
56+
.after(async() => {
57+
await browserPage.Cli.sendCommandInCli('flushdb');
58+
})('Verify that when no keys are selected user can click on "Close" control for right table and see key list in full screen', async t => {
5559
// Verify that user sees two panels(key list and empty details panel) opening Browser page for the first time
56-
await t.expect(browserPage.noKeysToDisplayText.visible).ok('No keys selected panel not displayed');
57-
// Save key table size before switching to full screen
58-
const widthKeysBeforeFullScreen = await browserPage.keyListTable.clientWidth;
59-
// Close right panel with key details
60-
await t.expect(browserPage.keyNameFormDetails.withExactText(keyName).exists).notOk('Key Details Table not displayed');
61-
await t.click(browserPage.closeRightPanel);
62-
// Check that table is in full screen
63-
const widthTableAfterFullScreen = await browserPage.keyListTable.clientWidth;
64-
await t.expect(widthTableAfterFullScreen).gt(widthKeysBeforeFullScreen, 'Width after switching to full screen not greater then before');
65-
});
60+
await t.expect(browserPage.noKeysToDisplayText.visible).ok('No keys selected panel not displayed');
61+
// Save key table size before switching to full screen
62+
const widthKeysBeforeFullScreen = await browserPage.keyListTable.clientWidth;
63+
// Close right panel with key details
64+
await t.expect(browserPage.keyNameFormDetails.withExactText(keyName).exists).notOk('Key Details Table not displayed');
65+
await t.click(browserPage.closeRightPanel);
66+
// Check that table is in full screen
67+
const widthTableAfterFullScreen = await browserPage.keyListTable.clientWidth;
68+
await t.expect(widthTableAfterFullScreen).gt(widthKeysBeforeFullScreen, 'Width after switching to full screen not greater then before');
69+
});
6670
test
6771
.before(async() => {
6872
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig);

tests/e2e/tests/web/regression/tree-view/tree-view.e2e.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ fixture `Tree view verifications`
2626
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneBigConfig);
2727
})
2828
.afterEach(async() => {
29-
await browserPage.Cli.sendCommandInCli('flushdb');
3029
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneBigConfig);
3130
});
3231
test
@@ -37,7 +36,6 @@ test
3736
.after(async() => {
3837
await browserPage.Cli.sendCommandInCli('flushdb');
3938
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneConfigEmpty);
40-
await browserPage.Cli.sendCommandInCli('flushdb');
4139
})('Verify that user has load sample data button when there are no keys in the database', async t => {
4240
const message = 'Let\'sstartworkingLoadsampledata+Addkeymanually';
4341
const actualMessage = await browserPage.keyListMessage.innerText;

tests/e2e/tests/web/regression/triggers-and-functions/libraries.e2e.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,19 @@ fixture `Triggers and Functions`
5252
await browserPage.Cli.sendCommandInCli(`TFUNCTION DELETE ${libraryName}`);
5353
await databaseAPIRequests.deleteStandaloneDatabaseApi(ossStandaloneRedisGears);
5454
});
55-
5655
test('Verify that when user can see added library', async t => {
57-
5856
const item = { name: libraryName, user: 'default', pending: 0, totalFunctions: 1 } as TriggersAndFunctionLibrary;
5957
const command = `TFUNCTION LOAD "#!js api_version=1.0 name=${libraryName}\\n redis.registerFunction(\'foo\', ()=>{return \'bar\'})"`;
58+
6059
await browserPage.Cli.sendCommandInCli(command);
6160
await t.click(browserPage.NavigationPanel.triggeredFunctionsButton);
6261
await t.click(triggersAndFunctionsFunctionsPage.librariesLink);
63-
const row = await triggersAndFunctionsLibrariesPage.getLibraryItem(libraryName);
62+
const row = await triggersAndFunctionsLibrariesPage.getLibraryItem(libraryName);
6463
await t.expect(row.name).eql(item.name, 'library name is unexpected');
6564
await t.expect(row.user).eql(item.user, 'user name is unexpected');
6665
await t.expect(row.pending).eql(item.pending, 'user name is unexpected');
6766
await t.expect(row.totalFunctions).eql(item.totalFunctions, 'user name is unexpected');
6867
});
69-
7068
test('Verify that library details is displayed', async t => {
7169
const command = `TFUNCTION LOAD "#!js api_version=1.0 name=${libraryName}\\n
7270
redis.registerFunction('${LIBRARIES_LIST[0].name}', function(){});
@@ -80,13 +78,12 @@ test('Verify that library details is displayed', async t => {
8078

8179
await t.click(browserPage.NavigationPanel.triggeredFunctionsButton);
8280
await t.click(triggersAndFunctionsFunctionsPage.librariesLink);
83-
await t.click(await triggersAndFunctionsLibrariesPage.getLibraryNameSelector(libraryName));
81+
await t.click(triggersAndFunctionsLibrariesPage.getLibraryNameSelector(libraryName));
8482

8583
for (const { name, type } of LIBRARIES_LIST) {
8684
await t.expect(await triggersAndFunctionsLibrariesPage.getFunctionsByName(type, name).exists).ok(`library is not displayed in ${type} section`);
8785
}
8886
});
89-
9087
test('Verify that user can modify code', async t => {
9188
const command = `TFUNCTION LOAD "#!js api_version=1.0 name=${libraryName}\\n redis.registerFunction(\'foo\', ()=>{return \'bar\'});"`;
9289
const commandUpdatedPart1 = `#!js api_version=1.0 name=${libraryName}`;
@@ -96,21 +93,20 @@ test('Verify that user can modify code', async t => {
9693
await browserPage.Cli.sendCommandInCli(command);
9794
await t.click(browserPage.NavigationPanel.triggeredFunctionsButton);
9895
await t.click(triggersAndFunctionsFunctionsPage.librariesLink);
99-
await t.click(await triggersAndFunctionsLibrariesPage.getLibraryNameSelector(libraryName));
96+
await t.click(triggersAndFunctionsLibrariesPage.getLibraryNameSelector(libraryName));
10097
await t.click(triggersAndFunctionsLibrariesPage.editMonacoButton);
10198
await triggersAndFunctionsLibrariesPage.sendTextToMonaco(MonacoEditorInputs.Library, commandUpdatedPart1, commandUpdatedPart2);
10299
await t.click(triggersAndFunctionsLibrariesPage.acceptButton);
103100
await t.expect(
104101
(await triggersAndFunctionsLibrariesPage.getTextFromMonaco())).eql(commandUpdatedPart1 + commandUpdatedPart2), 'code was not updated';
105102

106-
await t.click(await triggersAndFunctionsLibrariesPage.configurationLink);
103+
await t.click(triggersAndFunctionsLibrariesPage.configurationLink);
107104
await t.click(triggersAndFunctionsLibrariesPage.editMonacoButton);
108105
await triggersAndFunctionsLibrariesPage.sendTextToMonaco(MonacoEditorInputs.LibraryConfiguration, configuration);
109106
await t.click(triggersAndFunctionsLibrariesPage.acceptButton);
110107
await t.expect(
111108
(await triggersAndFunctionsLibrariesPage.getTextFromMonaco())).eql(configuration, 'configuration was not added');
112109
});
113-
114110
test('Verify that function details is displayed', async t => {
115111
const command = `TFUNCTION LOAD "#!js api_version=1.0 name=${libraryName}\\n
116112
redis.registerAsyncFunction('${LIBRARIES_LIST[2].name}', function(client){
@@ -119,7 +115,7 @@ test('Verify that function details is displayed', async t => {
119115

120116
await browserPage.Cli.sendCommandInCli(command);
121117
await t.click(browserPage.NavigationPanel.triggeredFunctionsButton);
122-
await t.click(await triggersAndFunctionsFunctionsPage.getFunctionsNameSelector(LIBRARIES_LIST[2].name));
118+
await t.click(triggersAndFunctionsFunctionsPage.getFunctionsNameSelector(LIBRARIES_LIST[2].name));
123119
let fieldsAndValue = await triggersAndFunctionsFunctionsPage.getFieldsAndValuesBySection(FunctionsSections.General);
124120
await t.expect(fieldsAndValue).contains(functionDetails.libraryName, 'library name is not corrected');
125121
await t.expect(fieldsAndValue).contains(functionDetails.isAsync, 'async is not corrected');
@@ -128,14 +124,14 @@ test('Verify that function details is displayed', async t => {
128124
await t.expect(fieldsAndValue).contains(functionDetails.flag, 'flag name is not displayed');
129125
});
130126
test('Verify that library and functions can be deleted', async t => {
131-
132127
const libraryName2 = `${libraryName}2`;
133128
const command1 = `TFUNCTION LOAD "#!js api_version=1.0 name=${libraryName}\\n redis.registerFunction(\'${LIBRARIES_LIST[0].name}\', ()=>{return \'bar\'})"`;
134129
const command2 = `TFUNCTION LOAD "#!js api_version=1.0 name=${libraryName2}\\n redis.registerFunction(\'${LIBRARIES_LIST[1].name}\', ()=>{return \'bar\'})"`;
130+
135131
await browserPage.Cli.sendCommandInCli(command1);
136132
await browserPage.Cli.sendCommandInCli(command2);
137-
await t.click(await browserPage.NavigationPanel.triggeredFunctionsButton);
138-
await t.click(await triggersAndFunctionsFunctionsPage.librariesLink);
133+
await t.click(browserPage.NavigationPanel.triggeredFunctionsButton);
134+
await t.click(triggersAndFunctionsFunctionsPage.librariesLink);
139135
await triggersAndFunctionsLibrariesPage.deleteLibraryByName(libraryName2);
140136
await t.expect(await triggersAndFunctionsLibrariesPage.getLibraryNameSelector(libraryName2).exists).notOk(`the library ${libraryName2} was not deleted`);
141137
await t.click(triggersAndFunctionsLibrariesPage.functionsLink);
@@ -158,7 +154,7 @@ test.after(async() => {
158154
await t.expect(uploadedText.length).gte(1, 'file was not uploaded');
159155
await CommonElementsActions.checkCheckbox(triggersAndFunctionsLibrariesPage.addConfigurationCheckBox, true);
160156
await triggersAndFunctionsLibrariesPage.sendTextToMonaco(MonacoEditorInputs.Configuration, configuration);
161-
await t.click(await triggersAndFunctionsLibrariesPage.addLibrarySubmitButton);
157+
await t.click(triggersAndFunctionsLibrariesPage.addLibrarySubmitButton);
162158
await t.expect(triggersAndFunctionsLibrariesPage.getLibraryNameSelector(libNameFromFile).exists).ok('the library was not added');
163159
await t.expect(triggersAndFunctionsLibrariesPage.getFunctionsByName(LibrariesSections.Functions, functionNameFromFile).exists).ok('the library information was not opened');
164160
});
@@ -169,7 +165,6 @@ test.after(async() => {
169165
})('Verify that user can open a Stream key from function', async t => {
170166
const command1 = `#!js api_version=1.0 name=${libraryName}`;
171167
const command2 = `redis.registerStreamTrigger('${LIBRARIES_LIST[3].name}', 'name', function(){});`;
172-
173168
const streamKeyParameters: StreamKeyParameters = {
174169
keyName: streamKeyName,
175170
entries: [{
@@ -180,6 +175,7 @@ test.after(async() => {
180175
}]
181176
}]
182177
};
178+
183179
await apiKeyRequests.addStreamKeyApi(streamKeyParameters, ossStandaloneRedisGears);
184180
await t.click(browserPage.NavigationPanel.triggeredFunctionsButton);
185181
await t.click(triggersAndFunctionsFunctionsPage.librariesLink);

tests/e2e/tests/web/smoke/browser/json-key.e2e.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,5 @@ test('Verify that user can add key with value to any level of JSON structure', a
4747
await browserPage.addJsonKeyOnTheSameLevel('"key2"', '{}');
4848
await browserPage.addJsonKeyInsideStructure('"key2222"', '12345');
4949
// Check the added key contains json object with added key
50-
await t.click(browserPage.expandJsonObject);
5150
await t.expect(browserPage.jsonKeyValue.textContent).eql('{name:"xyz"key1:"value1"key2:{key2222:12345}}', 'The json object value not found');
5251
});

tests/e2e/web.runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import testcafe from 'testcafe';
3838
selectorTimeout: 5000,
3939
assertionTimeout: 5000,
4040
speed: 1,
41-
// quarantineMode: { successThreshold: 1, attemptLimit: 3 },
41+
quarantineMode: { successThreshold: 1, attemptLimit: 3 },
4242
pageRequestTimeout: 8000,
4343
disableMultipleWindows: true
4444
});

0 commit comments

Comments
 (0)