-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test feature: generate a report from an agent (#4629)
* Add pages and functionallity * Add feature changes * Try to capture text * Add report name compare with agent id * Add a validation for modules with no data * Add time to refresh button status * Add validation * Add last changes * Adding pages * Rename agent-report-displayed-file * Add sign to commit Signed-off-by: Facundo Mayon <mayonf95@gmail.com> * Add git signature Signed-off-by: Facundo Mayon <mayonf95@gmail.com> Signed-off-by: Facundo Mayon <mayonf95@gmail.com>
- Loading branch information
Showing
15 changed files
with
103 additions
and
17 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...s/cypress/integration/features/management/reporting/add-report-from-modules-agent.feature
This file contains 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,25 @@ | ||
Feature: Generating reports from module and agents | ||
|
||
As a Wazuh user | ||
i want to generate a report from modules and agents | ||
in order to could access to the report from management/reporting | ||
|
||
@report | ||
Scenario Outline: Create a report from modules and agents <Module Name> | ||
Given The wazuh admin user is logged | ||
When The user goes to <Module Name> | ||
And The user generate a module report clicking on the generate report option | ||
And The user choose an agent to apply filter | ||
And The user generate a module report clicking on the generate report option | ||
And The user navigates to management-reporting | ||
Then The agent report is displayed in the table <Module Name> | ||
Examples: | ||
| Module Name | | ||
| Security Events | | ||
| Integrity Monitoring | | ||
| System Auditing | | ||
| Mitre & Attack | | ||
| NIST | | ||
| TSC | | ||
| Policy Monitoring | | ||
| PCIDSS | |
This file contains 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
3 changes: 2 additions & 1 deletion
3
test/cypress/cypress/integration/pageobjects/basic/reporting/report.page.js
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export const REPORTING_PAGE = { | ||
generateReportButton: '.wz-welcome-page-agent-tabs .euiFlexItem .euiFlexItem .euiButtonEmpty[type="button"] .euiButtonEmpty__text:contains("Generate report")', | ||
reportGeneratedToast: '.euiToast', | ||
lastCreatedReport: '.euiTable .euiTableRow:nth-child(1) .euiTableRowCell .euiTableCellContent .euiTableCellContent__text' | ||
lastCreatedReport: '.euiTable .euiTableRow:nth-child(1) .euiTableRowCell .euiTableCellContent .euiTableCellContent__text', | ||
disableGenerateReportButton: '.wz-welcome-page-agent-tabs .euiFlexItem .euiToolTipAnchor button.euiButtonEmpty-isDisabled', | ||
}; |
This file contains 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
3 changes: 2 additions & 1 deletion
3
test/cypress/cypress/integration/pageobjects/odfe/reporting/report.page.js
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export const REPORTING_PAGE = { | ||
generateReportButton: '.wz-welcome-page-agent-tabs .euiFlexItem .euiFlexItem .euiButtonEmpty[type="button"] .euiButtonEmpty__text:contains("Generate report")', | ||
reportGeneratedToast: '.euiToast', | ||
lastCreatedReport: '.euiTable .euiTableRow:nth-child(1) .euiTableRowCell .euiTableCellContent .euiTableCellContent__text' | ||
lastCreatedReport: '.euiTable .euiTableRow:nth-child(1) .euiTableRowCell .euiTableCellContent .euiTableCellContent__text', | ||
disableGenerateReportButton: '.wz-welcome-page-agent-tabs .euiFlexItem .euiToolTipAnchor button.euiButtonEmpty-isDisabled', | ||
}; |
5 changes: 5 additions & 0 deletions
5
test/cypress/cypress/integration/pageobjects/wzd/agents/agents.page.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
test/cypress/cypress/integration/pageobjects/wzd/reporting/report.page.js
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export const REPORTING_PAGE = { | ||
generateReportButton: '.wz-welcome-page-agent-tabs .euiFlexItem .euiFlexItem .euiButtonEmpty[type="button"] .euiButtonEmpty__text:contains("Generate report")', | ||
reportGeneratedToast: '.euiToast', | ||
lastCreatedReport: '.euiTable .euiTableRow:nth-child(1) .euiTableRowCell .euiTableCellContent .euiTableCellContent__text' | ||
lastCreatedReport: '.euiTable .euiTableRow:nth-child(1) .euiTableRowCell .euiTableCellContent .euiTableCellContent__text', | ||
disableGenerateReportButton: '.wz-welcome-page-agent-tabs .euiFlexItem .euiToolTipAnchor button.euiButtonEmpty-isDisabled', | ||
}; |
This file contains 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
3 changes: 2 additions & 1 deletion
3
test/cypress/cypress/integration/pageobjects/xpack/reporting/report.page.js
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export const REPORTING_PAGE = { | ||
generateReportButton: '.wz-welcome-page-agent-tabs .euiFlexItem .euiFlexItem .euiButtonEmpty[type="button"] .euiButtonEmpty__text:contains("Generate report")', | ||
reportGeneratedToast: '.euiToast', | ||
lastCreatedReport: '.euiTable .euiTableRow:nth-child(1) .euiTableRowCell .euiTableCellContent .euiTableCellContent__text' | ||
lastCreatedReport: '.euiTable .euiTableRow:nth-child(1) .euiTableRowCell .euiTableCellContent .euiTableCellContent__text', | ||
disableGenerateReportButton: '.wz-welcome-page-agent-tabs .euiFlexItem .euiToolTipAnchor button.euiButtonEmpty-isDisabled', | ||
}; |
6 changes: 4 additions & 2 deletions
6
test/cypress/cypress/integration/step-definitions/reporting/generate-module-report-when.js
This file contains 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
10 changes: 0 additions & 10 deletions
10
test/cypress/cypress/integration/step-definitions/reporting/modules-report-data.js
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...ration/step-definitions/reporting/the-user-agent-report-is-displayed-in-the-table-then.js
This file contains 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,16 @@ | ||
import { Then } from 'cypress-cucumber-preprocessor/steps'; | ||
import { elementIsVisible, elementTextIncludes, getSelector} from '../../utils/driver'; | ||
import {REPORT_NAME as reportName} from '../../utils/mappers/modules-mapper-report-data'; | ||
import { REPORTING_PAGE as pageName} from '../../utils/pages-constants'; | ||
const lastCreatedReport = getSelector('lastCreatedReport', pageName); | ||
|
||
Then('The agent report is displayed in the table {}', (moduleName) => { | ||
elementIsVisible(lastCreatedReport); | ||
cy.wait(2000); | ||
cy.get('@agentId').then(($agentId) => { | ||
expect($agentId).to.be.eq($agentId); | ||
const agentID = $agentId; | ||
elementTextIncludes(lastCreatedReport, 'agents-' + agentID + '-' + reportName[moduleName]); | ||
}); | ||
}); | ||
|
19 changes: 19 additions & 0 deletions
19
...s/integration/step-definitions/reporting/the-user-choose-an-agent-to-apply-filter-when.js
This file contains 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,19 @@ | ||
import { When } from 'cypress-cucumber-preprocessor/steps'; | ||
import { clickElement, elementIsVisible, getSelector} from '../../utils/driver'; | ||
|
||
import { AGENTS_PAGE as pageName} from '../../utils/pages-constants'; | ||
const exploreAgentButton = getSelector('exploreAgentButton', pageName); | ||
const firstAgentDisplayed = getSelector('firstAgentDisplayed', pageName); | ||
const agentID = getSelector('agentID', pageName); | ||
|
||
When('The user choose an agent to apply filter', () => { | ||
elementIsVisible(exploreAgentButton); | ||
clickElement(exploreAgentButton); | ||
cy.wait(500); | ||
elementIsVisible(firstAgentDisplayed); | ||
cy.get(agentID).then(($agentId) =>{ | ||
const agentId = $agentId.text(); | ||
cy.wrap(agentId).as('agentId'); | ||
}) | ||
clickElement(firstAgentDisplayed); | ||
}); |
2 changes: 1 addition & 1 deletion
2
.../integration/step-definitions/reporting/the-user-report-is-dispalyed-in-the-table-then.js
This file contains 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
10 changes: 10 additions & 0 deletions
10
test/cypress/cypress/integration/utils/mappers/modules-mapper-report-data.js
This file contains 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,10 @@ | ||
export const REPORT_NAME = { | ||
"Security Events":"general", | ||
"Integrity Monitonring":"fim", | ||
"System Auditing":"audit", | ||
"Mitre & Attack":"mitre", | ||
NIST:"nist", | ||
TSC:"tsc", | ||
"Policy Monitoring":"pm", | ||
PCIDSS:"pci" | ||
}; |