Skip to content

Commit 6ac5361

Browse files
Merge pull request #4190 from RedisInsight/e2e/feature/RI-6265_update-list-of-databases
E2e/feature/ri 6265 update list of databases
2 parents 71f2951 + d56a728 commit 6ac5361

File tree

9 files changed

+63
-29
lines changed

9 files changed

+63
-29
lines changed

tests/e2e/pageObjects/dialogs/add-redis-database-dialog.ts

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,18 @@ export class AddRedisDatabaseDialog {
1414
// BUTTONS
1515
addDatabaseButton = Selector('[data-testid^=add-redis-database]');
1616
addRedisDatabaseButton = Selector('[data-testid=btn-submit]');
17-
addDatabaseManually = Selector('[data-testid=add-database_tab_manual]');
17+
customSettingsButton = Selector('[data-testid=btn-connection-settings]');
1818
addAutoDiscoverDatabase = Selector('[data-testid=add-database_tab_software]');
19-
addCloudDatabaseTab = Selector('[data-testid=add-database_tab_cloud]');
20-
redisClusterType = Selector('[data-test-subj=radio-btn-enterprise-cluster]');
21-
redisCloudProType = Selector('[data-test-subj=radio-btn-cloud-pro]');
22-
redisSentinelType = Selector('[data-test-subj=radio-btn-sentinel]');
19+
addCloudDatabaseButton = Selector('[data-testid=create-free-db-btn]');
20+
redisSotfwareButton = Selector('[data-testid=option-btn-software]');
21+
redisSentinelButton = Selector('[data-testid=option-btn-sentinel]');
2322
showDatabasesButton = Selector('[data-testid=btn-show-databases]');
2423
databaseName = Selector('.euiTableCellContent.column_name');
2524
selectAllCheckbox = Selector('[data-test-subj=checkboxSelectAll]');
2625
databaseIndexCheckbox = Selector('[data-testid=showDb]~div', { timeout: 500 });
27-
connectToDatabaseButton = Selector('[data-testid=connect-to-db-btn]');
2826
connectToRedisStackButton = Selector('[aria-label="Connect to database"]');
2927
cloneDatabaseButton = Selector('[data-testid=clone-db-btn]');
30-
sentinelNavigation = Selector('[data-testid=sentinel-nav-group]');
31-
sentinelDatabaseNavigation = Selector('[data-testid=database-nav-group]');
3228
cancelButton = Selector('[data-testid=btn-cancel]');
33-
showPasswordBtn = Selector('[aria-label^="Show password"]');
3429
testConnectionBtn = Selector('[data-testid=btn-test-connection]');
3530

3631
// TEXT INPUTS (also referred to as 'Text fields')
@@ -55,6 +50,7 @@ export class AddRedisDatabaseDialog {
5550
sshPrivateKeyInput = Selector('[data-testid=sshPrivateKey]');
5651
sshPassphraseInput = Selector('[data-testid=sshPassphrase]');
5752
timeoutInput = Selector('[data-testid=timeout]');
53+
urlInput = Selector('[data-testid=connection-url]');
5854
// DROPDOWNS
5955
caCertField = Selector('[data-testid=select-ca-cert]', { timeout: 500 });
6056
clientCertField = Selector('[data-testid=select-cert]', { timeout: 500 });
@@ -84,7 +80,7 @@ export class AddRedisDatabaseDialog {
8480
await this.addDatabaseButton.with({ visibilityCheck: true, timeout: 10000 })();
8581
await t
8682
.click(this.addDatabaseButton)
87-
.click(this.addDatabaseManually);
83+
.click(this.customSettingsButton);
8884

8985
await t
9086
.typeText(this.hostInput, parameters.host, { replace: true, paste: true })
@@ -107,7 +103,7 @@ export class AddRedisDatabaseDialog {
107103

108104
await t
109105
.click(this.addDatabaseButton)
110-
.click(this.addDatabaseManually);
106+
.click(this.customSettingsButton);
111107

112108
await t
113109
.typeText(this.hostInput, parameters.host, { replace: true, paste: true })
@@ -135,7 +131,7 @@ export class AddRedisDatabaseDialog {
135131

136132
await t
137133
.click(this.addDatabaseButton)
138-
.click(this.addDatabaseManually);
134+
.click(this.customSettingsButton);
139135

140136
await t
141137
.typeText(this.hostInput, databaseParameters.host, { replace: true, paste: true })
@@ -180,9 +176,8 @@ export class AddRedisDatabaseDialog {
180176

181177
await t
182178
.click(this.addDatabaseButton)
183-
.click(this.addAutoDiscoverDatabase);
184179

185-
await t.click(this.redisSentinelType);
180+
await t.click(this.redisSentinelButton);
186181
if (!!parameters.sentinelHost) {
187182
await t.typeText(this.hostInput, parameters.sentinelHost, { replace: true, paste: true });
188183
}
@@ -202,9 +197,8 @@ export class AddRedisDatabaseDialog {
202197

203198
await t
204199
.click(this.addDatabaseButton)
205-
.click(this.addAutoDiscoverDatabase);
206200

207-
await t.click(this.redisClusterType);
201+
await t.click(this.redisSotfwareButton);
208202
await t
209203
.typeText(this.hostInput, parameters.host, { replace: true, paste: true })
210204
.typeText(this.portInput, parameters.port, { replace: true, paste: true })
@@ -220,7 +214,7 @@ export class AddRedisDatabaseDialog {
220214

221215
await t
222216
.click(this.addDatabaseButton)
223-
.click(this.addCloudDatabaseTab);
217+
.click(this.addCloudDatabaseButton);
224218

225219
await t
226220
.typeText(this.accessKeyInput, cloudAPIAccessKey, { replace: true, paste: true })
@@ -235,7 +229,7 @@ export class AddRedisDatabaseDialog {
235229

236230
await t
237231
.click(this.addDatabaseButton)
238-
.click(this.addDatabaseManually);
232+
.click(this.customSettingsButton);
239233

240234
if (!!parameters.ossClusterHost) {
241235
await t.typeText(this.hostInput, parameters.ossClusterHost, { replace: true, paste: true });

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class MyRedisDatabasePage extends BaseOverviewPage {
3838
sortByDatabaseAlias = Selector('span').withAttribute('title', 'Database Alias');
3939
sortByHostAndPort = Selector('span').withAttribute('title', 'Host:Port');
4040
sortByConnectionType = Selector('span').withAttribute('title', 'Connection Type');
41-
importDatabasesBtn = Selector('[data-testid=add-database_tab_import]');
41+
importDatabasesBtn = Selector('[data-testid=option-btn-import]');
4242
retryImportBtn = Selector('[data-testid=btn-retry]');
4343
submitImportBtn = Selector('[data-testid=submit-btn]');
4444
removeImportedFileBtn = Selector('[aria-label="Clear selected files"]');

tests/e2e/tests/electron/critical-path/a-first-start-form/user-agreements-form.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test('Verify that user should accept User Agreements to continue working with th
1515
await t.expect(userAgreementDialog.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
1616
// Verify that I still has agreements popup & cannot add a database
1717
await t.expect(userAgreementDialog.submitButton.hasAttribute('disabled')).ok('Submit button not disabled by default');
18-
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually.exists).notOk('User can\'t add a database');
18+
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton.exists).notOk('User can\'t add a database');
1919
});
2020
test('Verify that the encryption enabled by default and specific message', async t => {
2121
const expectedPluginText = 'To avoid automatic execution of malicious code, when adding new Workbench plugins, use files from trusted authors only.';

tests/e2e/tests/electron/critical-path/database/add-ssh-db.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ test('Adding database with SSH', async t => {
7171
// Verify that if user have not entered any required value he can see that this field should be specified when hover over the button to add a database
7272
await t
7373
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton)
74-
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually)
74+
.click(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton)
7575
.click(myRedisDatabasePage.AddRedisDatabaseDialog.useSSHCheckbox)
7676
.click(myRedisDatabasePage.AddRedisDatabaseDialog.sshPrivateKeyRadioBtn)
7777
.hover(myRedisDatabasePage.AddRedisDatabaseDialog.addRedisDatabaseButton);

tests/e2e/tests/electron/regression/database/cloud-sso.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test('Verify that user can see SSO feature if it is enabled in feature config',
4949
// await t.click(myRedisDatabasePage.Modal.closeModalButton);
5050

5151
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton);
52-
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addCloudDatabaseTab);
52+
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addCloudDatabaseButton);
5353
// Verify that RE Cloud auto-discovery options Use Cloud Account and Use Cloud API Keys are displayed on Welcome screen
5454
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.useCloudAccount.exists).ok('Use Cloud Account accordion not displayed when SSO feature enabled');
5555
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.useCloudKeys.exists).ok('Use Cloud Keys accordion not displayed when SSO feature enabled');

tests/e2e/tests/web/critical-path/a-first-start-form/user-agreements-form.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test('Verify that user should accept User Agreements to continue working with th
1919
await t.expect(userAgreementDialog.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
2020
// Verify that I still has agreements popup & cannot add a database
2121
await t.expect(userAgreementDialog.submitButton.hasAttribute('disabled')).ok('Submit button not disabled by default');
22-
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually.exists).notOk('User can\'t add a database');
22+
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton.exists).notOk('User can\'t add a database');
2323
});
2424
test('Verify that the encryption enabled by default and specific message', async t => {
2525
const expectedPluginText = 'To avoid automatic execution of malicious code, when adding new Workbench plugins, use files from trusted authors only.';

tests/e2e/tests/web/critical-path/database/connecting-to-the-db.e2e.ts

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
import { rte } from '../../../../helpers/constants';
22
import { BrowserPage, MyRedisDatabasePage } from '../../../../pageObjects';
3-
import { commonUrl, invalidOssStandaloneConfig, ossClusterForSSHConfig, ossStandaloneForSSHConfig } from '../../../../helpers/conf';
3+
import {
4+
commonUrl,
5+
invalidOssStandaloneConfig,
6+
ossClusterForSSHConfig,
7+
ossStandaloneForSSHConfig,
8+
ossStandaloneRedisGears,
9+
} from '../../../../helpers/conf';
410
import { DatabaseHelper } from '../../../../helpers/database';
511
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
612
import { sshPrivateKey, sshPrivateKeyWithPasscode } from '../../../../test-data/sshPrivateKeys';
713
import { Common } from '../../../../helpers/common';
814
import { BrowserActions } from '../../../../common-actions/browser-actions';
915
import { goBackHistory } from '../../../../helpers/utils';
16+
import { AddRedisDatabaseDialog } from '../../../../pageObjects/dialogs';
1017

1118
const myRedisDatabasePage = new MyRedisDatabasePage();
1219
const browserPage = new BrowserPage();
1320
const databaseHelper = new DatabaseHelper();
1421
const databaseAPIRequests = new DatabaseAPIRequests();
1522
const browserActions = new BrowserActions();
23+
const addDbDialog = new AddRedisDatabaseDialog();
24+
25+
const { host, port, databaseName, databaseUsername = '', databasePassword = '' } = ossStandaloneRedisGears;
26+
const username = 'alice&&';
27+
const password = 'p1pp0@&';
1628

1729
const sshParams = {
1830
sshHost: '172.31.100.245',
@@ -68,7 +80,7 @@ test
6880

6981
await t
7082
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton)
71-
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually);
83+
.click(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton);
7284

7385
// Verify that the Host, Port, Database Alias values pre-populated by default for the manual flow
7486
await t
@@ -78,7 +90,7 @@ test
7890
// Verify that the Host, Port, Database Alias values pre-populated by default for Sentinel
7991
await t
8092
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addAutoDiscoverDatabase)
81-
.click(myRedisDatabasePage.AddRedisDatabaseDialog.redisSentinelType);
93+
.click(myRedisDatabasePage.AddRedisDatabaseDialog.redisSentinelButton);
8294
await t
8395
.expect(myRedisDatabasePage.AddRedisDatabaseDialog.hostInput.value).eql(defaultHost, 'Default sentinel host not prepopulated')
8496
.expect(myRedisDatabasePage.AddRedisDatabaseDialog.portInput.value).eql(defaultSentinelPort, 'Default sentinel port not prepopulated');
@@ -113,7 +125,7 @@ test
113125

114126
await t
115127
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton)
116-
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually);
128+
.click(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton);
117129

118130
await t
119131
.click(myRedisDatabasePage.AddRedisDatabaseDialog.useSSHCheckbox)
@@ -206,3 +218,31 @@ test
206218
await Common.checkURL(externalPageLinkNavigation);
207219
await goBackHistory();
208220
});
221+
test
222+
.meta({ rte: rte.none })
223+
.before(async t => {
224+
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneRedisGears);
225+
await browserPage.Cli.sendCommandInCli(`acl DELUSER ${username}`);
226+
await browserPage.Cli.sendCommandInCli(`ACL SETUSER ${username} on >${password} +@all ~*`);
227+
await t.click(browserPage.NavigationPanel.myRedisDBButton);
228+
})
229+
.after(async t => {
230+
// Delete all existing connections
231+
await t.click(addDbDialog.cancelButton);
232+
await t.click(myRedisDatabasePage.NavigationPanel.myRedisDBButton);
233+
await myRedisDatabasePage.clickOnDBByName(databaseName);
234+
await browserPage.Cli.sendCommandInCli(`acl DELUSER ${username}`);
235+
await databaseAPIRequests.deleteAllDatabasesApi();
236+
})
237+
('Verify that inserted URL is parsed', async t => {
238+
const codedUrl = `redis://${username}:${password}@${host}:${port}`;
239+
await t
240+
.click(addDbDialog.addDatabaseButton);
241+
await t.typeText(addDbDialog.urlInput, codedUrl);
242+
await t.click(addDbDialog.customSettingsButton);
243+
await t.expect(addDbDialog.databaseAliasInput.getAttribute('value')).eql(`${host}:${port}`, 'name is incorrected');
244+
await t.expect(addDbDialog.hostInput.getAttribute('value')).eql(`${host}`, 'host is incorrected');
245+
await t.expect(addDbDialog.portInput.getAttribute('value')).eql(`${port}`, 'port is incorrected');
246+
await t.expect(addDbDialog.usernameInput.getAttribute('value')).eql(`${username}`, 'username is incorrected');
247+
await t.expect(addDbDialog.passwordInput.getAttribute('value')).eql(`${password}`, 'username is incorrected');
248+
});

tests/e2e/tests/web/regression/database/cloud-sso.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test('Verify that user can not see the promo Cloud databases for docker build',
4040
await t.click(
4141
myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton);
4242
await t.click(
43-
myRedisDatabasePage.AddRedisDatabaseDialog.addCloudDatabaseTab);
43+
myRedisDatabasePage.AddRedisDatabaseDialog.addCloudDatabaseButton);
4444
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.useCloudAccount.exists).notOk('Use Cloud Account accordion displayed for docker build');
4545
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.useCloudKeys.exists).notOk('Use Cloud Keys accordion displayed for docker build');
4646
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test
5454
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton);
5555
// Verify that telemetry event 'CONFIG_DATABASES_CLICKED' sent and has all expected properties
5656
await telemetry.verifyEventHasProperties(telemetryEvents[1], clickButtonExpectedProperties, logger);
57-
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually);
57+
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton);
5858
await t
5959
.typeText(myRedisDatabasePage.AddRedisDatabaseDialog.hostInput, ossStandaloneConfig.host, { replace: true, paste: true })
6060
.typeText(myRedisDatabasePage.AddRedisDatabaseDialog.portInput, ossStandaloneConfig.port, { replace: true, paste: true })

0 commit comments

Comments
 (0)