Skip to content

Commit f2954d3

Browse files
authored
Merge pull request #557 from RedisInsight/bugfix/e2e
[E2E] Fix monitor tests
2 parents d9b2072 + 42a7e25 commit f2954d3

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Chance } from 'chance';
12
import { acceptLicenseTermsAndAddDatabase, deleteDatabase } from '../../../helpers/database';
23
import {
34
MyRedisDatabasePage,
@@ -11,7 +12,6 @@ import {
1112
ossStandaloneConfig
1213
} from '../../../helpers/conf';
1314
import { rte } from '../../../helpers/constants';
14-
import { Chance } from 'chance';
1515

1616
const myRedisDatabasePage = new MyRedisDatabasePage();
1717
const cliPage = new CliPage();
@@ -31,14 +31,13 @@ fixture `Monitor`
3131
})
3232
.afterEach(async() => {
3333
await deleteDatabase(ossStandaloneConfig.databaseName);
34-
})
34+
});
3535
test
3636
.meta({ rte: rte.standalone })
37-
.after(async () => {
37+
.after(async() => {
3838
await browserPage.deleteKeyByName(keyName);
3939
await deleteDatabase(ossStandaloneConfig.databaseName);
40-
})
41-
('Verify that user can work with Monitor', async t => {
40+
})('Verify that user can work with Monitor', async t => {
4241
const command = 'set';
4342
//Verify that user can open Monitor
4443
await t.click(monitorPage.expandMonitor);
@@ -56,17 +55,14 @@ test
5655
await monitorPage.checkCommandInMonitorResults(command, [keyName, keyValue]);
5756
});
5857
test
59-
.meta({ rte: rte.standalone })
60-
('Verify that user can see the list of all commands from all clients ran for this Redis database in the list of results in Monitor', async t => {
58+
.meta({ rte: rte.standalone })('Verify that user can see the list of all commands from all clients ran for this Redis database in the list of results in Monitor', async t => {
6159
//Define commands in different clients
6260
const cli_command = 'command';
6361
const workbench_command = 'hello';
6462
const common_command = 'info';
6563
const browser_command = 'dbsize';
66-
//Expand Monitor panel
67-
await t.click(monitorPage.expandMonitor);
68-
//Start monitor (using run button in header)
69-
await t.click(monitorPage.runMonitorToggle);
64+
//Start Monitor
65+
await monitorPage.startMonitor();
7066
//Send command in CLI
7167
await cliPage.getSuccessCommandResultFromCli(cli_command);
7268
//Check that command from CLI is displayed in monitor

tests/e2e/tests/regression/monitor/monitor.e2e.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ test
5252
//Click on Stop Monitor button
5353
await t.click(monitorPage.runMonitorToggle);
5454
//Check for "Monitor is stopped." text
55-
await t.expect(monitorPage.monitorIsStoppedText.innerText).eql('Profiler is stopped.');
56-
//Check that no commands are displayed after "Monitor is stopped" text
57-
await t.expect(monitorPage.monitorIsStoppedText.nextSibling().exists).notOk('No commands in monitor');
55+
await t.expect(monitorPage.monitorIsStoppedText.innerText).eql('Profiler is paused.', 'Paused profiler message');
56+
//Get the last log line
57+
const lastTimestamp = await monitorPage.monitorCommandLineTimestamp.nth(-1).textContent;
58+
//Click on refresh keys to get new logs
59+
await t.click(browserPage.refreshKeysButton);
60+
//Check that no commands are displayed after monitor paused
61+
await t.expect(monitorPage.monitorCommandLineTimestamp.nth(-1).textContent).eql(lastTimestamp, 'The last line of monitor logs');
5862
});
5963
test
6064
.meta({ rte: rte.standalone })('Verify that when user refreshes the page the list of results in Monitor is not saved', async t => {
@@ -72,12 +76,16 @@ test
7276
.meta({ rte: rte.standalone })('Verify that when user clicks on "Clear" button in Monitor, all commands history is removed', async t => {
7377
//Run monitor
7478
await monitorPage.startMonitor();
79+
//Click on refresh keys to get new logs
80+
await t.click(browserPage.refreshKeysButton);
81+
//Get last timestamp
82+
const lastTimestamp = await monitorPage.monitorCommandLineTimestamp.nth(-1);
7583
//Stop Monitor
7684
await monitorPage.stopMonitor();
7785
//Click on Clear button
7886
await t.click(monitorPage.clearMonitorButton);
79-
//Check that monitor has start screen
80-
await t.expect(monitorPage.startMonitorButton.exists).ok('Start monitor button');
87+
//Check that monitor screen is cleared
88+
await t.expect(lastTimestamp.exists).notOk('Cleared last line');
8189
});
8290
test
8391
.meta({ rte: rte.standalone })

0 commit comments

Comments
 (0)