-
Notifications
You must be signed in to change notification settings - Fork 405
[E2E] Monitor tests are added #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
64a39ad
[E2E] Monitor tests are added
elenaNaboko d5859fa
[E2E] Fix monitor tests
elenaNaboko eebf68c
[E2E] Add Stop Monitor test
elenaNaboko 8e211bb
[E2E] Clear and stop monitor tests are added
elenaNaboko ad9db13
[E2E] HTTP/HTTPS error fix for Monitor
elenaNaboko 598a718
[E2E] Run Monitor tests only
elenaNaboko e9deb65
Merge branch 'feature/RI-1227_monitor' into feature/e2e-monitor
elenaNaboko 11fe5cc
Merge branch 'feature/RI-1227_monitor' into feature/e2e-monitor
elenaNaboko 103ee6a
Merge branch 'bugfix/fix_base_urls_for_various_builds' into feature/e…
2df7f64
Merge branch 'feature/e2e-monitor' of https://github.com/RedisInsight…
elenaNaboko e6fe95f
Merge branch 'feature/RI-1227_monitor' into feature/e2e-monitor
elenaNaboko 3e81acb
[E2E] Monitor test with high DB load
elenaNaboko 027a309
[E2E] Rename Monitor into Profiler in tests
elenaNaboko e871621
[E2E] New oss big standalone is added
elenaNaboko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import {Selector, t} from 'testcafe'; | ||
|
||
export class MonitorPage { | ||
|
||
//------------------------------------------------------------------------------------------ | ||
//DECLARATION OF TYPES: DOM ELEMENTS and UI COMPONENTS | ||
//*Assign the 'Selector' type to any element/component nested within the constructor. | ||
//------------------------------------------------------------------------------------------ | ||
|
||
expandMonitor: Selector | ||
monitorArea: Selector | ||
runMonitorToggle: Selector | ||
startMonitorButton: Selector | ||
clearMonitorButton: Selector | ||
monitorIsStoppedText: Selector | ||
monitorIsStartedText: Selector | ||
hideMonitor: Selector | ||
closeMonitor: Selector | ||
monitorWarningMessage: Selector | ||
monitorCommandLinePart: Selector | ||
monitorCommandLineTimestamp: Selector | ||
|
||
constructor() { | ||
//------------------------------------------------------------------------------------------- | ||
//DECLARATION OF SELECTORS | ||
//*Declare all elements/components of the relevant page. | ||
//*Target any element/component via data-id, if possible! | ||
//*The following categories are ordered alphabetically (Alerts, Buttons, Checkboxes, etc.). | ||
//------------------------------------------------------------------------------------------- | ||
//BUTTONS | ||
this.expandMonitor = Selector('[data-testid=expand-monitor]'); | ||
this.monitorArea = Selector('[data-testid=monitor]'); | ||
this.runMonitorToggle = Selector('[data-testid=toggle-run-monitor]'); | ||
this.startMonitorButton = Selector('[data-testid=start-monitor]'); | ||
this.clearMonitorButton = Selector('[data-testid=clear-monitor]'); | ||
this.monitorIsStoppedText = Selector('[data-testid=monitor-stopped]'); | ||
this.monitorIsStartedText = Selector('[data-testid=monitor-started]'); | ||
this.hideMonitor = Selector('[data-testid=hide-monitor]'); | ||
this.closeMonitor = Selector('[data-testid=close-monitor]'); | ||
this.monitorWarningMessage = Selector('[data-testid=monitor-warning-message]'); | ||
this.monitorCommandLinePart = Selector('[data-testid=monitor] span'); | ||
this.monitorCommandLineTimestamp = Selector('[data-testid=monitor] span').withText(/[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}/); | ||
} | ||
/** | ||
* Check specific command in Monitor | ||
* @param command A command which should be displayed in monitor | ||
* @param parameters An arguments which should be displayed in monitor | ||
*/ | ||
async checkCommandInMonitorResults(command: string, parameters?: string[]): Promise<void> { | ||
const commandArray = command.split(' '); | ||
for (const value of commandArray) { | ||
await t.expect(this.monitorCommandLinePart.withText(value).exists).ok({timeout: 6000}); | ||
} | ||
if (!!parameters) { | ||
for (const argument of parameters) { | ||
await t.expect(this.monitorCommandLinePart.withText(argument).exists).ok({timeout: 6000}); | ||
} | ||
} | ||
} | ||
/** | ||
* Start monitor function | ||
*/ | ||
async startMonitor(): Promise<void> { | ||
await t.click(this.expandMonitor); | ||
await t.click(this.startMonitorButton); | ||
//Check for "info" command that is sent automatically every 5 seconds from BE side | ||
await this.checkCommandInMonitorResults('info'); | ||
} | ||
/** | ||
* Stop monitor function | ||
*/ | ||
async stopMonitor(): Promise<void> { | ||
await t.click(this.runMonitorToggle); | ||
await t.expect(this.monitorIsStoppedText.exists).ok('Profiler is stopped text'); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { addNewStandaloneDatabase } from '../../../helpers/database'; | ||
import { | ||
MyRedisDatabasePage, | ||
UserAgreementPage, | ||
AddRedisDatabasePage, | ||
CliPage, | ||
MonitorPage, | ||
WorkbenchPage, | ||
BrowserPage | ||
} from '../../../pageObjects'; | ||
import { | ||
commonUrl, | ||
ossStandaloneConfig | ||
} from '../../../helpers/conf'; | ||
import { getRandomKeyName } from '../../../helpers/keys'; | ||
|
||
const myRedisDatabasePage = new MyRedisDatabasePage(); | ||
const userAgreementPage = new UserAgreementPage(); | ||
const addRedisDatabasePage = new AddRedisDatabasePage(); | ||
const cliPage = new CliPage(); | ||
const monitorPage = new MonitorPage(); | ||
const workbenchPage = new WorkbenchPage(); | ||
const browserPage = new BrowserPage(); | ||
const keyName = `${getRandomKeyName(10)}-key`; | ||
const keyValue = `${getRandomKeyName(10)}-value`; | ||
|
||
fixture.only `Monitor` | ||
.meta({ type: 'critical_path' }) | ||
.page(commonUrl) | ||
.beforeEach(async t => { | ||
await t.maximizeWindow(); | ||
await userAgreementPage.acceptLicenseTerms(); | ||
await t.expect(addRedisDatabasePage.addDatabaseButton.exists).ok('The add redis database view', { timeout: 20000 }); | ||
await addNewStandaloneDatabase(ossStandaloneConfig); | ||
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName); | ||
}) | ||
.afterEach(async t => { | ||
await t.click(myRedisDatabasePage.myRedisDBButton); | ||
await myRedisDatabasePage.deleteDatabaseByName(ossStandaloneConfig.databaseName); | ||
}) | ||
test | ||
.after(async t => { | ||
await browserPage.deleteKeyByName(keyName); | ||
await t.click(myRedisDatabasePage.myRedisDBButton); | ||
await myRedisDatabasePage.deleteDatabaseByName(ossStandaloneConfig.databaseName); | ||
}) | ||
('Verify that user can work with Monitor', async t => { | ||
const command = 'set'; | ||
//Verify that user can open Monitor | ||
await t.click(monitorPage.expandMonitor); | ||
//Check that monitor is opened | ||
await t.expect(monitorPage.monitorArea.exists).ok('Profiler area'); | ||
await t.expect(monitorPage.startMonitorButton.exists).ok('Start profiler button'); | ||
//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 | ||
await t.expect(monitorPage.monitorWarningMessage.exists).ok('Profiler warning message'); | ||
await monitorPage.monitorWarningMessage.withText('Running Profiler will decrease throughput, avoid running it in production databases'); | ||
//Verify that user can run Monitor by clicking "Run" command in the message inside Monitor | ||
await t.click(monitorPage.startMonitorButton); | ||
await t.expect(monitorPage.monitorIsStartedText.innerText).eql('Profiler is started.'); | ||
//Verify that user can see run commands in monitor | ||
await cliPage.getSuccessCommandResultFromCli(`${command} ${keyName} ${keyValue}`); | ||
await monitorPage.checkCommandInMonitorResults(command, [keyName, keyValue]); | ||
}); | ||
test('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 => { | ||
//Define commands in different clients | ||
const cli_command = 'command'; | ||
const workbench_command = 'hello'; | ||
const common_command = 'info'; | ||
const browser_command = 'dbsize'; | ||
//Expand Monitor panel | ||
await t.click(monitorPage.expandMonitor); | ||
//Start monitor (using run button in header) | ||
await t.click(monitorPage.runMonitorToggle); | ||
//Send command in CLI | ||
await cliPage.getSuccessCommandResultFromCli(cli_command); | ||
//Check that command from CLI is displayed in monitor | ||
await monitorPage.checkCommandInMonitorResults(cli_command); | ||
//Refresh the page to send command from Browser client | ||
await t.click(browserPage.refreshKeysButton); | ||
//Check the command from browser client | ||
await monitorPage.checkCommandInMonitorResults(browser_command); | ||
//Open Workbench page to create new client | ||
await t.click(myRedisDatabasePage.workbenchButton); | ||
//Send command in Workbench | ||
await workbenchPage.sendCommandInWorkbench(workbench_command); | ||
//Check that command from Workbench is displayed in monitor | ||
await monitorPage.checkCommandInMonitorResults(workbench_command); | ||
//Check the command from common client | ||
await monitorPage.checkCommandInMonitorResults(common_command); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you don't have import testcafe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that understood your question. Could you please rephrase?