Skip to content

Commit 6bccb0a

Browse files
updated and add tests #2
1 parent 69533f9 commit 6bccb0a

File tree

6 files changed

+32
-54
lines changed

6 files changed

+32
-54
lines changed

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

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +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]');
127
targetName = Selector('[data-testid=table-target-target]');
8+
resultText = Selector('[data-testid=table-result-target]');
139

1410
/**
1511
* Open/Close section
@@ -24,25 +20,4 @@ export class TestConnectionPanel {
2420
await t.click(sectionSelector.find('button'));
2521
}
2622
}
27-
28-
/**
29-
* get number of connection
30-
* @param section Name of section
31-
* @param state State of section
32-
*/
33-
async getNumberOfSection(section: TextConnectionSection): Promise<string> {
34-
const sectionSelector = Selector(`[data-testid^=${section}-connections-]`);
35-
return sectionSelector.find('span[data-testid="number-of-connections"]').textContent;
36-
}
37-
38-
/**
39-
* get row endpoint text by index
40-
* @param section Name of section
41-
* @param index index of the row to get text
42-
*/
43-
async getSectionRowTextByIndex(section: TextConnectionSection, index: number): Promise<string> {
44-
const sectionSelector = Selector(`[data-testid^=${section}-connections-]`);
45-
return await (sectionSelector.find(this.endpointRowString).nth(index)).textContent;
46-
}
47-
4823
}
759 Bytes
Binary file not shown.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const databaseHelper = new DatabaseHelper();
1515

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

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ const rdiApiRequests = new RdiApiRequests();
2020

2121
const rdiInstance: RdiInstance = {
2222
alias: 'Alias',
23-
url: 'https://54.175.165.214',
23+
url: 'https://11.111.111.111',
2424
username: 'username',
2525
password: 'v3rY$tronGPa33w0Rd3ECDb',
2626
version: '1.2'
2727
};
2828
const rdiInstance2: RdiInstance = {
2929
alias: 'test',
30-
url: 'https://54.175.165.214',
30+
url: 'https://11.111.111.111',
3131
username: 'name',
3232
password: 'v3rY$tronGPa33w0Rd3ECDb',
3333
version: '1.2'
3434
};
3535

3636
const rdiInstance3: RdiInstance = {
3737
alias: 'first',
38-
url: 'https://54.175.165.214',
38+
url: 'https://11.111.111.111',
3939
username: 'name',
4040
password: 'v3rY$tronGPa33w0Rd3ECDb',
4141
version: '1.2'
@@ -150,7 +150,7 @@ test('Verify that button is displayed if user does not enter all mandatory infor
150150
});
151151
test('Verify that user can see the Redis Data Integration message on the empty RDI list', async t => {
152152
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.';
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'
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';
154154

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

tests/e2e/tests/web/critical-path/rdi/configuration.e2e.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import * as path from 'path';
12
import { ClientFunction, t } from 'testcafe';
23
import * as yaml from 'js-yaml';
3-
import * as path from 'path';
44
import { RdiInstancePage } from '../../../../pageObjects/rdi-instance-page';
55
import { AddNewRdiParameters, RdiApiRequests } from '../../../../helpers/api/api-rdi';
66
import { cloudDatabaseConfig, commonUrl } from '../../../../helpers/conf';
@@ -15,24 +15,25 @@ import {
1515
} from '../../../../helpers/constants';
1616
import { DatabaseHelper } from '../../../../helpers';
1717
import { goBackHistory } from '../../../../helpers/utils';
18-
18+
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
1919

2020
const myRedisDatabasePage = new MyRedisDatabasePage();
2121
const rdiInstancePage = new RdiInstancePage();
2222
const rdiInstancesListPage = new RdiInstancesListPage();
2323
const rdiApiRequests = new RdiApiRequests();
2424
const databaseHelper = new DatabaseHelper();
25+
const databaseAPIRequests = new DatabaseAPIRequests();
2526

2627
const rdiInstance: AddNewRdiParameters = {
2728
name: 'testInstance',
28-
url: 'https://54.175.165.214',
29+
url: 'https://11.111.111.111',
2930
username: 'username',
3031
password: 'v3rY$tronGPa33w0Rd3ECDb'
3132
};
3233

3334
const getPageUrl = ClientFunction(() => window.location.href);
3435

35-
const filePath = path.join('..', '..', '..', '..', 'test-data', 'rdi', 'RDI_pipelineConfig.zip');
36+
const filePath = path.join('..', '..', '..', '..', 'test-data', 'rdi', 'RDI_pipelineConfigurations.zip');
3637

3738
//skip the tests until rdi integration is added
3839
fixture `Pipeline`
@@ -47,16 +48,18 @@ fixture `Pipeline`
4748
await rdiApiRequests.deleteAllRdiApi();
4849
});
4950

