Skip to content

Commit 0c521c9

Browse files
committed
[E2E] Modules for Edit DB form is added, fixes for moudles test added
1 parent af6b3a0 commit 0c521c9

File tree

4 files changed

+64
-114
lines changed

4 files changed

+64
-114
lines changed

tests/e2e/helpers/database.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export async function addNewStandaloneDatabase(databaseParameters: AddNewDatabas
2828
//Click for saving
2929
await t.click(addRedisDatabasePage.addRedisDatabaseButton);
3030
//Wait for database to be exist
31-
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseParameters.databaseName).exists).ok('The existence of the database', { timeout: 60000 });
31+
await t.expect(myRedisDatabasePage.dbNameList.withExactText(databaseParameters.databaseName).exists).ok('The existence of the database', { timeout: 10000 });
32+
//Close message
33+
await t.click(myRedisDatabasePage.toastCloseButton);
3234
}
3335

3436
/**
@@ -102,6 +104,13 @@ export async function addNewRECloudDatabase(cloudAPIAccessKey: string, cloudAPIS
102104
return databaseName;
103105
}
104106

107+
//Accept License terms
108+
export async function acceptLicenseTerms(): Promise<void> {
109+
await t.maximizeWindow();
110+
await userAgreementPage.acceptLicenseTerms();
111+
await t.expect(addRedisDatabasePage.addDatabaseButton.exists).ok('The add redis database view', {timeout: 20000});
112+
}
113+
105114
/**
106115
* Accept License terms and add database
107116
* @param databaseParameters The database parameters
@@ -126,13 +135,6 @@ export async function acceptLicenseTermsAndAddOSSClusterDatabase(databaseParamet
126135
await myRedisDatabasePage.clickOnDBByName(databaseName);
127136
}
128137

129-
//Accept License terms
130-
export async function acceptLicenseTerms(): Promise<void> {
131-
await t.maximizeWindow();
132-
await userAgreementPage.acceptLicenseTerms();
133-
await t.expect(addRedisDatabasePage.addDatabaseButton.exists).ok('The add redis database view', {timeout: 20000});
134-
}
135-
136138
//Clear database data
137139
export async function clearDatabaseInCli(): Promise<void> {
138140
if (await cliPage.cliCollapseButton.exists === false) {

tests/e2e/pageObjects/add-redis-database-page.ts

Lines changed: 22 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -72,29 +72,14 @@ export class AddRedisDatabasePage {
7272
.click(this.addDatabaseButton)
7373
.click(this.addDatabaseManually)
7474
await t
75-
.typeText(this.hostInput, parameters.host, {
76-
replace: true,
77-
paste: true
78-
})
79-
.typeText(this.portInput, parameters.port, {
80-
replace: true,
81-
paste: true
82-
})
83-
.typeText(this.databaseAliasInput, parameters.databaseName, {
84-
replace: true,
85-
paste: true
86-
})
75+
.typeText(this.hostInput, parameters.host, { replace: true, paste: true })
76+
.typeText(this.portInput, parameters.port, { replace: true, paste: true })
77+
.typeText(this.databaseAliasInput, parameters.databaseName, { replace: true, paste: true })
8778
if (!!parameters.databaseUsername) {
88-
await t.typeText(this.usernameInput, parameters.databaseUsername, {
89-
replace: true,
90-
paste: true
91-
})
79+
await t.typeText(this.usernameInput, parameters.databaseUsername, { replace: true, paste: true })
9280
}
9381
if (!!parameters.databasePassword) {
94-
await t.typeText(this.passwordInput, parameters.databasePassword, {
95-
replace: true,
96-
paste: true
97-
})
82+
await t.typeText(this.passwordInput, parameters.databasePassword, { replace: true, paste: true })
9883
}
9984
}
10085

@@ -108,29 +93,14 @@ export class AddRedisDatabasePage {
10893
.click(this.addDatabaseButton)
10994
.click(this.addDatabaseManually)
11095
await t
111-
.typeText(this.hostInput, parameters.host, {
112-
replace: true,
113-
paste: true
114-
})
115-
.typeText(this.portInput, parameters.port, {
116-
replace: true,
117-
paste: true
118-
})
119-
.typeText(this.databaseAliasInput, parameters.databaseName, {
120-
replace: true,
121-
paste: true
122-
})
96+
.typeText(this.hostInput, parameters.host, { replace: true, paste: true })
97+
.typeText(this.portInput, parameters.port, { replace: true, paste: true })
98+
.typeText(this.databaseAliasInput, parameters.databaseName, { replace: true, paste: true })
12399
if (!!parameters.databaseUsername) {
124-
await t.typeText(this.usernameInput, parameters.databaseUsername, {
125-
replace: true,
126-
paste: true
127-
})
100+
await t.typeText(this.usernameInput, parameters.databaseUsername, { replace: true, paste: true })
128101
}
129102
if (!!parameters.databasePassword) {
130-
await t.typeText(this.passwordInput, parameters.databasePassword, {
131-
replace: true,
132-
paste: true
133-
})
103+
await t.typeText(this.passwordInput, parameters.databasePassword, { replace: true, paste: true })
134104
}
135105
//Enter logical index
136106
await t.click(this.databaseIndexCheckbox);
@@ -149,22 +119,13 @@ export class AddRedisDatabasePage {
149119
.click(this.addAutoDiscoverDatabase)
150120
.click(this.redisSentinelType)
151121
if (!!parameters.sentinelHost) {
152-
await t.typeText(this.hostInput, parameters.sentinelHost, {
153-
replace: true,
154-
paste: true
155-
})
122+
await t.typeText(this.hostInput, parameters.sentinelHost, { replace: true, paste: true })
156123
}
157124
if (!!parameters.sentinelPort) {
158-
await t.typeText(this.portInput, parameters.sentinelPort, {
159-
replace: true,
160-
paste: true
161-
})
125+
await t.typeText(this.portInput, parameters.sentinelPort, { replace: true, paste: true })
162126
}
163127
if (!!parameters.sentinelPassword) {
164-
await t.typeText(this.passwordInput, parameters.sentinelPassword, {
165-
replace: true,
166-
paste: true
167-
})
128+
await t.typeText(this.passwordInput, parameters.sentinelPassword, { replace: true, paste: true })
168129
}
169130
}
170131

@@ -178,22 +139,10 @@ export class AddRedisDatabasePage {
178139
.click(this.addAutoDiscoverDatabase)
179140
.click(this.redisClusterType)
180141
await t
181-
.typeText(this.hostInput, parameters.host, {
182-
replace: true,
183-
paste: true
184-
})
185-
.typeText(this.portInput, parameters.port, {
186-
replace: true,
187-
paste: true
188-
})
189-
.typeText(this.usernameInput, parameters.databaseUsername, {
190-
replace: true,
191-
paste: true
192-
})
193-
.typeText(this.passwordInput, parameters.databasePassword, {
194-
replace: true,
195-
paste: true
196-
})
142+
.typeText(this.hostInput, parameters.host, { replace: true, paste: true })
143+
.typeText(this.portInput, parameters.port, { replace: true, paste: true })
144+
.typeText(this.usernameInput, parameters.databaseUsername, { replace: true, paste: true })
145+
.typeText(this.passwordInput, parameters.databasePassword, { replace: true, paste: true })
197146
}
198147

199148
/**
@@ -206,14 +155,8 @@ export class AddRedisDatabasePage {
206155
.click(this.addAutoDiscoverDatabase)
207156
.click(this.redisCloudProType)
208157
await t
209-
.typeText(this.accessKeyInput, cloudAPIAccessKey, {
210-
replace: true,
211-
paste: true
212-
})
213-
.typeText(this.secretKeyInput, cloudAPISecretKey, {
214-
replace: true,
215-
paste: true
216-
})
158+
.typeText(this.accessKeyInput, cloudAPIAccessKey, { replace: true, paste: true })
159+
.typeText(this.secretKeyInput, cloudAPISecretKey, { replace: true, paste: true })
217160
}
218161

219162
/**
@@ -225,22 +168,13 @@ export class AddRedisDatabasePage {
225168
.click(this.addDatabaseButton)
226169
.click(this.addDatabaseManually)
227170
if (!!parameters.ossClusterHost) {
228-
await t.typeText(this.hostInput, parameters.ossClusterHost, {
229-
replace: true,
230-
paste: true
231-
})
171+
await t.typeText(this.hostInput, parameters.ossClusterHost, { replace: true, paste: true })
232172
}
233173
if (!!parameters.ossClusterPort) {
234-
await t.typeText(this.portInput, parameters.ossClusterPort, {
235-
replace: true,
236-
paste: true
237-
})
174+
await t.typeText(this.portInput, parameters.ossClusterPort, { replace: true, paste: true })
238175
}
239176
if (!!parameters.ossClusterDatabaseName) {
240-
await t.typeText(this.databaseAliasInput, parameters.ossClusterDatabaseName, {
241-
replace: true,
242-
paste: true
243-
})
177+
await t.typeText(this.databaseAliasInput, parameters.ossClusterDatabaseName, { replace: true, paste: true })
244178
}
245179
}
246180
}

tests/e2e/pageObjects/my-redis-databases-page.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export class MyRedisDatabasePage {
3737
moduleGearsIcon: Selector
3838
moduleTooltip: Selector
3939
moduleQuantifier: Selector
40-
allModules: Selector
4140
modulesOnEditPage: Selector
4241

4342
constructor() {
@@ -73,8 +72,6 @@ export class MyRedisDatabasePage {
7372
this.moduleGearsIcon = Selector('[data-testid^=RedisGears]');
7473
this.moduleTooltip = Selector('.euiToolTipPopover');
7574
this.moduleQuantifier = Selector('[data-testid=_module]');
76-
this.allModules = Selector('.euiToolTipAnchor');
77-
this.modulesOnEditPage = Selector('[]');
7875
// TEXT INPUTS (also referred to as 'Text fields')
7976
this.dbNameList = Selector('[data-testid^=instance-name]');
8077
this.tableRowContent = Selector('[data-test-subj=database-alias-column]');
@@ -115,7 +112,10 @@ export class MyRedisDatabasePage {
115112
}
116113
}
117114

118-
//Delete database by Name
115+
/**
116+
* Delete DB by name
117+
* @param dbName The name of the database to be deleted
118+
*/
119119
async deleteDatabaseByName(dbName: string): Promise<void> {
120120
const dbNames = this.tableRowContent;
121121
const count = await dbNames.count;
@@ -147,11 +147,21 @@ export class MyRedisDatabasePage {
147147

148148
/**
149149
* Check module inside of tooltip
150+
* @param moduleNameList Array with modules list
151+
*/
152+
async checkModulesInTooltip(moduleNameList: Array<string>): Promise<void> {
153+
for (const item of moduleNameList) {
154+
await t.expect(this.moduleTooltip.find('span').withText(`${item} v.`).exists).ok(item)
155+
}
156+
}
157+
158+
/**
159+
* Check module icons on the page
150160
* @param moduleList Array with modules list
151161
*/
152-
async checkModulesInTooltip(moduleList: Array<string>): Promise<void> {
162+
async checkModulesOnPage(moduleList: Array<Selector>): Promise<void> {
153163
for (const item of moduleList) {
154-
await t.expect(this.moduleTooltip.find('span').withText(`${item} v.`).exists).ok(item)
164+
await t.expect(item.visible).ok(`${item} icon`)
155165
}
156166
}
157167
}

tests/e2e/tests/critical-path/database/modules.e2e.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ import { MyRedisDatabasePage } from '../../../pageObjects';
88
import {commonUrl, ossStandaloneRedisearch} from '../../../helpers/conf';
99

1010
const myRedisDatabasePage = new MyRedisDatabasePage();
11-
const moduleList = ['RediSearch', 'RedisGraph', 'RedisBloom', 'RedisJSON', 'RedisAI', 'RedisTimeSeries', 'RedisGears'];
11+
const moduleNameList = ['RediSearch', 'RedisGraph', 'RedisBloom', 'RedisJSON', 'RedisAI', 'RedisTimeSeries', 'RedisGears'];
12+
const moduleList = [myRedisDatabasePage.moduleJSONIcon, myRedisDatabasePage.moduleSearchIcon,
13+
myRedisDatabasePage.moduleTimeseriesIcon, myRedisDatabasePage.moduleBloomIcon, myRedisDatabasePage.moduleGraphIcon,
14+
myRedisDatabasePage.moduleAIIcon, myRedisDatabasePage.moduleGearsIcon];
1215

13-
fixture `Modules`
16+
fixture `Database modules`
1417
.meta({ type: 'critical_path' })
1518
.page(commonUrl)
1619
.beforeEach(async() => {
@@ -27,26 +30,27 @@ test
2730
//Check module column on DB list page
2831
await t.expect(myRedisDatabasePage.moduleColumn.exists).ok('Module column');
2932
//Check that module icons are displayed
30-
await t.expect(myRedisDatabasePage.moduleGraphIcon.exists).ok('Graph icon');
31-
await t.expect(myRedisDatabasePage.moduleBloomIcon.exists).ok('Bloom icon');
32-
await t.expect(myRedisDatabasePage.moduleJSONIcon.exists).ok('JSON icon');
33+
await myRedisDatabasePage.checkModulesOnPage(moduleList);
34+
//Minimize the window to check quantifier
35+
await t.resizeWindow(1000, 700);
3336
//Verify that user can see +N icon (where N>1) on DB list page when modules icons don't fit the Module column width
34-
await t.expect(myRedisDatabasePage.moduleQuantifier.textContent).eql('+4');
37+
await t.expect(myRedisDatabasePage.moduleQuantifier.textContent).eql('+3');
3538
await t.expect(myRedisDatabasePage.moduleQuantifier.exists).ok('Quantifier icon');
3639
//Verify that user can hover over the module icons and see tooltip with all modules name
3740
await t.hover(myRedisDatabasePage.moduleQuantifier);
3841
await t.expect(myRedisDatabasePage.moduleTooltip.visible).ok('Module tooltip');
3942
//Verify that user can hover over the module icons and see tooltip with version.
40-
await myRedisDatabasePage.checkModulesInTooltip(moduleList);
43+
await myRedisDatabasePage.checkModulesInTooltip(moduleNameList);
4144
});
42-
test.skip
45+
test
4346
.meta({ rte: rte.standalone })
4447
('Verify that user can see full module list in the Edit mode', async t => {
45-
//Verify that modules are displayed
46-
await t.expect(myRedisDatabasePage.allModules.exists).ok('Visible module icons');
48+
//Verify that module column is displayed
49+
await t.expect(myRedisDatabasePage.moduleColumn.visible).ok('Module column');
4750
//Open Edit mode
4851
await t.click(myRedisDatabasePage.editDatabaseButton);
49-
await t.expect(myRedisDatabasePage.allModules.exists).notOk('Not visible module icons');
52+
//Verify that module column is not displayed
53+
await t.expect(myRedisDatabasePage.moduleColumn.visible).notOk('Module column');
5054
//Verify modules in Edit mode
51-
await t.expect(myRedisDatabasePage.modulesOnEditPage.exists).ok('Edit modules');
55+
await myRedisDatabasePage.checkModulesOnPage(moduleList);
5256
});

0 commit comments

Comments
 (0)