-
Notifications
You must be signed in to change notification settings - Fork 406
E2e/feature/enhanced overview tests #1145
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
vlad-dargel
merged 2 commits into
feature/RI-2743_Enhanced_overview
from
e2e/feature/enhanced-overview-tests
Sep 13, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { Selector } from 'testcafe'; | ||
|
||
export class OverviewPage { | ||
//CSS Selectors | ||
cssTableRow = 'tr[class=euiTableRow]'; | ||
//------------------------------------------------------------------------------------------- | ||
//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 | ||
overviewTab = Selector('[data-testid=analytics-tab-ClusterDetails]'); | ||
// COMPONENTS | ||
clusterDetailsUptime = Selector('[data-testid=cluster-details-uptime]'); | ||
//TABLE COMPONENTS | ||
tableHeaderCell = Selector('[data-test-subj^=tableHeaderCell]'); | ||
primaryNodesTable = Selector('[data-testid=primary-nodes-table]'); | ||
tableRow = Selector('tr[class=euiTableRow]'); | ||
connectedClientsValue = Selector('[data-testid^=connectedClients-value]'); | ||
totalKeysValue = Selector('[data-testid^=totalKeys-value]'); | ||
networkInputValue = Selector('[data-testid^=networkInKbps-value]'); | ||
networkOutputValue = Selector('[data-testid^=networkOutKbps-value]'); | ||
|
||
/** | ||
* Get Primary nodes count in table | ||
*/ | ||
async getPrimaryNodesCount(): Promise<number> { | ||
return await this.primaryNodesTable.find(this.cssTableRow).count; | ||
} | ||
|
||
/** | ||
* Get total value from all rows in column | ||
* @param column The column name | ||
*/ | ||
async getTotalValueByColumnName(column: string): Promise<number> { | ||
let totalNumber = 0; | ||
let columnInSelector = ''; | ||
switch (column) { | ||
case 'Commands/s': | ||
columnInSelector = 'opsPerSecond'; | ||
break; | ||
case 'Clients': | ||
columnInSelector = 'connectedClients'; | ||
break; | ||
case 'Total Keys': | ||
columnInSelector = 'totalKeys'; | ||
break; | ||
case 'Network Input': | ||
columnInSelector = 'networkInKbps'; | ||
break; | ||
case 'Network Output': | ||
columnInSelector = 'networkOutKbps'; | ||
break; | ||
case 'Total Memory': | ||
columnInSelector = 'usedMemory'; | ||
break; | ||
default: columnInSelector = ''; | ||
} | ||
const rowSelector = Selector(`[data-testid^=${columnInSelector}-value]`); | ||
for (let i = 0; i < await rowSelector.count; i++) { | ||
totalNumber += Number(await rowSelector.nth(i).textContent); | ||
} | ||
return totalNumber; | ||
} | ||
} |
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,86 @@ | ||
import { Selector } from 'testcafe'; | ||
import { MyRedisDatabasePage, CliPage, OverviewPage, WorkbenchPage } from '../../../pageObjects'; | ||
import { rte } from '../../../helpers/constants'; | ||
import { acceptLicenseTermsAndAddOSSClusterDatabase } from '../../../helpers/database'; | ||
import { commonUrl, ossClusterConfig } from '../../../helpers/conf'; | ||
import { deleteOSSClusterDatabaseApi, getClusterNodesApi } from '../../../helpers/api/api-database'; | ||
import { Common } from '../../../helpers/common'; | ||
|
||
const overviewPage = new OverviewPage(); | ||
const myRedisDatabasePage = new MyRedisDatabasePage(); | ||
const common = new Common(); | ||
const cliPage = new CliPage(); | ||
const workbenchPage = new WorkbenchPage(); | ||
|
||
const headerColumns = { | ||
'Type': 'OSS Cluster', | ||
'Version': '7.0.0', | ||
'User': 'Default' | ||
}; | ||
const keyName = common.generateWord(10); | ||
const commandToAddKey = `set ${keyName} test`; | ||
|
||
fixture `Overview` | ||
.meta({ type: 'critical_path', rte: rte.ossCluster }) | ||
.page(commonUrl) | ||
.beforeEach(async t => { | ||
await acceptLicenseTermsAndAddOSSClusterDatabase(ossClusterConfig, ossClusterConfig.ossClusterDatabaseName); | ||
// Go to Analysis Tools page | ||
await t.click(myRedisDatabasePage.analysisPageButton); | ||
}) | ||
.afterEach(async() => { | ||
await deleteOSSClusterDatabaseApi(ossClusterConfig); | ||
}); | ||
test('Overview tab header for OSS Cluster', async t => { | ||
const uptime = /[1-9][0-9]\s|[0-9]\smin|[1-9][0-9]\smin|[0-9]\sh/; | ||
// Verify that user see "Overview" tab by default for OSS Cluster | ||
await t.expect(overviewPage.overviewTab.withAttribute('aria-selected', 'true').exists).ok('The Overview tab not opened'); | ||
// Verify that user see "Overview" header with OSS Cluster info | ||
for (const key in headerColumns) { | ||
const columnSelector = Selector(`[data-testid=cluster-details-item-${key}]`); | ||
await t.expect(columnSelector.textContent).contains(`${headerColumns[key]}`, `Cluster detail ${key} is incorrect`); | ||
} | ||
// Verify that Uptime is displayed as time in seconds or minutes from start | ||
await t.expect(overviewPage.clusterDetailsUptime.textContent).match(uptime, 'Uptime value is not correct'); | ||
}); | ||
test | ||
.after(async() => { | ||
//Clear database and delete | ||
await cliPage.sendCommandInCli(`DEL ${keyName}`); | ||
await cliPage.sendCommandInCli('FT.DROPINDEX idx:schools DD'); | ||
await deleteOSSClusterDatabaseApi(ossClusterConfig); | ||
})('Primary node statistics table displaying', async t => { | ||
// Remember initial table values | ||
const initialValues: number[] = []; | ||
const nodes = (await getClusterNodesApi(ossClusterConfig)).sort(); | ||
const columns = ['Commands/s', 'Clients', 'Total Keys', 'Network Input', 'Network Output', 'Total Memory']; | ||
for (const column in columns) { | ||
initialValues.push(await overviewPage.getTotalValueByColumnName(column)); | ||
} | ||
const nodesNumberInHeader = parseInt((await overviewPage.tableHeaderCell.nth(0).textContent).match(/\d+/)![0]); | ||
|
||
// Add key from CLI | ||
await t.click(cliPage.cliExpandButton); | ||
await t.typeText(cliPage.cliCommandInput, commandToAddKey); | ||
await t.pressKey('enter'); | ||
await t.click(cliPage.cliCollapseButton); | ||
// Verify nodes in header column equal to rows | ||
await t.expect(await overviewPage.getPrimaryNodesCount()).eql(nodesNumberInHeader, 'Primary nodes in table are not displayed'); | ||
// Verify that all nodes from BE response are displayed in table | ||
for (const node of nodes) { | ||
await t.expect(overviewPage.tableRow.nth(nodes.indexOf(node)).textContent).contains(node, `Node ${node} is not displayed in table`); | ||
} | ||
// Go to Workbench page | ||
await t.click(myRedisDatabasePage.workbenchButton); | ||
//Run Create hash index command to load network and memory | ||
await t.click(workbenchPage.documentButtonInQuickGuides); | ||
await t.click(workbenchPage.internalLinkWorkingWithHashes); | ||
await t.click(workbenchPage.preselectCreateHashIndex); | ||
await t.click(workbenchPage.submitCommandButton); | ||
// Go to Analysis Tools page | ||
await t.click(myRedisDatabasePage.analysisPageButton); | ||
// Verify that values in table are dynamic | ||
for (const column in columns) { | ||
await t.expect(await overviewPage.getTotalValueByColumnName(column)).notEql(initialValues[columns.indexOf(column)], `${column} not dynamic`); | ||
} | ||
}); |
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
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.
Can be also a number