Skip to content

Commit 946633c

Browse files
authored
Merge pull request #134 from RedisInsight/feature/e2e-workbench
[E2E] Test with pluging wording
2 parents 1c81000 + ee5b1f7 commit 946633c

File tree

6 files changed

+47
-22
lines changed

6 files changed

+47
-22
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('Verify that user can see specific message on EULA and Privacy Settings window during the first app launch', 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 that is displayed in window is 'While adding new visualization plugins, use files only from trusted authors to avoid automatic execution of malicious code.'
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+
});

tests/e2e/tests/regression/workbench/scripting-area.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test('Verify that user can run multiple commands written in multiple lines in Wo
5050
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n'), 0.5);
5151
//Check the result
5252
for(let i = 1; i < commandsForSend.length + 1; i++) {
53-
let resultCommand = await workbenchPage.queryCardCommand.nth(i - 1).textContent;
53+
const resultCommand = await workbenchPage.queryCardCommand.nth(i - 1).textContent;
5454
await t.expect(resultCommand).eql(commandsForSend[commandsForSend.length - i], `The command ${commandsForSend[commandsForSend.length - i]} is in the result`);
5555
}
5656
});
@@ -63,7 +63,7 @@ test('Verify that user can use double slashes (//) wrapped in double quotes and
6363
await workbenchPage.sendCommandInWorkbench(commandsForSend.join('\n"//"'), 0.5);
6464
//Check that all commands are executed
6565
for(let i = 1; i < commandsForSend.length + 1; i++) {
66-
let resultCommand = await workbenchPage.queryCardCommand.nth(i - 1).textContent;
66+
const resultCommand = await workbenchPage.queryCardCommand.nth(i - 1).textContent;
6767
await t.expect(resultCommand).contains(commandsForSend[commandsForSend.length - i], `The command ${commandsForSend[commandsForSend.length - i]} is in the result`);
6868
}
6969
});

0 commit comments

Comments
 (0)