Skip to content

Commit c375441

Browse files
committed
add tests for improve eula screen feature
1 parent cc1e0be commit c375441

File tree

4 files changed

+72
-30
lines changed

4 files changed

+72
-30
lines changed

tests/e2e/pageObjects/settings-page.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export class SettingsPage {
1515
switchAnalyticsOption = Selector('[data-testid=switch-option-analytics]');
1616
switchEulaOption = Selector('[data-testid=switch-option-eula]');
1717
submitConsentsPopupButton = Selector('[data-testid=consents-settings-popup] [data-testid=btn-submit]');
18+
switchNovitifationsOption = Selector('[data-testid=switch-option-notifications]');
1819
//TEXT INPUTS (also referred to as 'Text fields')
1920
keysToScanValue = Selector('[data-testid=keys-to-scan-value]');
2021
keysToScanInput = Selector('[data-testid=keys-to-scan-input]');
@@ -44,7 +45,15 @@ export class SettingsPage {
4445
await t.click(this.applyButton);
4546
}
4647

47-
async getAnalyticsValue(): Promise<string> {
48+
async getAnalyticsSwitcherValue(): Promise<string> {
4849
return await this.switchAnalyticsOption.getAttribute('aria-checked');
4950
}
51+
52+
async getNotificationsSwitcherValue(): Promise<string> {
53+
return await this.switchNovitifationsOption.getAttribute('aria-checked');
54+
}
55+
56+
async getEulaSwitcherValue(): Promise<string> {
57+
return await this.switchEulaOption.getAttribute('aria-checked');
58+
}
5059
}

tests/e2e/pageObjects/user-agreement-page.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ export class UserAgreementPage {
1313
submitButton = Selector('[data-testid=btn-submit]');
1414
switchOptionEula = Selector('[data-testid=switch-option-eula]');
1515
switchOptionEncryption = Selector('[data-testid=switch-option-encryption]');
16-
pluginSectionWithText = Selector('[data-testid=plugin-section]')
16+
pluginSectionWithText = Selector('[data-testid=plugin-section]');
17+
recommendedSwitcher = Selector('[data-testid=switch-option-recommended]');
1718

1819
//Accept RedisInsight License Terms
1920
async acceptLicenseTerms():Promise<void> {
@@ -23,4 +24,8 @@ export class UserAgreementPage {
2324
await t.click(this.submitButton);
2425
}
2526
}
27+
28+
async getRecommendedSwitcherValue(): Promise<string> {
29+
return await this.recommendedSwitcher.getAttribute('aria-checked');
30+
}
2631
}

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

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,62 @@ const settingsPage = new SettingsPage();
99
const common = new Common();
1010

1111
fixture `Agreements Verification`
12-
.meta({ type: 'critical_path' })
12+
.meta({ type: 'critical_path', env: env.web, rte: rte.none })
1313
.page(commonUrl)
1414
.requestHooks(common.mock)
1515
.beforeEach(async t => {
1616
await t.maximizeWindow();
1717
});
18-
test
19-
.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 => {
20-
await t.expect(userAgreementPage.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
21-
//Verify that section with plugin warning is displayed
22-
await t.expect(userAgreementPage.pluginSectionWithText.visible).ok('Plugin text is displayed');
23-
//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.'
24-
const pluginText = userAgreementPage.pluginSectionWithText.innerText;
25-
await t.expect(pluginText).eql('To avoid automatic execution of malicious code, when adding new Workbench plugins, use files from trusted authors only.');
26-
// Verify that encryption enabled by default
27-
await t.expect(userAgreementPage.switchOptionEncryption.withAttribute('aria-checked', 'true').exists).ok('Encryption enabled by default');
28-
await t.click(addRedisDatabasePage.addDatabaseButton);
29-
//Verify that I still has agreements popup & cannot add a database
30-
await t.expect(userAgreementPage.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
31-
await t.expect(addRedisDatabasePage.addDatabaseManually.exists).notOk('User can\'t add a database');
32-
//Accept agreements
33-
await t.click(settingsPage.switchEulaOption);
34-
await t.click(settingsPage.submitConsentsPopupButton);
35-
//Verify that I dont have an popup
36-
await t.expect(userAgreementPage.userAgreementsPopup.exists).notOk('User Agreements Popup isn\'t shown after accept agreements');
37-
//Verify that Welcome page is displayed
38-
await t.expect(addRedisDatabasePage.welcomePageTitle.exists).ok('Welcome page is displayed');
39-
//Verify I can work with the application
40-
await t.click(addRedisDatabasePage.addDatabaseButton);
41-
await t.expect(addRedisDatabasePage.addDatabaseManually.exists).ok('User can add a database');
42-
});
18+
test('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 => {
19+
await t.expect(userAgreementPage.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
20+
//Verify that section with plugin warning is displayed
21+
await t.expect(userAgreementPage.pluginSectionWithText.visible).ok('Plugin text is displayed');
22+
//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.'
23+
const pluginText = userAgreementPage.pluginSectionWithText.innerText;
24+
await t.expect(pluginText).eql('To avoid automatic execution of malicious code, when adding new Workbench plugins, use files from trusted authors only.');
25+
// Verify that encryption enabled by default
26+
await t.expect(userAgreementPage.switchOptionEncryption.withAttribute('aria-checked', 'true').exists).ok('Encryption enabled by default');
27+
await t.click(addRedisDatabasePage.addDatabaseButton);
28+
//Verify that I still has agreements popup & cannot add a database
29+
await t.expect(userAgreementPage.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
30+
await t.expect(addRedisDatabasePage.addDatabaseManually.exists).notOk('User can\'t add a database');
31+
//Accept agreements
32+
await t.click(settingsPage.switchEulaOption);
33+
await t.click(settingsPage.submitConsentsPopupButton);
34+
//Verify that I dont have an popup
35+
await t.expect(userAgreementPage.userAgreementsPopup.exists).notOk('User Agreements Popup isn\'t shown after accept agreements');
36+
//Verify that Welcome page is displayed
37+
await t.expect(addRedisDatabasePage.welcomePageTitle.exists).ok('Welcome page is displayed');
38+
//Verify I can work with the application
39+
await t.click(addRedisDatabasePage.addDatabaseButton);
40+
await t.expect(addRedisDatabasePage.addDatabaseManually.exists).ok('User can add a database');
41+
});
42+
test('Verify that when user checks "Use recommended settings" option on EULA screen, all options (except Licence Terms) are checked', async t => {
43+
// Verify options unchecked before enabling Use recommended settings
44+
await t.expect(await settingsPage.getAnalyticsSwitcherValue()).eql('false', 'Enable Analytics switcher is checked');
45+
await t.expect(await settingsPage.getNotificationsSwitcherValue()).eql('false', 'Enable Notifications switcher is checked');
46+
// Check Use recommended settings switcher
47+
await t.click(userAgreementPage.recommendedSwitcher);
48+
// Verify options checked after enabling Use recommended settings
49+
await t.expect(await settingsPage.getAnalyticsSwitcherValue()).eql('true', 'Enable Analytics switcher is unchecked');
50+
await t.expect(await settingsPage.getNotificationsSwitcherValue()).eql('true', 'Enable Notifications switcher is unchecked');
51+
await t.expect(await settingsPage.getEulaSwitcherValue()).eql('false', 'EULA switcher is checked');
52+
// Uncheck Use recommended settings switcher
53+
await t.click(userAgreementPage.recommendedSwitcher);
54+
// Verify that when user unchecks "Use recommended settings" option on EULA screen, previous state of checkboxes for the options is applied
55+
await t.expect(await settingsPage.getAnalyticsSwitcherValue()).eql('false', 'Enable Analytics switcher is checked');
56+
await t.expect(await settingsPage.getNotificationsSwitcherValue()).eql('false', 'Enable Notifications switcher is checked');
57+
await t.expect(await settingsPage.getEulaSwitcherValue()).eql('false', 'EULA switcher is checked');
58+
});
59+
test('Verify that if "Use recommended settings" is selected, and user unchecks any of the option, "Use recommended settings" is unchecked', async t => {
60+
// Check Use recommended settings switcher
61+
await t.click(userAgreementPage.recommendedSwitcher);
62+
// Verify Use recommended settings switcher unchecked after unchecking analytics switcher
63+
await t.click(settingsPage.switchAnalyticsOption);
64+
await t.expect(await userAgreementPage.getRecommendedSwitcherValue()).eql('false', 'Use recommended settings switcher is still checked');
65+
// Check Use recommended settings switcher
66+
await t.click(userAgreementPage.recommendedSwitcher);
67+
// Verify Use recommended settings switcher unchecked after unchecking notifications switcher
68+
await t.click(settingsPage.switchNovitifationsOption);
69+
await t.expect(await userAgreementPage.getRecommendedSwitcherValue()).eql('false', 'Use recommended settings switcher is still checked');
70+
});

tests/e2e/tests/critical-path/settings/settings.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test
4242
await t.click(myRedisDatabasePage.settingsButton);
4343
await t.click(settingsPage.accordionPrivacySettings);
4444

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

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

0 commit comments

Comments
 (0)