Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions tests/e2e/pageObjects/settings-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class SettingsPage {
switchAnalyticsOption = Selector('[data-testid=switch-option-analytics]');
switchEulaOption = Selector('[data-testid=switch-option-eula]');
submitConsentsPopupButton = Selector('[data-testid=consents-settings-popup] [data-testid=btn-submit]');
switchNovitifationsOption = Selector('[data-testid=switch-option-notifications]');
//TEXT INPUTS (also referred to as 'Text fields')
keysToScanValue = Selector('[data-testid=keys-to-scan-value]');
keysToScanInput = Selector('[data-testid=keys-to-scan-input]');
Expand All @@ -34,17 +35,34 @@ export class SettingsPage {
}

/**
* Change Commands In Pipeline value
* @param value Value for pipeline
*/
* Change Commands In Pipeline value
* @param value Value for pipeline
*/
async changeCommandsInPipeline(value: string): Promise<void> {
await t.hover(this.commandsInPipelineValue);
await t.click(this.commandsInPipelineInput);
await t.typeText(this.commandsInPipelineInput, value, { replace: true });
await t.click(this.applyButton);
}

async getAnalyticsValue(): Promise<string> {
/**
* Get state of Analytics switcher
*/
async getAnalyticsSwitcherValue(): Promise<string> {
return await this.switchAnalyticsOption.getAttribute('aria-checked');
}

/**
* Get state of Notifications switcher
*/
async getNotificationsSwitcherValue(): Promise<string> {
return await this.switchNovitifationsOption.getAttribute('aria-checked');
}

/**
* Get state of Eula switcher
*/
async getEulaSwitcherValue(): Promise<string> {
return await this.switchEulaOption.getAttribute('aria-checked');
}
}
26 changes: 17 additions & 9 deletions tests/e2e/pageObjects/user-agreement-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,22 @@ export class UserAgreementPage {
submitButton = Selector('[data-testid=btn-submit]');
switchOptionEula = Selector('[data-testid=switch-option-eula]');
switchOptionEncryption = Selector('[data-testid=switch-option-encryption]');
pluginSectionWithText = Selector('[data-testid=plugin-section]')
pluginSectionWithText = Selector('[data-testid=plugin-section]');
recommendedSwitcher = Selector('[data-testid=switch-option-recommended]');

//Accept RedisInsight License Terms
async acceptLicenseTerms():Promise<void> {
if (await this.switchOptionEula.exists) {
await t.click(this.switchOptionEula);
await t.click(this.switchOptionEncryption);
await t.click(this.submitButton);
}
}
//Accept RedisInsight License Terms
async acceptLicenseTerms(): Promise<void> {
if (await this.switchOptionEula.exists) {
await t.click(this.switchOptionEula);
await t.click(this.switchOptionEncryption);
await t.click(this.submitButton);
}
}

/**
* Get state of Recommended switcher
*/
async getRecommendedSwitcherValue(): Promise<string> {
return await this.recommendedSwitcher.getAttribute('aria-checked');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,67 @@ const settingsPage = new SettingsPage();
const common = new Common();

fixture `Agreements Verification`
.meta({ type: 'critical_path' })
.meta({ type: 'critical_path', env: env.web, rte: rte.none })
.page(commonUrl)
.requestHooks(common.mock)
.beforeEach(async t => {
await t.maximizeWindow();
});
test
.meta({ env: env.web, rte: rte.none })('Verify that user should accept User Agreements to continue working with the application, the Welcome page is opened after user agrees, the encryption enabled by default and specific message', async t => {
await t.expect(userAgreementPage.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
//Verify that section with plugin warning is displayed
await t.expect(userAgreementPage.pluginSectionWithText.visible).ok('Plugin text is displayed');
//Verify that text that is displayed in window is 'While adding new visualization plugins, use files only from trusted authors to avoid automatic execution of malicious code.'
const pluginText = userAgreementPage.pluginSectionWithText.innerText;
await t.expect(pluginText).eql('To avoid automatic execution of malicious code, when adding new Workbench plugins, use files from trusted authors only.');
// Verify that encryption enabled by default
await t.expect(userAgreementPage.switchOptionEncryption.withAttribute('aria-checked', 'true').exists).ok('Encryption enabled by default');
await t.click(addRedisDatabasePage.addDatabaseButton);
//Verify that I still has agreements popup & cannot add a database
await t.expect(userAgreementPage.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
await t.expect(addRedisDatabasePage.addDatabaseManually.exists).notOk('User can\'t add a database');
//Accept agreements
await t.click(settingsPage.switchEulaOption);
await t.click(settingsPage.submitConsentsPopupButton);
//Verify that I dont have an popup
await t.expect(userAgreementPage.userAgreementsPopup.exists).notOk('User Agreements Popup isn\'t shown after accept agreements');
//Verify that Welcome page is displayed
await t.expect(addRedisDatabasePage.welcomePageTitle.exists).ok('Welcome page is displayed');
//Verify I can work with the application
await t.click(addRedisDatabasePage.addDatabaseButton);
await t.expect(addRedisDatabasePage.addDatabaseManually.exists).ok('User can add a database');
});
test('Verify that user should accept User Agreements to continue working with the application', async t => {
await t.expect(userAgreementPage.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
await t.click(addRedisDatabasePage.addDatabaseButton);
//Verify that I still has agreements popup & cannot add a database
await t.expect(userAgreementPage.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
await t.expect(addRedisDatabasePage.addDatabaseManually.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.';
//Verify that section with plugin warning is displayed
await t.expect(userAgreementPage.pluginSectionWithText.visible).ok('Plugin text is displayed');
//Verify that text that is displayed in window is 'While adding new visualization plugins, use files only from trusted authors to avoid automatic execution of malicious code.'
const pluginText = userAgreementPage.pluginSectionWithText.innerText;
await t.expect(pluginText).eql(expectedPluginText, 'Plugin text is incorrect');
// Verify that encryption enabled by default
await t.expect(userAgreementPage.switchOptionEncryption.withAttribute('aria-checked', 'true').exists).ok('Encryption enabled by default');
});
test('Verify that the Welcome page is opened after user agrees', async t => {
//Accept agreements
await t.click(settingsPage.switchEulaOption);
await t.click(settingsPage.submitConsentsPopupButton);
//Verify that I dont have an popup
await t.expect(userAgreementPage.userAgreementsPopup.exists).notOk('User Agreements Popup isn\'t shown after accept agreements');
//Verify that Welcome page is displayed after user agrees
await t.expect(addRedisDatabasePage.welcomePageTitle.exists).ok('Welcome page is displayed');
//Verify I can work with the application
await t.click(addRedisDatabasePage.addDatabaseButton);
await t.expect(addRedisDatabasePage.addDatabaseManually.exists).ok('User can add a database');
});
test('Verify that when user checks "Use recommended settings" option on EULA screen, all options (except Licence Terms) are checked', async t => {
// Verify options unchecked before enabling Use recommended settings
await t.expect(await settingsPage.getAnalyticsSwitcherValue()).eql('false', 'Enable Analytics switcher is checked');
await t.expect(await settingsPage.getNotificationsSwitcherValue()).eql('false', 'Enable Notifications switcher is checked');
// Check Use recommended settings switcher
await t.click(userAgreementPage.recommendedSwitcher);
// Verify options checked after enabling Use recommended settings
await t.expect(await settingsPage.getAnalyticsSwitcherValue()).eql('true', 'Enable Analytics switcher is unchecked');
await t.expect(await settingsPage.getNotificationsSwitcherValue()).eql('true', 'Enable Notifications switcher is unchecked');
await t.expect(await settingsPage.getEulaSwitcherValue()).eql('false', 'EULA switcher is checked');
// Uncheck Use recommended settings switcher
await t.click(userAgreementPage.recommendedSwitcher);
// Verify that when user unchecks "Use recommended settings" option on EULA screen, previous state of checkboxes for the options is applied
await t.expect(await settingsPage.getAnalyticsSwitcherValue()).eql('false', 'Enable Analytics switcher is checked');
await t.expect(await settingsPage.getNotificationsSwitcherValue()).eql('false', 'Enable Notifications switcher is checked');
await t.expect(await settingsPage.getEulaSwitcherValue()).eql('false', 'EULA switcher is checked');
});
test('Verify that if "Use recommended settings" is selected, and user unchecks any of the option, "Use recommended settings" is unchecked', async t => {
// Check Use recommended settings switcher
await t.click(userAgreementPage.recommendedSwitcher);
// Verify Use recommended settings switcher unchecked after unchecking analytics switcher
await t.click(settingsPage.switchAnalyticsOption);
await t.expect(await userAgreementPage.getRecommendedSwitcherValue()).eql('false', 'Use recommended settings switcher is still checked');
// Check Use recommended settings switcher
await t.click(userAgreementPage.recommendedSwitcher);
// Verify Use recommended settings switcher unchecked after unchecking notifications switcher
await t.click(settingsPage.switchNovitifationsOption);
await t.expect(await userAgreementPage.getRecommendedSwitcherValue()).eql('false', 'Use recommended settings switcher is still checked');
});
4 changes: 2 additions & 2 deletions tests/e2e/tests/critical-path/settings/settings.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test
await t.click(myRedisDatabasePage.settingsButton);
await t.click(settingsPage.accordionPrivacySettings);

const currentValue = await settingsPage.getAnalyticsValue();
const currentValue = await settingsPage.getAnalyticsSwitcherValue();
//We sort the values so as not to be tied to the current setting
const equalValues = ['true', 'false'].sort((_, b) => b === currentValue ? -1 : 0)

Expand All @@ -51,6 +51,6 @@ test
// Reload Page
await t.eval(() => location.reload());
await t.click(settingsPage.accordionPrivacySettings);
await t.expect(await settingsPage.getAnalyticsValue()).eql(value, 'Analytics was switched properly');
await t.expect(await settingsPage.getAnalyticsSwitcherValue()).eql(value, 'Analytics was switched properly');
}
});