Skip to content
30 changes: 12 additions & 18 deletions tests/e2e/pageObjects/dialogs/add-redis-database-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,18 @@ export class AddRedisDatabaseDialog {
// BUTTONS
addDatabaseButton = Selector('[data-testid^=add-redis-database]');
addRedisDatabaseButton = Selector('[data-testid=btn-submit]');
addDatabaseManually = Selector('[data-testid=add-database_tab_manual]');
customSettingsButton = Selector('[data-testid=btn-connection-settings]');
addAutoDiscoverDatabase = Selector('[data-testid=add-database_tab_software]');
addCloudDatabaseTab = Selector('[data-testid=add-database_tab_cloud]');
redisClusterType = Selector('[data-test-subj=radio-btn-enterprise-cluster]');
redisCloudProType = Selector('[data-test-subj=radio-btn-cloud-pro]');
redisSentinelType = Selector('[data-test-subj=radio-btn-sentinel]');
addCloudDatabaseButton = Selector('[data-testid=create-free-db-btn]');
redisSotfwareButton = Selector('[data-testid=option-btn-software]');
redisSentinelButton = Selector('[data-testid=option-btn-sentinel]');
showDatabasesButton = Selector('[data-testid=btn-show-databases]');
databaseName = Selector('.euiTableCellContent.column_name');
selectAllCheckbox = Selector('[data-test-subj=checkboxSelectAll]');
databaseIndexCheckbox = Selector('[data-testid=showDb]~div', { timeout: 500 });
connectToDatabaseButton = Selector('[data-testid=connect-to-db-btn]');
connectToRedisStackButton = Selector('[aria-label="Connect to database"]');
cloneDatabaseButton = Selector('[data-testid=clone-db-btn]');
sentinelNavigation = Selector('[data-testid=sentinel-nav-group]');
sentinelDatabaseNavigation = Selector('[data-testid=database-nav-group]');
cancelButton = Selector('[data-testid=btn-cancel]');
showPasswordBtn = Selector('[aria-label^="Show password"]');
testConnectionBtn = Selector('[data-testid=btn-test-connection]');

// TEXT INPUTS (also referred to as 'Text fields')
Expand All @@ -55,6 +50,7 @@ export class AddRedisDatabaseDialog {
sshPrivateKeyInput = Selector('[data-testid=sshPrivateKey]');
sshPassphraseInput = Selector('[data-testid=sshPassphrase]');
timeoutInput = Selector('[data-testid=timeout]');
urlInput = Selector('[data-testid=connection-url]');
// DROPDOWNS
caCertField = Selector('[data-testid=select-ca-cert]', { timeout: 500 });
clientCertField = Selector('[data-testid=select-cert]', { timeout: 500 });
Expand Down Expand Up @@ -84,7 +80,7 @@ export class AddRedisDatabaseDialog {
await this.addDatabaseButton.with({ visibilityCheck: true, timeout: 10000 })();
await t
.click(this.addDatabaseButton)
.click(this.addDatabaseManually);
.click(this.customSettingsButton);

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

await t
.click(this.addDatabaseButton)
.click(this.addDatabaseManually);
.click(this.customSettingsButton);

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

await t
.click(this.addDatabaseButton)
.click(this.addDatabaseManually);
.click(this.customSettingsButton);

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

await t
.click(this.addDatabaseButton)
.click(this.addAutoDiscoverDatabase);

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

await t
.click(this.addDatabaseButton)
.click(this.addAutoDiscoverDatabase);

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

await t
.click(this.addDatabaseButton)
.click(this.addCloudDatabaseTab);
.click(this.addCloudDatabaseButton);

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

await t
.click(this.addDatabaseButton)
.click(this.addDatabaseManually);
.click(this.customSettingsButton);

if (!!parameters.ossClusterHost) {
await t.typeText(this.hostInput, parameters.ossClusterHost, { replace: true, paste: true });
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/pageObjects/my-redis-databases-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class MyRedisDatabasePage extends BaseOverviewPage {
sortByDatabaseAlias = Selector('span').withAttribute('title', 'Database Alias');
sortByHostAndPort = Selector('span').withAttribute('title', 'Host:Port');
sortByConnectionType = Selector('span').withAttribute('title', 'Connection Type');
importDatabasesBtn = Selector('[data-testid=add-database_tab_import]');
importDatabasesBtn = Selector('[data-testid=option-btn-import]');
retryImportBtn = Selector('[data-testid=btn-retry]');
submitImportBtn = Selector('[data-testid=submit-btn]');
removeImportedFileBtn = Selector('[aria-label="Clear selected files"]');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('Verify that user should accept User Agreements to continue working with th
await t.expect(userAgreementDialog.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
// Verify that I still has agreements popup & cannot add a database
await t.expect(userAgreementDialog.submitButton.hasAttribute('disabled')).ok('Submit button not disabled by default');
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually.exists).notOk('User can\'t add a database');
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton.exists).notOk('User can\'t add a database');
});
test('Verify that the encryption enabled by default and specific message', async t => {
const expectedPluginText = 'To avoid automatic execution of malicious code, when adding new Workbench plugins, use files from trusted authors only.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test('Adding database with SSH', async t => {
// 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
await t
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton)
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually)
.click(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton)
.click(myRedisDatabasePage.AddRedisDatabaseDialog.useSSHCheckbox)
.click(myRedisDatabasePage.AddRedisDatabaseDialog.sshPrivateKeyRadioBtn)
.hover(myRedisDatabasePage.AddRedisDatabaseDialog.addRedisDatabaseButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test('Verify that user can see SSO feature if it is enabled in feature config',
// await t.click(myRedisDatabasePage.Modal.closeModalButton);

await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton);
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addCloudDatabaseTab);
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addCloudDatabaseButton);
// Verify that RE Cloud auto-discovery options Use Cloud Account and Use Cloud API Keys are displayed on Welcome screen
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.useCloudAccount.exists).ok('Use Cloud Account accordion not displayed when SSO feature enabled');
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.useCloudKeys.exists).ok('Use Cloud Keys accordion not displayed when SSO feature enabled');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('Verify that user should accept User Agreements to continue working with th
await t.expect(userAgreementDialog.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
// Verify that I still has agreements popup & cannot add a database
await t.expect(userAgreementDialog.submitButton.hasAttribute('disabled')).ok('Submit button not disabled by default');
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually.exists).notOk('User can\'t add a database');
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton.exists).notOk('User can\'t add a database');
});
test('Verify that the encryption enabled by default and specific message', async t => {
const expectedPluginText = 'To avoid automatic execution of malicious code, when adding new Workbench plugins, use files from trusted authors only.';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
import { rte } from '../../../../helpers/constants';
import { BrowserPage, MyRedisDatabasePage } from '../../../../pageObjects';
import { commonUrl, invalidOssStandaloneConfig, ossClusterForSSHConfig, ossStandaloneForSSHConfig } from '../../../../helpers/conf';
import {
commonUrl,
invalidOssStandaloneConfig,
ossClusterForSSHConfig,
ossStandaloneForSSHConfig,
ossStandaloneRedisGears,
} from '../../../../helpers/conf';
import { DatabaseHelper } from '../../../../helpers/database';
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
import { sshPrivateKey, sshPrivateKeyWithPasscode } from '../../../../test-data/sshPrivateKeys';
import { Common } from '../../../../helpers/common';
import { BrowserActions } from '../../../../common-actions/browser-actions';
import { goBackHistory } from '../../../../helpers/utils';
import { AddRedisDatabaseDialog } from '../../../../pageObjects/dialogs';

const myRedisDatabasePage = new MyRedisDatabasePage();
const browserPage = new BrowserPage();
const databaseHelper = new DatabaseHelper();
const databaseAPIRequests = new DatabaseAPIRequests();
const browserActions = new BrowserActions();
const addDbDialog = new AddRedisDatabaseDialog();

const { host, port, databaseName, databaseUsername = '', databasePassword = '' } = ossStandaloneRedisGears;
const username = 'alice&&';
const password = 'p1pp0@&';

const sshParams = {
sshHost: '172.31.100.245',
Expand Down Expand Up @@ -68,7 +80,7 @@ test

await t
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton)
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually);
.click(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton);

// Verify that the Host, Port, Database Alias values pre-populated by default for the manual flow
await t
Expand All @@ -78,7 +90,7 @@ test
// Verify that the Host, Port, Database Alias values pre-populated by default for Sentinel
await t
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addAutoDiscoverDatabase)
.click(myRedisDatabasePage.AddRedisDatabaseDialog.redisSentinelType);
.click(myRedisDatabasePage.AddRedisDatabaseDialog.redisSentinelButton);
await t
.expect(myRedisDatabasePage.AddRedisDatabaseDialog.hostInput.value).eql(defaultHost, 'Default sentinel host not prepopulated')
.expect(myRedisDatabasePage.AddRedisDatabaseDialog.portInput.value).eql(defaultSentinelPort, 'Default sentinel port not prepopulated');
Expand Down Expand Up @@ -113,7 +125,7 @@ test

