Skip to content

Commit eea338d

Browse files
committed
[E2E] Test with plugin text on agreements modal form is added
1 parent baca81a commit eea338d

File tree

5 files changed

+45
-20
lines changed

5 files changed

+45
-20
lines changed

redisinsight/ui/src/components/consents-settings/ConsentsSettings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const ConsentsSettings = ({ liveEditMode = false }: Props) => {
171171
{!liveEditMode && (
172172
<>
173173
<EuiCallOut>
174-
<EuiText size="s">
174+
<EuiText size="s" data-testid="plugin-section">
175175
While adding new visualization plugins, use files only from trusted authors
176176
to avoid automatic execution of malicious code.
177177
</EuiText>

tests/e2e/helpers/common.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
import { t } from 'testcafe';
1+
import {RequestMock, t} from 'testcafe';
2+
import {commonUrl} from "./conf";
3+
4+
const settingsApiUrl = `${commonUrl}/api/settings`;
5+
6+
const mockedSettingsResponse = {
7+
agreements: {
8+
version: '0',
9+
eula: false,
10+
analytics: false
11+
}}
212

313
export class Common {
14+
mock = RequestMock()
15+
.onRequestTo(settingsApiUrl)
16+
.respond(mockedSettingsResponse, 200);
17+
418
async waitForElementNotVisible(elm): Promise<void> {
519
await t.expect(elm.exists).notOk({ timeout: 20000 });
620
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export class UserAgreementPage {
1111
submitButton: Selector
1212
switchOptionEula: Selector
1313
switchOptionEncryption: Selector
14+
pluginSectionWithText: Selector
1415

1516
constructor() {
1617
//-------------------------------------------------------------------------------------------
@@ -25,6 +26,7 @@ export class UserAgreementPage {
2526
this.submitButton = Selector('[data-testid=btn-submit]');
2627
this.switchOptionEula = Selector('[data-testid=switch-option-eula]');
2728
this.switchOptionEncryption = Selector('[data-testid=switch-option-encryption]');
29+
this.pluginSectionWithText = Selector('[data-testid=plugin-section]')
2830
}
2931

3032
//Accept RedisInsight License Terms

tests/e2e/tests/critical-path/database/verify-agreements.e2e.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
1-
import { RequestMock } from 'testcafe';
21
import { commonUrl } from '../../../helpers/conf';
3-
import { UserAgreementPage, AddRedisDatabasePage, SettingsPage, MyRedisDatabasePage } from '../../../pageObjects';
2+
import { UserAgreementPage, AddRedisDatabasePage, SettingsPage } from '../../../pageObjects';
3+
import { Common } from '../../../helpers/common';
44

55
const addRedisDatabasePage = new AddRedisDatabasePage();
66
const settingsPage = new SettingsPage();
7-
const myRedisDatabasePage = new MyRedisDatabasePage();
8-
9-
const mockedSettingsResponse = {
10-
agreements: {
11-
version: '0',
12-
eula: false,
13-
analytics: false
14-
}
15-
};
16-
const settingsApiUrl = `${commonUrl}/api/settings`;
17-
18-
const mock = RequestMock()
19-
.onRequestTo(settingsApiUrl)
20-
.respond(mockedSettingsResponse, 200);
21-
7+
const common = new Common();
228
const userAgreementPage = new UserAgreementPage();
239

2410
fixture `Agreements Verification`
2511
.meta({ type: 'critical_path' })
2612
.page(commonUrl)
27-
.requestHooks(mock)
13+
.requestHooks(common.mock)
2814
.beforeEach(async t => {
2915
await t.maximizeWindow();
3016
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { commonUrl } from '../../../helpers/conf';
2+
import { UserAgreementPage } from '../../../pageObjects';
3+
import { Common } from '../../../helpers/common';
4+
5+
const userAgreementPage = new UserAgreementPage();
6+
const common = new Common();
7+
8+
fixture `Agreements Verification`
9+
.meta({ type: 'regression' })
10+
.page(commonUrl)
11+
.requestHooks(common.mock)
12+
.beforeEach(async t => {
13+
await t.maximizeWindow();
14+
});
15+
test.only('Verify that user can see message "While adding new visualization plugins, use files only from trusted authors to avoid automatic execution of malicious code." on EULA and Privacy Settings window when he opens the application for the very first time', async t => {
16+
//Verify that User Agreements modal form is displayed
17+
await t.expect(userAgreementPage.userAgreementsPopup.exists).ok('User Agreements Popup is shown');
18+
//Verify that section with plugin warning is displayed
19+
await t.expect(userAgreementPage.pluginSectionWithText.visible).ok('Plugin text is displayed');
20+
//Verify that text is correct
21+
const pluginText = userAgreementPage.pluginSectionWithText.innerText;
22+
await t.expect(pluginText).eql('While adding new visualization plugins, use files only from trusted authors to avoid automatic execution of malicious code.');
23+
});

0 commit comments

Comments
 (0)