Skip to content

Commit 487057b

Browse files
Merge pull request #3856 from RedisInsight/e2e/feature/RI-6067-reset-rdi-pipelines
add reset/stop pipeline tests
2 parents 10967ff + 8638e0d commit 487057b

File tree

2 files changed

+194
-0
lines changed

2 files changed

+194
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export class RdiHeader {
1717
importInput = Selector('[data-testid=import-file-modal-filepicker]');
1818
confirmUploadingPipelineBatton = Selector('[data-testid=submit-btn]');
1919

20+
resetPipelineButton = Selector('[data-testid=reset-pipeline-btn]');
21+
stopPipelineButton = Selector('[data-testid=stop-pipeline-btn]');
22+
startPipelineButton = Selector('[data-testid=start-pipeline-btn]');
23+
24+
pipelineStatus = Selector('[data-testid=pipeline-state-badge]');
25+
2026
/**
2127
* Import pipeline
2228
* @param filePath the name if the file
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
import * as path from 'path';
2+
import { t } from 'testcafe';
3+
import * as yaml from 'js-yaml';
4+
import { RdiInstancePage } from '../../../../pageObjects/rdi-instance-page';
5+
import { AddNewRdiParameters, RdiApiRequests } from '../../../../helpers/api/api-rdi';
6+
import { cloudDatabaseConfig, commonUrl } from '../../../../helpers/conf';
7+
import { BrowserPage, MyRedisDatabasePage } from '../../../../pageObjects';
8+
import { RdiInstancesListPage } from '../../../../pageObjects/rdi-instances-list-page';
9+
import {
10+
RdiPopoverOptions,
11+
RedisOverviewPage
12+
} from '../../../../helpers/constants';
13+
import { DatabaseHelper } from '../../../../helpers';
14+
import { DatabaseAPIRequests } from '../../../../helpers/api/api-database';
15+
import { RdiStatusPage } from '../../../../pageObjects/rdi-status-page';
16+
17+
const myRedisDatabasePage = new MyRedisDatabasePage();
18+
const rdiInstancePage = new RdiInstancePage();
19+
const rdiInstancesListPage = new RdiInstancesListPage();
20+
const rdiApiRequests = new RdiApiRequests();
21+
const databaseHelper = new DatabaseHelper();
22+
const databaseAPIRequests = new DatabaseAPIRequests();
23+
const browserPage = new BrowserPage();
24+
const rdiStatusPage = new RdiStatusPage();
25+
26+
const rdiInstance: AddNewRdiParameters = {
27+
name: 'testInstance',
28+
url: 'https://11.111.111.111',
29+
username: 'username',
30+
password: '111'
31+
};
32+
33+
const cloudName = 'Redis-Stack-in-Redis-Enterprise-Cloud';
34+
35+
const filePath = path.join('..', '..', '..', '..', 'test-data', 'rdi', 'RDI_pipelineConfigurations.zip');
36+
37+
//skip the tests until rdi integration is added
38+
fixture.skip `Deploy`
39+
.meta({ type: 'critical_path', feature: 'rdi' })
40+
.page(commonUrl)
41+
.beforeEach(async() => {
42+
await databaseHelper.acceptLicenseTerms();
43+
await rdiApiRequests.addNewRdiApi(rdiInstance);
44+
45+
})
46+
.afterEach(async() => {
47+
await rdiApiRequests.deleteAllRdiApi();
48+
});
49+
50+
test.after(async() => {
51+
52+
await t.click(browserPage.Cli.cliExpandButton);
53+
await browserPage.Cli.sendCommandInCli('flushdb');
54+
55+
// Delete databases
56+
await databaseAPIRequests.deleteAllDatabasesApi();
57+
await rdiApiRequests.deleteAllRdiApi();
58+
})('Verify that deploy and reset work', async() => {
59+
await myRedisDatabasePage.setActivePage(RedisOverviewPage.DataBase);
60+
await databaseHelper.autodiscoverRECloudDatabase(
61+
cloudDatabaseConfig.accessKey,
62+
cloudDatabaseConfig.secretKey
63+
);
64+
const [host, port] = (await myRedisDatabasePage.hostPort.textContent).split(':');
65+
const password = cloudDatabaseConfig.databasePassword;
66+
67+
const configData = {
68+
sources: {
69+
mysql: {
70+
type: 'cdc',
71+
logging: {
72+
level: 'info'
73+
},
74+
connection: {
75+
type: 'mysql',
76+
host: 'localhost',
77+
port: 3306,
78+
user: 'root',
79+
password: '1111',
80+
database: 'mydatabase'
81+
}
82+
}
83+
},
84+
targets: {
85+
target: {
86+
connection: {
87+
type: 'redis',
88+
host,
89+
port,
90+
password: password
91+
}
92+
}
93+
}
94+
};
95+
const config = yaml.dump(configData, { indent: 2 });
96+
97+
// clear added db
98+
await myRedisDatabasePage.clickOnDBByName(cloudName);
99+
100+
await t.click(browserPage.Cli.cliExpandButton);
101+
await browserPage.Cli.sendCommandInCli('flushdb');
102+
await t.click(browserPage.NavigationPanel.myRedisDBButton);
103+
104+
//deploy pipeline
105+
await myRedisDatabasePage.setActivePage(RedisOverviewPage.Rdi);
106+
await rdiInstancesListPage.clickRdiByName(rdiInstance.name);
107+
await rdiInstancePage.selectStartPipelineOption(RdiPopoverOptions.Pipeline);
108+
await t.click(rdiInstancePage.templateCancelButton);
109+
110+
await t.click(rdiInstancePage.configurationInput);
111+
const lines = config.split('\n');
112+
// the variable shows the level of object depth for input by line in monaco
113+
const maxLevelDepth = 4;
114+
await rdiInstancePage.MonacoEditor.insertTextByLines(rdiInstancePage.configurationInput, lines, maxLevelDepth);
115+
await t.click(rdiInstancePage.RdiHeader.deployPipelineBtn);
116+
await t.click(rdiInstancePage.RdiHeader.deployConfirmBtn);
117+
await t.expect(rdiInstancePage.loadingIndicator.exists).notOk({ timeout: 20000 });
118+
await t.click(rdiInstancePage.NavigationPanel.myRedisDBButton);
119+
120+
//verify that keys are added
121+
await rdiInstancePage.setActivePage(RedisOverviewPage.DataBase);
122+
await myRedisDatabasePage.clickOnDBByName(
123+
cloudName);
124+
await t
125+
.expect(browserPage.keysSummary.exists)
126+
.ok('Key list not loaded', { timeout: 5000 });
127+
128+
await t.click(browserPage.Cli.cliExpandButton);
129+
await browserPage.Cli.sendCommandInCli('flushdb');
130+
await t.click(browserPage.NavigationPanel.myRedisDBButton);
131+
// reset pipeline
132+
await myRedisDatabasePage.setActivePage(RedisOverviewPage.Rdi);
133+
await rdiInstancesListPage.clickRdiByName(rdiInstance.name);
134+
await rdiInstancePage.selectStartPipelineOption(RdiPopoverOptions.Server);
135+
await t.click(rdiInstancePage.RdiHeader.resetPipelineButton);
136+
137+
// keys is added again after reset
138+
await rdiInstancePage.setActivePage(RedisOverviewPage.DataBase);
139+
await myRedisDatabasePage.clickOnDBByName(
140+
cloudName);
141+
await t
142+
.expect(browserPage.keysSummary.exists)
143+
.ok('Key list not loaded', { timeout: 5000 });
144+
});
145+
146+
test('Verify that context is saved after navigation panel', async() => {
147+
148+
await myRedisDatabasePage.setActivePage(RedisOverviewPage.Rdi);
149+
await rdiInstancesListPage.clickRdiByName(rdiInstance.name);
150+
151+
await rdiInstancePage.selectStartPipelineOption(RdiPopoverOptions.File);
152+
await rdiInstancePage.RdiHeader.uploadPipeline(filePath);
153+
await t.click(rdiInstancePage.RdiHeader.deployPipelineBtn);
154+
await t.click(rdiInstancePage.RdiHeader.deployConfirmBtn);
155+
await t.expect(rdiInstancePage.loadingIndicator.exists).notOk({ timeout: 20000 });
156+
157+
// verify stop button
158+
await t.click(rdiInstancePage.RdiHeader.stopPipelineButton);
159+
await t.expect(rdiInstancePage.RdiHeader.stopPipelineButton.hasAttribute('disabled')).ok('the stop button is not disabled');
160+
// wait until disabled
161+
await t.expect(rdiInstancePage.RdiHeader.stopPipelineButton.hasAttribute('disabled')).notOk('the stop button is not disabled');
162+
await t.expect(rdiInstancePage.RdiHeader.startPipelineButton.hasAttribute('disabled')).notOk('the start button is not disabled');
163+
164+
await t.expect(rdiInstancePage.RdiHeader.stopPipelineButton.exists).notOk('the stop button is displayed');
165+
await t.expect(rdiInstancePage.RdiHeader.startPipelineButton.exists).ok('the start button is not displayed');
166+
167+
await t.click(rdiInstancePage.NavigationPanel.statusPageButton);
168+
await t.expect(rdiStatusPage.refreshStreamsButton.exists).ok('status is not loaded');
169+
await t.click(rdiInstancePage.NavigationPanel.managementPageButton);
170+
171+
// verify start button
172+
await t.click(rdiInstancePage.RdiHeader.startPipelineButton);
173+
await t.expect(rdiInstancePage.RdiHeader.startPipelineButton.hasAttribute('disabled')).ok('the start button is not disabled');
174+
// wait until disabled
175+
await t.expect(rdiInstancePage.RdiHeader.startPipelineButton.hasAttribute('disabled')).notOk('the start button is not disabled');
176+
await t.expect(rdiInstancePage.RdiHeader.stopPipelineButton.hasAttribute('disabled')).notOk('the stop button is not disabled');
177+
178+
await t.expect(rdiInstancePage.RdiHeader.startPipelineButton.exists).notOk('the start button is displayed');
179+
await t.expect(rdiInstancePage.RdiHeader.stopPipelineButton.exists).ok('the stop button is not displayed');
180+
181+
await t.click(rdiInstancePage.NavigationPanel.statusPageButton);
182+
await t.expect(rdiStatusPage.refreshStreamsButton.exists).notOk('status is loaded');
183+
184+
await t.expect(rdiInstancePage.RdiHeader.pipelineStatus.exists).ok('status is not displayed');
185+
186+
//TODO if it possible add a record to verify that the buttons work
187+
188+
});

0 commit comments

Comments
 (0)