await t
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton)
.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually);
.click(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton);

await t
.click(myRedisDatabasePage.AddRedisDatabaseDialog.useSSHCheckbox)
Expand Down Expand Up @@ -206,3 +218,31 @@ test
await Common.checkURL(externalPageLinkNavigation);
await goBackHistory();
});
test
.meta({ rte: rte.none })
.before(async t => {
await databaseHelper.acceptLicenseTermsAndAddDatabaseApi(ossStandaloneRedisGears);
await browserPage.Cli.sendCommandInCli(`acl DELUSER ${username}`);
await browserPage.Cli.sendCommandInCli(`ACL SETUSER ${username} on >${password} +@all ~*`);
await t.click(browserPage.NavigationPanel.myRedisDBButton);
})
.after(async t => {
// Delete all existing connections
await t.click(addDbDialog.cancelButton);
await t.click(myRedisDatabasePage.NavigationPanel.myRedisDBButton);
await myRedisDatabasePage.clickOnDBByName(databaseName);
await browserPage.Cli.sendCommandInCli(`acl DELUSER ${username}`);
await databaseAPIRequests.deleteAllDatabasesApi();
})
('Verify that inserted URL is parsed', async t => {
const codedUrl = `redis://${username}:${password}@${host}:${port}`;
await t
.click(addDbDialog.addDatabaseButton);
await t.typeText(addDbDialog.urlInput, codedUrl);
await t.click(addDbDialog.customSettingsButton);
await t.expect(addDbDialog.databaseAliasInput.getAttribute('value')).eql(`${host}:${port}`, 'name is incorrected');
await t.expect(addDbDialog.hostInput.getAttribute('value')).eql(`${host}`, 'host is incorrected');
await t.expect(addDbDialog.portInput.getAttribute('value')).eql(`${port}`, 'port is incorrected');
await t.expect(addDbDialog.usernameInput.getAttribute('value')).eql(`${username}`, 'username is incorrected');
await t.expect(addDbDialog.passwordInput.getAttribute('value')).eql(`${password}`, 'username is incorrected');
});
2 changes: 1 addition & 1 deletion tests/e2e/tests/web/regression/database/cloud-sso.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test('Verify that user can not see the promo Cloud databases for docker build',
await t.click(
myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton);
await t.click(
myRedisDatabasePage.AddRedisDatabaseDialog.addCloudDatabaseTab);
myRedisDatabasePage.AddRedisDatabaseDialog.addCloudDatabaseButton);
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.useCloudAccount.exists).notOk('Use Cloud Account accordion displayed for docker build');
await t.expect(myRedisDatabasePage.AddRedisDatabaseDialog.useCloudKeys.exists).notOk('Use Cloud Keys accordion displayed for docker build');
});
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseButton);
// Verify that telemetry event 'CONFIG_DATABASES_CLICKED' sent and has all expected properties
await telemetry.verifyEventHasProperties(telemetryEvents[1], clickButtonExpectedProperties, logger);
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.addDatabaseManually);
await t.click(myRedisDatabasePage.AddRedisDatabaseDialog.customSettingsButton);
await t
.typeText(myRedisDatabasePage.AddRedisDatabaseDialog.hostInput, ossStandaloneConfig.host, { replace: true, paste: true })
.typeText(myRedisDatabasePage.AddRedisDatabaseDialog.portInput, ossStandaloneConfig.port, { replace: true, paste: true })
Expand Down
Loading