Skip to content

Commit c1a63d3

Browse files
authored
Merge pull request #929 from RedisInsight/e2e/imporve-eula-screen
tests for improve eula screen feature
2 parents 6bf57d2 + feb1a74 commit c1a63d3

File tree

4 files changed

+100
-41
lines changed

4 files changed

+100
-41
lines changed

tests/e2e/pageObjects/settings-page.ts

Lines changed: 22 additions & 4 deletions
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]');
@@ -34,17 +35,34 @@ export class SettingsPage {
3435
}
3536

3637
/**
37-
* Change Commands In Pipeline value
38-
* @param value Value for pipeline
39-
*/
38+
* Change Commands In Pipeline value
39+
* @param value Value for pipeline
40+
*/
4041
async changeCommandsInPipeline(value: string): Promise<void> {
4142
await t.hover(this.commandsInPipelineValue);
4243
await t.click(this.commandsInPipelineInput);
4344
await t.typeText(this.commandsInPipelineInput, value, { replace: true });
4445
await t.click(this.applyButton);
4546
}
4647

47-
async getAnalyticsValue(): Promise<string> {
48+
/**
49+
* Get state of Analytics switcher
50+
*/
51+
async getAnalyticsSwitcherValue(): Promise<string> {
4852
return await this.switchAnalyticsOption.getAttribute('aria-checked');
4953
}
54+
55+
/**
56+
* Get state of Notifications switcher
57+
*/
58+
async getNotificationsSwitcherValue(): Promise<string> {
59+
return await this.switchNovitifationsOption.getAttribute('aria-checked');
60+
}
61+
62+
/**
63+
* Get state of Eula switcher
64+
*/
65+
async getEulaSwitcherValue(): Promise<string> {
66+
return await this.switchEulaOption.getAttribute('aria-checked');
67+
}
5068
}

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,22 @@ 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

18-
//Accept RedisInsight License Terms
19-
async acceptLicenseTerms():Promise<void> {
20-
if (await this.switchOptionEula.exists) {
21-
await t.click(this.switchOptionEula);
22-
await t.click(this.switchOptionEncryption);
23-
await t.click(this.submitButton);
24-
}
25-
}
19+
//Accept RedisInsight License Terms
20+
async acceptLicenseTerms(): Promise<void> {
21+
if (await this.switchOptionEula.exists) {
22+
await t.click(this.switchOptionEula);
23+
await t.click(this.switchOptionEncryption);
24+
await t.click(this.submitButton);
25+
}
26+
}
27+
28+
/**
29+
* Get state of Recommended switcher
30+
*/
31+
async getRecommendedSwitcherValue(): Promise<string> {
32+
return await this.recommendedSwitcher.getAttribute('aria-checked');
33+
}
2634
}

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

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

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)