Skip to content

Commit 69533f9

Browse files
updated and add tests
1 parent 21d0cfd commit 69533f9

14 files changed

+544
-239
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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ 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

1717
/**
@@ -28,7 +28,7 @@ export class PipelineManagementPanel {
2828
* @param name job name
2929
*/
3030
async openJobByName(name: string): Promise<void> {
31-
const jobBtnSelector = Selector(`[data-testid=rdi-nav-job-${name}]`);
31+
const jobBtnSelector = await this.getJobByName(name);
3232
await t.click(jobBtnSelector);
3333
}
3434

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

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: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export class TestConnectionPanel {
99
failedSection = Selector('[data-testid^=failed-connections-]');
1010
endpointRow = Selector(this.endpointRowString);
1111
closeSection = Selector('[data-testid=close-test-connections-btn]');
12+
targetName = Selector('[data-testid=table-target-target]');
1213

1314
/**
1415
* Open/Close section
@@ -34,16 +35,6 @@ export class TestConnectionPanel {
3435
return sectionSelector.find('span[data-testid="number-of-connections"]').textContent;
3536
}
3637

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-
4738
/**
4839
* get row endpoint text by index
4940
* @param section Name of section

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]');
759 Bytes
Binary file not shown.
706 Bytes
Binary file not shown.

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

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

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

2323
//skip the tests until rdi integration is added
24-
fixture.skip `Add job`
24+
fixture `Add job`
2525
.meta({ type: 'critical_path', feature: 'rdi' })
2626
.page(commonUrl)
2727
.beforeEach(async() => {
@@ -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');

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

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { RdiInstancePage } from '../../../../pageObjects/rdi-instance-page';
77
import { commonUrl } from '../../../../helpers/conf';
88
import { RdiPopoverOptions, RedisOverviewPage } from '../../../../helpers/constants';
99
import { MyRedisDatabasePage } from '../../../../pageObjects';
10-
import { DatabaseHelper } from '../../../../helpers';
10+
import { Common, DatabaseHelper } from '../../../../helpers';
1111
import { RdiApiRequests } from '../../../../helpers/api/api-rdi';
12+
import { goBackHistory } from '../../../../helpers/utils';
1213

1314
const rdiInstancesListPage = new RdiInstancesListPage();
1415
const browserActions = new BrowserActions();
@@ -19,29 +20,29 @@ const rdiApiRequests = new RdiApiRequests();
1920

2021
const rdiInstance: RdiInstance = {
2122
alias: 'Alias',
22-
url: 'http://localhost:4000',
23+
url: 'https://54.175.165.214',
2324
username: 'username',
24-
password: 'passwordPassword',
25+
password: 'v3rY$tronGPa33w0Rd3ECDb',
2526
version: '1.2'
2627
};
2728
const rdiInstance2: RdiInstance = {
2829
alias: 'test',
29-
url: 'http://localhost:4000',
30+
url: 'https://54.175.165.214',
3031
username: 'name',
31-
password: 'pass2024',
32+
password: 'v3rY$tronGPa33w0Rd3ECDb',
3233
version: '1.2'
3334
};
3435

3536
const rdiInstance3: RdiInstance = {
3637
alias: 'first',
37-
url: 'http://localhost:4000',
38+
url: 'https://54.175.165.214',
3839
username: 'name',
39-
password: 'passPassword2024',
40+
password: 'v3rY$tronGPa33w0Rd3ECDb',
4041
version: '1.2'
4142
};
4243
//skip the tests until rdi integration is added
4344

44-
fixture.skip `Rdi instance`
45+
fixture `Rdi instance`
4546
.meta({ type: 'critical_path', feature: 'rdi' })
4647
.page(commonUrl)
4748
.beforeEach(async() => {
@@ -77,7 +78,6 @@ test('Verify that user can add and remove RDI', async() => {
7778
});
7879
test
7980
.after(async() => {
80-
await t.typeText(rdiInstancesListPage.searchInput, '', { replace: true });
8181
await rdiInstancesListPage.deleteAllInstance();
8282
})('Verify that user can search by RDI', async() => {
8383
await rdiInstancesListPage.addRdi(rdiInstance);
@@ -90,20 +90,19 @@ test
9090
});
9191
test('Verify that sorting on the list of rdi saved when rdi opened', async t => {
9292
// Sort by Connection Type
93-
9493
await rdiInstancesListPage.addRdi(rdiInstance);
9594
await rdiInstancesListPage.addRdi(rdiInstance3);
9695
await rdiInstancesListPage.addRdi(rdiInstance2);
9796

98-
const sortedByUrl = [rdiInstance3.alias, rdiInstance2.alias, rdiInstance.alias];
99-
await rdiInstancesListPage.sortByColumn('URL');
97+
const sortedByAlias = [rdiInstance.alias, rdiInstance3.alias, rdiInstance2.alias];
98+
await rdiInstancesListPage.sortByColumn('RDI Alias');
10099
let actualDatabaseList = await rdiInstancesListPage.getAllRdiNames();
101-
await rdiInstancesListPage.compareInstances(actualDatabaseList, sortedByUrl);
100+
await rdiInstancesListPage.compareInstances(actualDatabaseList, sortedByAlias);
102101
await rdiInstancesListPage.clickRdiByName(rdiInstance.alias);
103102
await rdiInstancePage.selectStartPipelineOption(RdiPopoverOptions.Pipeline);
104103
await t.click(rdiInstancePage.RdiHeader.breadcrumbsLink);
105104
actualDatabaseList = await rdiInstancesListPage.getAllRdiNames();
106-
await rdiInstancesListPage.compareInstances(actualDatabaseList, sortedByUrl);
105+
await rdiInstancesListPage.compareInstances(actualDatabaseList, sortedByAlias);
107106
});
108107
test('Verify that user has the same sorting if db name is changed', async t => {
109108
const newAliasName = 'New alias';
@@ -151,16 +150,15 @@ test('Verify that button is displayed if user does not enter all mandatory infor
151150
});
152151
test('Verify that user can see the Redis Data Integration message on the empty RDI list', async t => {
153152
const noInstancesMessage = 'Redis Data Integration (RDI) synchronizes data from your existing database into Redis in near-real-time. We\'ve done the heavy lifting so you can turn slow data into fast data without coding.';
154-
// const externalPageLink = 'https://docs.redis.com/rdi-preview/rdi/quickstart/'
153+
const externalPageLink = 'https://redis.io/docs/latest/integrate/redis-data-integration/ingest/quick-start-guide/?utm_source=redisinsight&utm_medium=rdi&utm_campaign=rdi_list'
155154

156155
await t.expect(rdiInstancesListPage.emptyRdiList.withText(noInstancesMessage).exists).ok('Empty RDI page message not displayed');
157156

158157
await t.click(rdiInstancesListPage.addRdiFromEmptyListBtn);
159158
await t.expect(rdiInstancesListPage.AddRdiInstance.connectToRdiForm.exists).ok('Add rdi form not opened');
160159
await t.click(rdiInstancesListPage.AddRdiInstance.cancelInstanceBtn);
161160

162-
// Unskip after updating testcafe with opening links support https://redislabs.atlassian.net/browse/RI-5565
163-
// await t.click(rdiInstancesListPage.quickstartBtn);
164-
// await Common.checkURL(externalPageLink);
165-
// await goBackHistory();
161+
await t.click(rdiInstancesListPage.quickstartBtn);
162+
await Common.checkURL(externalPageLink);
163+
await goBackHistory();
166164
});

0 commit comments

Comments
 (0)