Skip to content

Commit 4f0918f

Browse files
authored
Merge pull request #1271 from RedisInsight/e2e/feature/RI-3530-reduce-number-of-small-e2e
RI-3530 critical path tests refactoring
2 parents 64fb2a1 + 53ecb6f commit 4f0918f

38 files changed

+1165
-1388
lines changed

tests/e2e/tests/critical-path/browser/bulk-delete.e2e.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,26 @@ test('Verify that user can access the bulk actions screen in the Browser', async
5454
await t.expect(bulkActionsPage.bulkApplyButton.visible).ok('Confirm deletion button not displayed');
5555

5656
});
57-
test('Verify that user can see no pattern selected message when no key type and pattern applied for Bulk Delete', async t => {
57+
test('Verify that user can see summary of scanned level', async t => {
58+
const expectedAmount = new RegExp('Expected amount: ~' + '10 ' + '.');
59+
const scannedKeys = new RegExp('Scanned 5% \\(....10 ...\\) and found ... keys');
5860
const messageTitle = 'No pattern or key type set';
5961
const messageText = 'To perform a bulk action, set the pattern or select the key type';
62+
63+
// Add 10000 Hash keys
64+
await populateDBWithHashes(dbParameters.host, dbParameters.port, keyToAddParameters);
6065
// Open bulk actions
6166
await t.click(browserPage.bulkActionsButton);
67+
// Verify that user can see no pattern selected message when no key type and pattern applied for Bulk Delete
6268
await t.expect(bulkActionsPage.bulkActionsPlaceholder.textContent).contains(messageTitle, 'No pattern title not displayed');
6369
await t.expect(bulkActionsPage.bulkActionsPlaceholder.textContent).contains(messageText, 'No pattern message not displayed');
64-
});
65-
test('Verify that user can see summary of scanned level', async t => {
66-
const expectedAmount = new RegExp('Expected amount: ~' + '10 ' + '.');
67-
const scannedKeys = new RegExp('Scanned 5% \\(....10 ...\\) and found ... keys');
68-
// Add 10000 Hash keys
69-
await populateDBWithHashes(dbParameters.host, dbParameters.port, keyToAddParameters);
7070
// Filter by Hash keys
7171
await browserPage.selectFilterGroupType(KeyTypesTexts.Hash);
72-
// Open bulk actions
73-
await t.click(browserPage.bulkActionsButton);
7472
// Verify that prediction of # of keys matching the filter in the entire database displayed
7573
await t.expect(bulkActionsPage.bulkActionsSummary.textContent).match(expectedAmount, 'Bulk actions summary is not correct');
7674
// Verify that % of total keys scanned, # of keys scanned / total # of keys in the database, # of keys matching the filter displayed
7775
await t.expect(bulkActionsPage.bulkDeleteSummary.innerText).match(scannedKeys, 'Bulk delete summary is not correct');
76+
7877
});
7978
test('Verify that user can see blue progress line during the process of bulk deletion', async t => {
8079
// Add 500000 Hash keys
@@ -136,7 +135,7 @@ test
136135
.before(async() => {
137136
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneRedisearch, ossStandaloneRedisearch.databaseName);
138137
await addSetKeyApi(setKeyParameters, ossStandaloneRedisearch);
139-
//Add 10000 Hash keys
138+
// Add 10000 Hash keys
140139
await populateDBWithHashes(dbParameters.host, dbParameters.port, keyToAddParameters);
141140
// Filter by Hash keys
142141
await browserPage.selectFilterGroupType(KeyTypesTexts.Hash);
@@ -166,10 +165,7 @@ test('Verify that when user clicks on Close button when bulk delete is completed
166165
// Verify context not saved
167166
await t.expect(bulkActionsPage.bulkDeleteCompletedSummary.visible).notOk('Bulk delete completed summary still displayed');
168167
await t.expect(bulkActionsPage.bulkDeleteSummary.textContent).contains('Scanned 100% (2/2) and found 1 keys', 'Bulk delete summary is not correct');
169-
});
170-
test('Verify that when user clicks on cross icon when bulk delete is completed, panel is closed, no context is saved', async t => {
171-
// Filter by Hash keys
172-
await browserPage.selectFilterGroupType(KeyTypesTexts.Hash);
168+
// Verify that when user clicks on cross icon when bulk delete is completed, panel is closed, no context is saved
173169
await bulkActionsPage.startBulkDelete();
174170
await t.click(bulkActionsPage.bulkClosePanelButton);
175171
await t.click(browserPage.bulkActionsButton);
Lines changed: 39 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Chance } from 'chance';
21
import { rte } from '../../../helpers/constants';
32
import { acceptLicenseTermsAndAddDatabaseApi } from '../../../helpers/database';
43
import { BrowserPage, CliPage } from '../../../pageObjects';
@@ -7,15 +6,16 @@ import {
76
ossStandaloneConfig
87
} from '../../../helpers/conf';
98
import { deleteStandaloneDatabaseApi } from '../../../helpers/api/api-database';
9+
import { Common } from '../../../helpers/common';
1010

1111
const browserPage = new BrowserPage();
1212
const cliPage = new CliPage();
13-
const chance = new Chance();
13+
const common = new Common();
1414

15-
let keyName = chance.word({ length: 20 });
16-
let consumerGroupName = chance.word({ length: 20 });
17-
const keyField = chance.word({ length: 20 });
18-
const keyValue = chance.word({ length: 20 });
15+
let keyName = common.generateWord(20);
16+
let consumerGroupName = common.generateWord(20);
17+
const keyField = common.generateWord(20);
18+
const keyValue = common.generateWord(20);
1919
const entryIds = [
2020
'0',
2121
'$',
@@ -29,7 +29,7 @@ fixture `Consumer group`
2929
await acceptLicenseTermsAndAddDatabaseApi(ossStandaloneConfig, ossStandaloneConfig.databaseName);
3030
})
3131
.afterEach(async t => {
32-
//Clear and delete database
32+
// Clear and delete database
3333
if (await browserPage.closeKeyButton.visible) {
3434
await t.click(browserPage.closeKeyButton);
3535
}
@@ -46,69 +46,62 @@ test('Verify that user can create a new Consumer Group in the current Stream', a
4646
'0',
4747
'fetches the entire stream from the beginning.'
4848
];
49-
keyName = chance.word({ length: 20 });
50-
consumerGroupName = `qwerty123456${chance.word({ length: 20 })}!@#$%^&*()_+=`;
49+
keyName = common.generateWord(20);
50+
consumerGroupName = `qwerty123456${common.generateWord(20)}!@#$%^&*()_+=`;
5151
// Add New Stream Key
5252
await browserPage.addStreamKey(keyName, keyField, keyValue);
5353
await t.click(browserPage.fullScreenModeButton);
5454
// Open Stream consumer groups and add group
5555
await t.click(browserPage.streamTabGroups);
5656
await browserPage.createConsumerGroup(consumerGroupName);
57-
await t.expect(browserPage.streamGroupsContainer.textContent).contains(consumerGroupName, 'The new Consumer Group is added');
57+
await t.expect(browserPage.streamGroupsContainer.textContent).contains(consumerGroupName, 'The new Consumer Group is not added');
5858
// Verify the tooltip under 'i' element
5959
await t.click(browserPage.addKeyValueItemsButton);
6060
await t.hover(browserPage.entryIdInfoIcon);
6161
for (const text of toolTip) {
62-
await t.expect(await browserPage.tooltip.innerText).contains(text, 'The toolTip message');
62+
await t.expect(await browserPage.tooltip.innerText).contains(text, 'The toolTip message not displayed');
6363
}
6464
});
6565
test('Verify that user can input the 0, $ and Valid Entry ID in the ID field', async t => {
66-
keyName = chance.word({ length: 20 });
67-
consumerGroupName = chance.word({ length: 20 });
66+
keyName = common.generateWord(20);
67+
consumerGroupName = common.generateWord(20);
6868
// Add New Stream Key
6969
await browserPage.addStreamKey(keyName, keyField, keyValue);
7070
await t.click(browserPage.fullScreenModeButton);
7171
// Open Stream consumer groups and add group with different IDs
7272
await t.click(browserPage.streamTabGroups);
7373
for (const entryId of entryIds) {
7474
await browserPage.createConsumerGroup(`${consumerGroupName}${entryId}`, entryId);
75-
await t.expect(browserPage.streamGroupsContainer.textContent).contains(`${consumerGroupName}${entryId}`, 'The new Consumer Group is added');
75+
await t.expect(browserPage.streamGroupsContainer.textContent).contains(`${consumerGroupName}${entryId}`, 'The new Consumer Group is not added');
7676
}
7777
});
7878
test('Verify that user can see the Consumer group columns (Group Name, Consumers, Pending, Last Delivered ID)', async t => {
79-
keyName = chance.word({ length: 20 });
80-
consumerGroupName = chance.word({ length: 20 });
79+
keyName = common.generateWord(20);
80+
consumerGroupName = common.generateWord(20);
8181
const groupColumns = [
8282
'Group Name',
8383
'Consumers',
8484
'Pending',
8585
'Last Delivered ID'
8686
];
87+
const message = 'Your Consumer Group has no Consumers available.';
88+
8789
// Add New Stream Key
8890
await browserPage.addStreamKey(keyName, keyField, keyValue);
8991
await t.click(browserPage.fullScreenModeButton);
9092
// Open Stream consumer groups and add group with different IDs
9193
await t.click(browserPage.streamTabGroups);
9294
await browserPage.createConsumerGroup(consumerGroupName);
9395
for (let i = 0; i < groupColumns.length; i++) {
94-
await t.expect(browserPage.scoreButton.nth(i).textContent).eql(groupColumns[i], `The ${i} Consumer group column name`);
96+
await t.expect(browserPage.scoreButton.nth(i).textContent).eql(groupColumns[i], `The ${i} Consumer group column name not correct`);
9597
}
96-
});
97-
test('Verify that user can see the message when there are no Consumers in the Consumer Group', async t => {
98-
keyName = chance.word({ length: 20 });
99-
consumerGroupName = chance.word({ length: 20 });
100-
const message = 'Your Consumer Group has no Consumers available.';
101-
// Add New Stream Key
102-
await browserPage.addStreamKey(keyName, keyField, keyValue);
103-
// Open Stream consumer group and check message
104-
await t.click(browserPage.streamTabGroups);
105-
await browserPage.createConsumerGroup(consumerGroupName);
98+
// Verify that user can see the message when there are no Consumers in the Consumer Group
10699
await t.click(browserPage.consumerGroup);
107-
await t.expect(browserPage.streamConsumersContainer.textContent).contains(message, 'The message for empty Consumer Group');
100+
await t.expect(browserPage.streamConsumersContainer.textContent).contains(message, 'The message for empty Consumer Group not displayed');
108101
});
109102
test('Verify that user can see the Consumer information columns (Consumer Name, Pendings, Idle Time,ms)', async t => {
110-
keyName = chance.word({ length: 20 });
111-
consumerGroupName = chance.word({ length: 20 });
103+
keyName = common.generateWord(20);
104+
consumerGroupName = common.generateWord(20);
112105
const cliCommands = [
113106
`XGROUP CREATE ${keyName} ${consumerGroupName} $ MKSTREAM`,
114107
`XADD ${keyName} * message apple`,
@@ -128,33 +121,16 @@ test('Verify that user can see the Consumer information columns (Consumer Name,
128121
await t.click(browserPage.streamTabGroups);
129122
await t.click(browserPage.consumerGroup);
130123
for (let i = 0; i < consumerColumns.length; i++) {
131-
await t.expect(browserPage.scoreButton.nth(i).textContent).eql(consumerColumns[i], `The ${i} Consumers info column name`);
124+
await t.expect(browserPage.scoreButton.nth(i).textContent).eql(consumerColumns[i], `The ${i} Consumers info column name not correct`);
132125
}
133-
});
134-
test('Verify that user can navigate to Consumer Groups screen using the link in the breadcrumbs', async t => {
135-
keyName = chance.word({ length: 20 });
136-
consumerGroupName = chance.word({ length: 20 });
137-
const cliCommands = [
138-
`XGROUP CREATE ${keyName} ${consumerGroupName} $ MKSTREAM`,
139-
`XADD ${keyName} * message apple`,
140-
`XREADGROUP GROUP ${consumerGroupName} Alice COUNT 1 STREAMS ${keyName} >`
141-
];
142-
// Add New Stream Key with groups and consumers
143-
for (const command of cliCommands) {
144-
await cliPage.sendCommandInCli(command);
145-
}
146-
// Open Stream consumer info view
147-
await browserPage.openKeyDetails(keyName);
148-
await t.click(browserPage.streamTabGroups);
149-
await t.click(browserPage.consumerGroup);
150-
// Check navigation
126+
// Verify that user can navigate to Consumer Groups screen using the link in the breadcrumbs
151127
await t.expect(browserPage.streamTabs.visible).ok('Stream navigation tabs visibility');
152128
await t.click(browserPage.streamTabGroups);
153-
await t.expect(browserPage.streamTabGroups.withAttribute('aria-selected', 'true').exists).ok('The Consumer Groups screen is opened');
129+
await t.expect(browserPage.streamTabGroups.withAttribute('aria-selected', 'true').exists).ok('The Consumer Groups screen is not opened');
154130
});
155131
test('Verify that user can delete the Consumer from the Consumer Group', async t => {
156-
keyName = chance.word({ length: 20 });
157-
let consumerGroupName = chance.word({ length: 20 });
132+
keyName = common.generateWord(20);
133+
const consumerGroupName = common.generateWord(20);
158134
const cliCommands = [
159135
`XGROUP CREATE ${keyName} ${consumerGroupName} $ MKSTREAM`,
160136
`XADD ${keyName} * message apple`,
@@ -173,34 +149,13 @@ test('Verify that user can delete the Consumer from the Consumer Group', async t
173149
// Delete consumer and check results
174150
const consumerCountBefore = await browserPage.streamConsumerName.count;
175151
await t.click(browserPage.removeConsumerButton);
176-
await t.expect(browserPage.confirmationMessagePopover.textContent).contains(`will be removed from Consumer Group ${consumerGroupName}`, 'The confirmation message');
152+
await t.expect(browserPage.confirmationMessagePopover.textContent).contains(`will be removed from Consumer Group ${consumerGroupName}`, 'The confirmation message not displayed');
177153
await t.click(browserPage.removeConsumerButton.nth(2));
178-
await t.expect(browserPage.streamConsumerName.count).eql(consumerCountBefore - 1, 'The Consumers number after deletion');
154+
await t.expect(browserPage.streamConsumerName.count).eql(consumerCountBefore - 1, 'The Consumers number after deletion not correct');
179155
});
180156
test('Verify that user can delete a Consumer Group', async t => {
181-
keyName = chance.word({ length: 20 });
182-
let consumerGroupName = chance.word({ length: 20 });
183-
const cliCommands = [
184-
`XGROUP CREATE ${keyName} ${consumerGroupName} $ MKSTREAM`,
185-
`XADD ${keyName} * message apple`,
186-
`XREADGROUP GROUP ${consumerGroupName} Alice COUNT 1 STREAMS ${keyName} >`
187-
];
188-
// Add New Stream Key with groups and consumers
189-
for (const command of cliCommands) {
190-
await cliPage.sendCommandInCli(command);
191-
}
192-
// Open Stream consumer info view
193-
await browserPage.openKeyDetails(keyName);
194-
await t.click(browserPage.streamTabGroups);
195-
// Delete consumer group and check results
196-
await t.click(browserPage.removeConsumerGroupButton);
197-
await t.expect(browserPage.confirmationMessagePopover.textContent).contains(`${consumerGroupName}and all its consumers will be removed from ${keyName}`, 'The confirmation message');
198-
await t.click(browserPage.removeConsumerGroupButton.nth(1));
199-
await t.expect(browserPage.streamGroupsContainer.textContent).contains('Your Key has no Consumer Groups available.', 'The Consumer Group is removed from the table');
200-
});
201-
test('Verify that user can change the ID set for the Consumer Group when click on the Pencil button', async t => {
202-
keyName = chance.word({ length: 20 });
203-
let consumerGroupName = chance.word({ length: 20 });
157+
keyName = common.generateWord(20);
158+
const consumerGroupName = common.generateWord(20);
204159
const cliCommands = [
205160
`XGROUP CREATE ${keyName} ${consumerGroupName} $ MKSTREAM`,
206161
`XADD ${keyName} * message apple`,
@@ -213,12 +168,17 @@ test('Verify that user can change the ID set for the Consumer Group when click o
213168
// Open Stream consumer info view
214169
await browserPage.openKeyDetails(keyName);
215170
await t.click(browserPage.streamTabGroups);
216-
// Change the ID set for the Consumer Group
171+
// Verify that user can change the ID set for the Consumer Group when click on the Pencil button
217172
for (const id of entryIds) {
218173
const idBefore = await browserPage.streamGroupId.textContent;
219174
await t.click(browserPage.editStreamLastIdButton);
220175
await t.typeText(browserPage.lastIdInput, id, { replace: true });
221176
await t.click(browserPage.saveButton);
222-
await t.expect(browserPage.streamGroupId.textContent).notEql(idBefore, 'The last delivered ID is modified and the table is reloaded');
177+
await t.expect(browserPage.streamGroupId.textContent).notEql(idBefore, 'The last delivered ID is modified and the table is not reloaded');
223178
}
179+
// Delete consumer group and check results
180+
await t.click(browserPage.removeConsumerGroupButton);
181+
await t.expect(browserPage.confirmationMessagePopover.textContent).contains(`${consumerGroupName}and all its consumers will be removed from ${keyName}`, 'The confirmation message not displayed');
182+
await t.click(browserPage.removeConsumerGroupButton.nth(1));
183+
await t.expect(browserPage.streamGroupsContainer.textContent).contains('Your Key has no Consumer Groups available.', 'The Consumer Group is not removed from the table');
224184
});

0 commit comments

Comments
 (0)