diff --git a/tests/e2e/pageObjects/settings-page.ts b/tests/e2e/pageObjects/settings-page.ts index f8820b6ff8..7988b7453c 100644 --- a/tests/e2e/pageObjects/settings-page.ts +++ b/tests/e2e/pageObjects/settings-page.ts @@ -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]'); @@ -34,9 +35,9 @@ 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 { await t.hover(this.commandsInPipelineValue); await t.click(this.commandsInPipelineInput); @@ -44,7 +45,24 @@ export class SettingsPage { await t.click(this.applyButton); } - async getAnalyticsValue(): Promise { + /** + * Get state of Analytics switcher + */ + async getAnalyticsSwitcherValue(): Promise { return await this.switchAnalyticsOption.getAttribute('aria-checked'); } + + /** + * Get state of Notifications switcher + */ + async getNotificationsSwitcherValue(): Promise { + return await this.switchNovitifationsOption.getAttribute('aria-checked'); + } + + /** + * Get state of Eula switcher + */ + async getEulaSwitcherValue(): Promise { + return await this.switchEulaOption.getAttribute('aria-checked'); + } } diff --git a/tests/e2e/pageObjects/user-agreement-page.ts b/tests/e2e/pageObjects/user-agreement-page.ts index 43177f6e24..55db0ac0ff 100644 --- a/tests/e2e/pageObjects/user-agreement-page.ts +++ b/tests/e2e/pageObjects/user-agreement-page.ts @@ -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 { - 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 { + 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 { + return await this.recommendedSwitcher.getAttribute('aria-checked'); + } } diff --git a/tests/e2e/tests/critical-path/a-first-start-form/user-agreements-form.e2e.ts b/tests/e2e/tests/critical-path/a-first-start-form/user-agreements-form.e2e.ts index 5bf69d6be5..5684787adc 100644 --- a/tests/e2e/tests/critical-path/a-first-start-form/user-agreements-form.e2e.ts +++ b/tests/e2e/tests/critical-path/a-first-start-form/user-agreements-form.e2e.ts @@ -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'); +}); diff --git a/tests/e2e/tests/critical-path/settings/settings.e2e.ts b/tests/e2e/tests/critical-path/settings/settings.e2e.ts index b6683d65b2..0caa377c2f 100644 --- a/tests/e2e/tests/critical-path/settings/settings.e2e.ts +++ b/tests/e2e/tests/critical-path/settings/settings.e2e.ts @@ -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) @@ -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'); } });