Skip to content

Commit 005f1fe

Browse files
Merge pull request #322 from RedisInsight/feature/e2e-regression
e2e - regression tests
2 parents 56e0c1a + 6eb42be commit 005f1fe

File tree

9 files changed

+206
-32
lines changed

9 files changed

+206
-32
lines changed

redisinsight/ui/src/components/instance-header/InstanceHeader.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const InstanceHeader = () => {
4545
<div className={cx(styles.container)}>
4646
<EuiFlexGroup gutterSize="none" responsive={false}>
4747
<EuiFlexItem style={{ overflow: 'hidden' }}>
48-
<div className={styles.breadcrumbsContainer}>
48+
<div className={styles.breadcrumbsContainer} data-testid="breadcrumbs-container">
4949
<div>
5050
<EuiToolTip
5151
position="bottom"
@@ -57,6 +57,7 @@ const InstanceHeader = () => {
5757
iconSize="l"
5858
iconType="sortLeft"
5959
aria-label="My Redis databases"
60+
data-testid="my-redis-db-icon"
6061
onClick={goHome}
6162
/>
6263
</EuiToolTip>

tests/e2e/pageObjects/browser-page.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export class BrowserPage {
124124
treeViewMessage: Selector
125125
totalKeysNumber: Selector
126126
keysScanned: Selector
127+
breadcrumbsContainer: Selector
127128
databaseInfoIcon: Selector
128129
databaseInfoToolTip: Selector
129130
removeHashFieldButton: Selector
@@ -250,6 +251,7 @@ export class BrowserPage {
250251
this.overviewCommandsSec = Selector('[data-test-subj=overview-commands-sec]');
251252
this.overviewCpu = Selector('[data-test-subj=overview-cpu]');
252253
this.selectedFilterTypeString = Selector('[data-testid=filter-option-type-selected-string]');
254+
this.breadcrumbsContainer = Selector('[data-testid=breadcrumbs-container]');
253255
this.treeViewArea = Selector('');
254256
this.treeViewScannedValue = Selector('');
255257
this.treeViewKeysNumber = Selector('');

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ export class MyRedisDatabasePage {
2121
deleteButtonInPopover: Selector
2222
confirmDeleteAllDbButton: Selector
2323
browserButton: Selector
24+
editDatabaseButton: Selector
25+
editAliasButton: Selector
26+
aliasInput: Selector
27+
applyButton: Selector
28+
submitChangesButton: Selector
2429
databaseInfoMessage: Selector;
2530

2631
constructor() {
@@ -42,13 +47,22 @@ export class MyRedisDatabasePage {
4247
this.selectAllCheckbox = Selector('[data-test-subj=checkboxSelectAll]');
4348
this.deleteButtonInPopover = Selector('#deletePopover button');
4449
this.confirmDeleteAllDbButton = Selector('[data-testid=delete-selected-dbs]');
50+
this.editDatabaseButton = Selector('[data-testid^=edit-instance]');
51+
this.editAliasButton = Selector('[data-testid=edit-alias-btn]');
52+
this.applyButton = Selector('[data-testid=apply-btn]');
53+
this.submitChangesButton = Selector('[data-testid=btn-submit]');
4554
// TEXT INPUTS (also referred to as 'Text fields')
4655
this.dbNameList = Selector('[data-testid^=instance-name]');
4756
this.tableRowContent = Selector('[data-test-subj=database-alias-column]');
4857
this.databaseInfoMessage = Selector('[data-test-subj=euiToastHeader]');
4958
this.hostPort = Selector('[data-testid=host-port]');
59+
this.aliasInput = Selector('[data-testid=alias-input]');
5060
}
5161

62+
/**
63+
* Click on the database by name
64+
* @param dbName The name of the database to be opened
65+
*/
5266
async clickOnDBByName(dbName: string): Promise<void>{
5367
if (await this.toastCloseButton.exists) {
5468
await t.click(this.toastCloseButton);
@@ -90,4 +104,20 @@ export class MyRedisDatabasePage {
90104
}
91105
}
92106
}
107+
108+
/**
109+
* Click on the edit database button by name
110+
* @param databaseName The name of the database to be edited
111+
*/
112+
async clickOnEditDBByName(databaseName: string): Promise<void>{
113+
const dbNames = this.tableRowContent;
114+
const count = await dbNames.count;
115+
116+
for(let i = 0; i < count; i++) {
117+
if((await dbNames.nth(i).innerText || '').includes(databaseName)) {
118+
await t.click(this.editDatabaseButton.nth(i));
119+
break;
120+
}
121+
}
122+
}
93123
}

tests/e2e/tests/critical-path/monitor/monitor.e2e.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,26 @@ import {
1010
commonUrl,
1111
ossStandaloneConfig
1212
} from '../../../helpers/conf';
13-
import { getRandomKeyName } from '../../../helpers/keys';
14-
import { rte, env } from '../../../helpers/constants';
13+
import { rte } from '../../../helpers/constants';
14+
import { Chance } from 'chance';
1515

1616
const myRedisDatabasePage = new MyRedisDatabasePage();
1717
const cliPage = new CliPage();
1818
const monitorPage = new MonitorPage();
1919
const workbenchPage = new WorkbenchPage();
2020
const browserPage = new BrowserPage();
21-
const keyName = `${getRandomKeyName(10)}-key`;
22-
const keyValue = `${getRandomKeyName(10)}-value`;
21+
const chance = new Chance();
22+
23+
const keyName = `${chance.word({ length: 20 })}-key`;
24+
const keyValue = `${chance.word({ length: 10 })}-value`;
2325

2426
fixture `Monitor`
2527
.meta({ type: 'critical_path' })
2628
.page(commonUrl)
27-
.beforeEach(async t => {
29+
.beforeEach(async() => {
2830
await acceptLicenseTermsAndAddDatabase(ossStandaloneConfig, ossStandaloneConfig.databaseName);
2931
})
30-
.afterEach(async t => {
32+
.afterEach(async() => {
3133
await deleteDatabase(ossStandaloneConfig.databaseName);
3234
})
3335
test
@@ -45,7 +47,7 @@ test
4547
await t.expect(monitorPage.startMonitorButton.exists).ok('Start profiler button');
4648
//Verify that user can see message inside Monitor "Running Monitor will decrease throughput, avoid running it in production databases." when opens it for the first time
4749
await t.expect(monitorPage.monitorWarningMessage.exists).ok('Profiler warning message');
48-
await monitorPage.monitorWarningMessage.withText('Running Profiler will decrease throughput, avoid running it in production databases');
50+
await t.expect(monitorPage.monitorWarningMessage.withText('Running Profiler will decrease throughput, avoid running it in production databases').exists).ok('Profiler warning message is correct');
4951
//Verify that user can run Monitor by clicking "Run" command in the message inside Monitor
5052
await t.click(monitorPage.startMonitorButton);
5153
await t.expect(monitorPage.monitorIsStartedText.innerText).eql('Profiler is started.');

tests/e2e/tests/regression/browser/database-overview.e2e.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { acceptLicenseTermsAndAddDatabase, deleteDatabase } from '../../../helpe
22
import {
33
MyRedisDatabasePage,
44
CliPage,
5-
WorkbenchPage
5+
WorkbenchPage,
6+
BrowserPage
67
} from '../../../pageObjects';
78
import { rte } from '../../../helpers/constants';
89
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
@@ -12,6 +13,7 @@ const myRedisDatabasePage = new MyRedisDatabasePage();
1213
const workbenchPage = new WorkbenchPage();
1314
const cliPage = new CliPage();
1415
const common = new Common();
16+
const browserPage = new BrowserPage();
1517

1618
let keys: string[];
1719

@@ -38,3 +40,15 @@ test
3840
await t.expect(workbenchPage.overviewTotalKeys.exists).ok('User can see total keys');
3941
await t.expect(workbenchPage.overviewTotalMemory.exists).ok('User can see total memory');
4042
});
43+
test
44+
.meta({ rte: rte.standalone })
45+
.after(async () => {
46+
//Delete database
47+
await deleteDatabase(ossStandaloneConfig.databaseName);
48+
})
49+
('Verify that user can connect to DB and see breadcrumbs at the top of the application', async t => {
50+
//Verify that user can see breadcrumbs in Browser and Workbench views
51+
await t.expect(browserPage.breadcrumbsContainer.visible).ok('User can see breadcrumbs in Browser page', { timeout: 20000 });
52+
await t.click(myRedisDatabasePage.workbenchButton);
53+
await t.expect(browserPage.breadcrumbsContainer.visible).ok('User can see breadcrumbs in Workbench page', { timeout: 20000 });
54+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { rte } from '../../../helpers/constants';
2+
import { acceptLicenseTerms } from '../../../helpers/database';
3+
import { MyRedisDatabasePage, SettingsPage } from '../../../pageObjects';
4+
import { commonUrl } from '../../../helpers/conf';
5+
6+
const myRedisDatabasePage = new MyRedisDatabasePage();
7+
const settingsPage = new SettingsPage();
8+
9+
const explicitErrorHandler = (): void => {
10+
window.addEventListener('error', e => {
11+
if(e.message === 'ResizeObserver loop limit exceeded') {
12+
e.stopImmediatePropagation();
13+
}
14+
})
15+
}
16+
17+
fixture `Browser - Specify Keys to Scan`
18+
.meta({type: 'regression'})
19+
.page(commonUrl)
20+
.clientScripts({ content: `(${explicitErrorHandler.toString()})()` })
21+
.beforeEach(async () => {
22+
await acceptLicenseTerms();
23+
})
24+
test
25+
.meta({ rte: rte.none })
26+
('Verify that the user not enter the value less than 500 - the system automatically applies min value if user enters less than min', async t => {
27+
//Go to Settings page
28+
await t.click(myRedisDatabasePage.settingsButton);
29+
//Specify keys to scan less than 500
30+
await t.click(settingsPage.accordionAdvancedSettings);
31+
await settingsPage.changeKeysToScanValue('100');
32+
//Verify the applyed scan value
33+
await t.expect(await settingsPage.keysToScanValue.textContent).eql('500', 'The system automatically applies min value 500');
34+
});

tests/e2e/tests/regression/cli/cli.e2e.ts

Lines changed: 62 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const chance = new Chance();
1414
const browserPage = new BrowserPage();
1515

1616
let keyName = chance.word({ length: 20 });
17+
const keyTTL = '2147476121';
18+
const jsonValue = '{"name":"xyz"}';
1719

1820
fixture `CLI`
1921
.meta({ type: 'regression' })
@@ -25,28 +27,32 @@ fixture `CLI`
2527
//Delete database
2628
await deleteDatabase(ossStandaloneConfig.databaseName);
2729
})
28-
test('Verify that user can see CLI is minimized when he clicks the "minimize" button', async t => {
29-
const cliColourBefore = await common.getBackgroundColour(cliPage.cliBadge);
30-
//Open CLI and minimize
31-
await t.click(cliPage.cliExpandButton);
32-
await t.click(cliPage.minimizeCliButton);
33-
//Verify cli is minimized
34-
const cliColourAfter = await common.getBackgroundColour(cliPage.cliBadge);
35-
await t.expect(cliColourAfter).notEql(cliColourBefore, 'CLI badge colour is changed');
36-
await t.expect(cliPage.minimizeCliButton.visible).eql(false, 'CLI is mimized');
37-
});
38-
test('Verify that user can see results history when he re-opens CLI after minimizing', async t => {
39-
const command = 'SET key';
40-
//Open CLI and run commands
41-
await t.click(cliPage.cliExpandButton);
42-
await t.typeText(cliPage.cliCommandInput, command);
43-
await t.pressKey('enter');
44-
//Minimize and re-open cli
45-
await t.click(cliPage.minimizeCliButton);
46-
await t.click(cliPage.cliExpandButton);
47-
//Verify cli results history
48-
await t.expect(cliPage.cliCommandExecuted.textContent).eql(command, 'CLI results history persists after reopening');
49-
});
30+
test
31+
.meta({ rte: rte.standalone })
32+
('Verify that user can see CLI is minimized when he clicks the "minimize" button', async t => {
33+
const cliColourBefore = await common.getBackgroundColour(cliPage.cliBadge);
34+
//Open CLI and minimize
35+
await t.click(cliPage.cliExpandButton);
36+
await t.click(cliPage.minimizeCliButton);
37+
//Verify cli is minimized
38+
const cliColourAfter = await common.getBackgroundColour(cliPage.cliBadge);
39+
await t.expect(cliColourAfter).notEql(cliColourBefore, 'CLI badge colour is changed');
40+
await t.expect(cliPage.minimizeCliButton.visible).eql(false, 'CLI is mimized');
41+
});
42+
test
43+
.meta({ rte: rte.standalone })
44+
('Verify that user can see results history when he re-opens CLI after minimizing', async t => {
45+
const command = 'SET key';
46+
//Open CLI and run commands
47+
await t.click(cliPage.cliExpandButton);
48+
await t.typeText(cliPage.cliCommandInput, command);
49+
await t.pressKey('enter');
50+
//Minimize and re-open cli
51+
await t.click(cliPage.minimizeCliButton);
52+
await t.click(cliPage.cliExpandButton);
53+
//Verify cli results history
54+
await t.expect(cliPage.cliCommandExecuted.textContent).eql(command, 'CLI results history persists after reopening');
55+
});
5056
test
5157
.meta({ rte: rte.standalone })
5258
('Verify that user can see CLI is minimized when he clicks the "minimize" button', async t => {
@@ -81,7 +87,7 @@ test
8187
await deleteDatabase(ossStandaloneConfig.databaseName);
8288
})
8389
('Verify that user can repeat commands by entering a number of repeats before the Redis command in CLI', async t => {
84-
chance.word({ length: 20 });
90+
keyName = chance.word({ length: 20 });
8591
const command = `SET ${keyName} a`;
8692
const repeats = 10;
8793
//Open CLI and run command with repeats
@@ -91,3 +97,36 @@ test
9197
//Verify result
9298
await t.expect(cliPage.cliOutputResponseSuccess.count).eql(repeats, `CLI contains ${repeats} results`);
9399
});
100+
test
101+
.meta({ rte: rte.standalone })
102+
.after(async () => {
103+
//Clear database and delete
104+
await browserPage.deleteKeyByName(keyName);
105+
await deleteDatabase(ossStandaloneConfig.databaseName);
106+
})
107+
('Verify that user can run command json.get and see JSON object with escaped quotes (\" instead of ")', async t => {
108+
keyName = chance.word({ length: 20 });
109+
const jsonValueCli = '"{\\"name\\":\\"xyz\\"}"';
110+
//Add Json key with json object
111+
await browserPage.addJsonKey(keyName, keyTTL, jsonValue);
112+
const command = `JSON.GET ${keyName}`;
113+
//Open CLI and run command
114+
await t.click(cliPage.cliExpandButton);
115+
await t.typeText(cliPage.cliCommandInput, command);
116+
await t.pressKey('enter');
117+
//Verify result
118+
//const commandResult = jsonValue.replace(/"/g, '\\"');
119+
await t.expect(cliPage.cliOutputResponseSuccess.innerText).eql(jsonValueCli, 'The user can see JSON object with escaped quotes');
120+
});
121+
test
122+
.meta({ rte: rte.standalone })
123+
.after(async () => {
124+
//Delete database
125+
await deleteDatabase(ossStandaloneConfig.databaseName);
126+
})
127+
('Verify that user can see DB endpoint in the header of CLI', async t => {
128+
const databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}`;
129+
//Open CLI and check endpoint
130+
await t.click(cliPage.cliExpandButton);
131+
await t.expect(cliPage.cliEndpoint.textContent).eql(databaseEndpoint, 'The user can see DB endpoint in the header of CLI');
132+
});
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { acceptLicenseTermsAndAddDatabase, deleteDatabase } from '../../../helpers/database';
2+
import { MyRedisDatabasePage } from '../../../pageObjects';
3+
import {
4+
commonUrl,
5+
ossStandaloneConfig
6+
} from '../../../helpers/conf';
7+
import { rte } from '../../../helpers/constants';
8+
import { Chance } from 'chance';
9+
10+
const chance = new Chance();
11+
const myRedisDatabasePage = new MyRedisDatabasePage();
12+
13+
const newDatabaseName = chance.word({ length: 10 });
14+
15+
fixture `List of Databases`
16+
.meta({ type: 'regression' })
17+
.page(commonUrl)
18+
.beforeEach(async () => {
19+
await acceptLicenseTermsAndAddDatabase(ossStandaloneConfig, ossStandaloneConfig.databaseName);
20+
})
21+
test
22+
.meta({ rte: rte.standalone })
23+
.after(async () => {
24+
//Delete database
25+
await deleteDatabase(newDatabaseName);
26+
})
27+
('Verify that user can edit DB alias of Standalone DB', async t => {
28+
await t.click(myRedisDatabasePage.myRedisDBButton);
29+
//Edit alias of added database
30+
await myRedisDatabasePage.clickOnEditDBByName(ossStandaloneConfig.databaseName);
31+
await t.click(myRedisDatabasePage.editAliasButton);
32+
await t.typeText(myRedisDatabasePage.aliasInput, newDatabaseName, { replace: true });
33+
await t.click(myRedisDatabasePage.applyButton);
34+
await t.click(myRedisDatabasePage.submitChangesButton);
35+
//Verify that database has new alias
36+
await t.expect(myRedisDatabasePage.dbNameList.withExactText(newDatabaseName).exists).ok('The database with new alias is in the list', { timeout: 60000 });
37+
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossStandaloneConfig.databaseName).exists).notOk('The database with previous alias is not in the list', { timeout: 60000 });
38+
});

tests/e2e/tests/regression/workbench/scripting-area.e2e.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,17 @@ test
135135
//Check the command result
136136
await workbenchPage.checkWorkbenchCommandResult(command, result);
137137
});
138+
test
139+
.meta({ rte: rte.standalone })
140+
.after(async() => {
141+
//Delete database
142+
await deleteDatabase(ossStandaloneConfig.databaseName);
143+
})
144+
('Verify that user can use Ctrl + Enter to run the query in Workbench', async t => {
145+
const command = 'FT._LIST';
146+
//Type command and use Ctrl + Enter
147+
await t.typeText(workbenchPage.queryInput, command, { replace: true });
148+
await t.pressKey('ctrl+enter');
149+
//Check that command is in results
150+
await t.expect(await workbenchPage.queryCardCommand.withExactText(command).exists).ok('The user can use Ctrl + Enter to run the query');
151+
});

0 commit comments

Comments
 (0)