Skip to content

Commit e23b017

Browse files
Merge pull request #3594 from RedisInsight/e2e/feature/RI-5902-rdi-integration
E2e/feature/ri 5902 rdi integration
2 parents 56ddb7d + 2779a56 commit e23b017

17 files changed

+239
-144
lines changed

tests/e2e/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"author": "",
2626
"dependencies": {
2727
"axios": "^1.6.0",
28-
"cli-argument-parser": "0.4.5"
28+
"cli-argument-parser": "0.4.5",
29+
"js-yaml": "^4.1.0"
2930
},
3031
"resolutions": {
3132
"@types/lodash": "4.14.192",

tests/e2e/pageObjects/components/monaco-editor.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class MonacoEditor {
2020
* @param clean if field should be cleaned
2121
*/
2222
async sendTextToMonaco(input: Selector, command: string, clean = true): Promise<void> {
23+
2324
await t.click(input);
2425
if(clean) {
2526
await t
@@ -30,6 +31,28 @@ export class MonacoEditor {
3031
await t.typeText(input, command);
3132
}
3233

34+
/**
35+
* Send lines in monacoEditor without additional space that typeText can add
36+
* @param input The input locator
37+
* @param lines lines
38+
* @param depth level of depth of the object
39+
*/
40+
async insertTextByLines(input: Selector, lines: string[], depth: number): Promise<void> {
41+
for(let i = 0; i < lines.length; i++) {
42+
const line = lines[i];
43+
44+
for(let j = 0; j < depth; j++) {
45+
await t.pressKey('shift+tab');
46+
}
47+
48+
if (line) {
49+
await t.typeText(input, line, { paste: true });
50+
}
51+
await t.pressKey('esc');
52+
await t.pressKey('enter');
53+
}
54+
}
55+
3356
/**
3457
* Get text from monacoEditor
3558
*/

tests/e2e/pageObjects/components/rdi/pipeline-management-panel.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ export class PipelineManagementPanel {
1111

1212
jobNameInput = Selector('[data-testid=inline-item-editor]');
1313
jobItem = Selector('[data-testid*=rdi-nav-job-actions]');
14-
confirmBtn = Selector('[data-testid=confirm-btn]');
14+
confirmBtn = Selector('[data-testid=delete-confirm-btn]');
1515
jobsPipelineTitle = Selector('[class*=rdi__title]');
1616

17+
configHighlightingIcon = Selector('[data-testid=updated-file-config-highlight]');
18+
1719
/**
1820
* Add Job by name
1921
* @param name job name
@@ -28,7 +30,7 @@ export class PipelineManagementPanel {
2830
* @param name job name
2931
*/
3032
async openJobByName(name: string): Promise<void> {
31-
const jobBtnSelector = Selector(`[data-testid=rdi-nav-job-${name}]`);
33+
const jobBtnSelector = await this.getJobByName(name);
3234
await t.click(jobBtnSelector);
3335
}
3436

@@ -52,4 +54,12 @@ export class PipelineManagementPanel {
5254
.typeText(this.jobNameInput, newName, { replace: true })
5355
.click(this.EditorButton.applyBtn);
5456
}
57+
58+
/**
59+
* Get Job by name
60+
* @param name job name
61+
*/
62+
async getJobByName(name: string): Promise<Selector> {
63+
return Selector(`[data-testid=rdi-nav-job-${name}]`);
64+
}
5565
}

tests/e2e/pageObjects/components/rdi/rdi-header.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ export class RdiHeader {
1111
deployConfirmBtn = Selector('[data-testid=deploy-confirm-btn]');
1212

1313
uploadPipelineButton = Selector('[data-testid=upload-pipeline-btn]');
14+
uploadConfirmPipelineButton = Selector('[data-testid=upload-confirm-btn]');
1415
uploadFromFileButton = Selector('[data-testid=upload-file-btn]');
1516
downloadPipelineButton = Selector('[data-testid=download-pipeline-btn]');
1617
importInput = Selector('[data-testid=import-file-modal-filepicker]');
17-
confirmUploadingPipelineBatton = Selector('[data-testid=upload-confirm-btn]');
18+
confirmUploadingPipelineBatton = Selector('[data-testid=submit-btn]');
1819

1920
cloudSignInButton = Selector('[data-testid=cloud-sign-in-btn]');
2021

tests/e2e/pageObjects/components/rdi/test-connection-panel.ts

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ import { TextConnectionSection } from '../../../helpers/constants';
44
export class TestConnectionPanel {
55
endpointRowString = '[data-testid^=table-endpoint]';
66

7-
sidePanel = Selector('[data-testid=test-connection-panel]');
8-
successfulSection = Selector('[data-testid^=success-connections]');
9-
failedSection = Selector('[data-testid^=failed-connections-]');
10-
endpointRow = Selector(this.endpointRowString);
11-
closeSection = Selector('[data-testid=close-test-connections-btn]');
7+
targetName = Selector('[data-testid=table-target-target]');
8+
resultText = Selector('[data-testid=table-result-target]');
129

1310
/**
1411
* Open/Close section
@@ -23,35 +20,4 @@ export class TestConnectionPanel {
2320
await t.click(sectionSelector.find('button'));
2421
}
2522
}
26-
27-
/**
28-
* get number of connection
29-
* @param section Name of section
30-
* @param state State of section
31-
*/
32-
async getNumberOfSection(section: TextConnectionSection): Promise<string> {
33-
const sectionSelector = Selector(`[data-testid^=${section}-connections-]`);
34-
return sectionSelector.find('span[data-testid="number-of-connections"]').textContent;
35-
}
36-
37-
/**
38-
* get row count in the section
39-
* @param section Name of section
40-
*/
41-
async getNumberOfSectionRow(section: TextConnectionSection): Promise<string> {
42-
const sectionSelector = Selector(`[data-testid^=${section}-connections-]`);
43-
const rows = await sectionSelector.find('[data-testid^=table-endpoint]').count;
44-
return rows.toString();
45-
}
46-
47-
/**
48-
* get row endpoint text by index
49-
* @param section Name of section
50-
* @param index index of the row to get text
51-
*/
52-
async getSectionRowTextByIndex(section: TextConnectionSection, index: number): Promise<string> {
53-
const sectionSelector = Selector(`[data-testid^=${section}-connections-]`);
54-
return await (sectionSelector.find(this.endpointRowString).nth(index)).textContent;
55-
}
56-
5723
}

tests/e2e/pageObjects/rdi-instance-page.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class RdiInstancePage extends BaseOverviewPage {
1515
RdiHeader = new RdiHeader();
1616
MonacoEditor = new MonacoEditor();
1717

18-
dryRunButton = Selector('[data-testid=rdi-jobs-dry-run]');
18+
dryRunButton = Selector('[data-testid=rdi-job-dry-run]');
1919
dryRunSubmitBtn = Selector('[data-testid=dry-run-btn]');
2020
closeDryRunPanelBtn = Selector('[data-testid=close-dry-run-btn]');
2121
dryRunPanel = Selector('[data-testid=dry-run-panel]');
@@ -28,6 +28,8 @@ export class RdiInstancePage extends BaseOverviewPage {
2828
okUploadPipelineBtn = Selector('[data-testid=ok-btn]');
2929
closeImportModelBtn = Selector('[data-testid=import-file-modal] button');
3030

31+
loadingIndicator = Selector('[class*=rdi__loading]');
32+
3133
configurationInput = Selector('[data-testid=wrapper-rdi-monaco-config]');
3234
configurationLink = Selector('[data-testid=rdi-pipeline-config-link]');
3335

@@ -38,7 +40,6 @@ export class RdiInstancePage extends BaseOverviewPage {
3840
jmesPathOption = Selector('[id=jmespath]');
3941
sqlEditorButton = Selector('[data-testid=open-dedicated-editor-btn]');
4042

41-
successDeployNotification = Selector('[data-testid=success-deploy-pipeline-notification]');
4243
errorDeployNotification = Selector('[data-test-subj=toast-error-deploy]');
4344
failedUploadingPipelineNotification = Selector('[data-testid=result-failed]');
4445
closeNotification = Selector('[class*=euiModal__closeIcon]');
-1.54 KB
Binary file not shown.
1.02 KB
Binary file not shown.
706 Bytes
Binary file not shown.

tests/e2e/tests/web/critical-path/rdi/add-job.e2e.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const databaseHelper = new DatabaseHelper();
1515

1616
const rdiInstance: AddNewRdiParameters = {
1717
name: 'testInstance',
18-
url: 'http://localhost:4000',
18+
url: 'https://11.111.111.111',
1919
username: 'username',
20-
password: 'password'
20+
password: '111'
2121
};
2222

2323
//skip the tests until rdi integration is added
@@ -85,6 +85,7 @@ test('Verify that user insert template for jobs', async() => {
8585
// should be empty config
8686
await rdiInstancePage.PipelineManagementPanel.addJob(jobName);
8787

88+
await rdiInstancePage.PipelineManagementPanel.openJobByName(jobName);
8889
await t.expect(rdiInstancePage.templateApplyButton.visible).ok('the template popover is not expanded');
8990
const buttonClass = rdiInstancePage.templateApplyButton.getAttribute('class');
9091
await t.expect(buttonClass).notContains(disabledAttribute, 'Apply button is disabled');
@@ -94,7 +95,7 @@ test('Verify that user insert template for jobs', async() => {
9495
await t.click(rdiInstancePage.templateButton);
9596
await t.expect(rdiInstancePage.templateApplyButton.visible).ok('the template popover is not expanded');
9697
await t.expect(rdiInstancePage.pipelineDropdown.textContent).eql(defaultValue, 'the default value is set incorrectly');
97-
await rdiInstancePage.setTemplateDropdownValue(RdiTemplatePipelineType.WriteBehind);
98+
await rdiInstancePage.setTemplateDropdownValue(RdiTemplatePipelineType.Ingest);
9899

99100
//verify uniq templates words - should be undated when templates are added
100101
const enteredText = await rdiInstancePage.MonacoEditor.getTextFromMonaco();
@@ -120,9 +121,9 @@ test('Verify that user can open an additional editor to work with SQL and JMESPa
120121
const jobName = 'testJob';
121122
const sqlText = 'SELECT test FROM test1';
122123
const SQLiteText = 's';
123-
const SQLiteAutoCompleteText = 'STRFTIME(format, time_value)';
124+
const SQLiteAutoCompleteText = 'SIGN(X)';
124125
const JMESPathText = 'r';
125-
const JMESPathAutoCompleteText = 'regex_replace';
126+
const JMESPathAutoCompleteText = 'REGEX_REPLACE';
126127

127128
await rdiInstancePage.PipelineManagementPanel.addJob(jobName);
128129
await rdiInstancePage.PipelineManagementPanel.openJobByName(jobName);
@@ -136,7 +137,7 @@ test('Verify that user can open an additional editor to work with SQL and JMESPa
136137
await t.expect(rdiInstancePage.draggableArea.exists).ok('SQL/JMESPath editor is not displayed');
137138

138139
// Verify that user can see SQL(set by default) and JMESPath editor options
139-
await t.expect(rdiInstancePage.dedicatedLanguageSelect.textContent).eql('SQL', 'SQL is not set by default');
140+
await t.expect(rdiInstancePage.dedicatedLanguageSelect.textContent).eql('SQLite functions', 'SQL is not set by default');
140141

141142
// Verify that user can close the additional editor
142143
await rdiInstancePage.MonacoEditor.sendTextToMonaco(rdiInstancePage.draggableArea, sqlText, false);
@@ -158,7 +159,7 @@ test('Verify that user can open an additional editor to work with SQL and JMESPa
158159
// Start type characters and select command
159160
await rdiInstancePage.MonacoEditor.sendTextToMonaco(rdiInstancePage.draggableArea, JMESPathText);
160161
// Verify that the list with auto-suggestions is displayed
161-
await t.expect(rdiInstancePage.MonacoEditor.monacoSuggestion.count).eql(3, 'Auto-suggestions are not displayed');
162+
await t.expect(rdiInstancePage.MonacoEditor.monacoSuggestion.count).gt(1, 'Auto-suggestions are not displayed');
162163
await t.pressKey('tab');
163164
await t.click(rdiInstancePage.EditorButton.applyBtn);
164165
await t.expect(await rdiInstancePage.MonacoEditor.getTextFromMonaco()).contains(JMESPathAutoCompleteText, 'Text from JMESPath editor not applied');
@@ -168,7 +169,7 @@ test('Verify that user can open an additional editor to work with SQL and JMESPa
168169
// Start type characters and select command
169170
await rdiInstancePage.MonacoEditor.sendTextToMonaco(rdiInstancePage.draggableArea, SQLiteText);
170171
// Verify that the list with auto-suggestions is displayed
171-
await t.expect(rdiInstancePage.MonacoEditor.monacoSuggestion.count).eql(3, 'Auto-suggestions are not displayed');
172+
await t.expect(rdiInstancePage.MonacoEditor.monacoSuggestion.count).gt(1, 'Auto-suggestions are not displayed');
172173
await t.pressKey('tab');
173174
await t.click(rdiInstancePage.EditorButton.applyBtn);
174175
await t.expect(await rdiInstancePage.MonacoEditor.getTextFromMonaco()).contains(SQLiteAutoCompleteText, 'Text from SQLite editor not applied');

0 commit comments

Comments
 (0)