50-
test.only('Verify that user can test connection', async() => {
51+
test.after(async() => {
52+
// Delete databases
53+
await databaseAPIRequests.deleteAllDatabasesApi();
54+
})('Verify that user can test connection', async() => {
5155
await myRedisDatabasePage.setActivePage(RedisOverviewPage.DataBase);
5256
await databaseHelper.autodiscoverRECloudDatabase(
53-
//cloudDatabaseConfig.accessKey,
54-
//cloudDatabaseConfig.secretKey
55-
'A4wddpkno553qruhpsd670y8axe94warws3gbjbw896iyjf6dfl',
56-
'S3xf5aiipy32nc9q7dyg8v4yhvf7x18i34euwilbcgrz02yjro5'
57+
cloudDatabaseConfig.accessKey,
58+
cloudDatabaseConfig.secretKey
5759
);
5860
const [host, port] = (await myRedisDatabasePage.hostPort.textContent).split(':');
59-
//const password = cloudDatabaseConfig.databasePassword;
61+
const password = cloudDatabaseConfig.databasePassword;
62+
const errorText = 'Failed to connect to RDI database. Please verify host and port information.';
6063

6164
const configData = {
6265
sources: {
@@ -80,21 +83,21 @@ test.only('Verify that user can test connection', async() => {
8083
type: 'redis',
8184
host,
8285
port,
83-
password: 'dd4oImrbinrNs1LXzKCtsnKjzLxZeaA2'
86+
password: password
8487
}
8588
}
8689
};
8790
const config = yaml.dump(configData, { indent: 2 });
88-
89-
//fs.writeFileSync('config.yaml', yamlString, 'utf8');
9091
console.log(JSON.stringify(config));
92+
9193
await myRedisDatabasePage.setActivePage(RedisOverviewPage.Rdi);
9294
await rdiInstancesListPage.clickRdiByName(rdiInstance.name);
9395
await rdiInstancePage.selectStartPipelineOption(RdiPopoverOptions.Pipeline);
9496
await t.click(rdiInstancePage.templateCancelButton);
9597

9698
await t.click(rdiInstancePage.configurationInput);
9799
const lines = config.split('\n');
100+
// the verable shows the level of object depth for input by line in monaco
98101
const maxLevelDepth = 3;
99102
const targetName = 'target';
100103

@@ -108,11 +111,14 @@ test.only('Verify that user can test connection', async() => {
108111
await rdiInstancePage.RdiHeader.uploadPipeline(filePath);
109112
await t.click(rdiInstancePage.okUploadPipelineBtn);
110113
await t.click(rdiInstancePage.textConnectionBtn);
114+
await rdiInstancePage.TestConnectionPanel.expandOrCollapseSection(TextConnectionSection.Failed, true);
115+
116+
await t.expect(await rdiInstancePage.TestConnectionPanel.resultText.textContent).eql(errorText);
111117

112118
});
113119
test('Verify that link on configuration is valid', async() => {
114120

115-
const link = 'https://docs.redis.com/latest/rdi/quickstart/';
121+
const link = 'https://redis.io/docs/latest/integrate/redis-data-integration/ingest/data-pipelines/data-pipelines/?utm_source=redisinsight&utm_medium=rdi&utm_campaign=config_file';
116122
// Verify the link
117123
await myRedisDatabasePage.setActivePage(RedisOverviewPage.Rdi);
118124
await rdiInstancesListPage.clickRdiByName(rdiInstance.name);
@@ -123,15 +129,14 @@ test('Verify that link on configuration is valid', async() => {
123129
await goBackHistory();
124130
});
125131

126-
test('Verify that user can insert template', async() => {
132+
test.only('Verify that user can insert template', async() => {
127133
const disabledAttribute = 'isDisabled';
128-
const defaultValue = 'Ingest';
129-
const templateWords = 'type: redis';
134+
const defaultValue = 'ingest';
135+
const templateWords = 'type: mysql';
130136
// should be empty config
131137
await myRedisDatabasePage.setActivePage(RedisOverviewPage.Rdi);
132138
await rdiInstancesListPage.clickRdiByName(rdiInstance.name);
133-
await t.click(rdiInstancePage.PipelineManagementPanel.configurationTab);
134-
await rdiInstancePage.selectStartPipelineOption(RdiPopoverOptions.File);
139+
await rdiInstancePage.selectStartPipelineOption(RdiPopoverOptions.Pipeline);
135140
await t.expect(rdiInstancePage.templateApplyButton.visible).ok('the template popover is not expanded');
136141
const buttonClass = rdiInstancePage.templateApplyButton.getAttribute('class');
137142
await t.expect(buttonClass).notContains(disabledAttribute, 'Apply button is disabled');
@@ -143,12 +148,10 @@ test('Verify that user can insert template', async() => {
143148
await t.expect(rdiInstancePage.pipelineDropdown.textContent).eql(defaultValue, 'the default value is set incorrectly');
144149
await rdiInstancePage.setTemplateDropdownValue(RdiTemplatePipelineType.Ingest, RdiTemplateDatabaseType.MySql);
145150

146-
//verify uniq templates words - should be undated when templates are added
147151
const enteredText = await rdiInstancePage.MonacoEditor.getTextFromMonaco();
148152
await t.expect(enteredText).contains(templateWords, 'template is incorrect');
149153

150154
await t.click(rdiInstancePage.templateButton);
151155
await t.expect(buttonClass).contains(disabledAttribute, 'Apply button is active');
152-
await t.expect(rdiInstancePage.pipelineDropdown.textContent).eql('Ingest', 'the value is set incorrectly');
153-
await t.expect(rdiInstancePage.databaseDropdown.textContent).eql('MySQL', 'the default value is set incorrectly');
156+
await t.expect(rdiInstancePage.pipelineDropdown.textContent).eql(defaultValue, 'the value is set incorrectly');
154157
});

tests/e2e/tests/web/critical-path/rdi/dry-run-job.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const outputMock = 'No Redis commands provided by the server.';
1919

2020
const rdiInstance: AddNewRdiParameters = {
2121
name: 'testInstance',
22-
url: 'https://54.175.165.214',
22+
url: 'https://11.111.111.111',
2323
username: 'username',
2424
password: 'v3rY$tronGPa33w0Rd3ECDb'
2525
};

0 commit comments

Comments
 (0)