-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport 4.4-7.16] feature search by parameters And , Or (#4725)
feature search by parameters And , Or (#4720) (cherry picked from commit bbad2d1) Co-authored-by: mauceballos <76791841+mauceballos@users.noreply.github.com>
- Loading branch information
1 parent
640241a
commit 68c1695
Showing
7 changed files
with
91 additions
and
4 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
test/cypress/cypress/integration/features/filters/Search-by-parameters.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,32 @@ | ||
Feature: Search by parameters | ||
|
||
As a Wazuh user | ||
I want to pin a filter | ||
in order to aplly it across the modules | ||
Background: | ||
Given The wazuh admin user is logged | ||
And The sample data is loaded | ||
|
||
Scenario Outline: Search by parameters with AND | ||
When The user goes to <Module Name> | ||
And The user types a particular search <key> on the search bar | ||
Then The query is accepted and the results should be displayed | ||
Examples: | ||
| Module Name | key | | ||
| Security Events | cluster.name : "wazuh" and rule.level : "3" | | ||
| Integrity Monitoring | cluster.name : "wazuh" and agent.id : "001" | | ||
| NIST | cluster.name : "wazuh" and agent.name : "Ubuntu" | | ||
| TSC | cluster.name : "wazuh" and agent.name : "Ubuntu" | | ||
| PCIDSS | cluster.name : "wazuh" and agent.name : "Ubuntu" | | ||
|
||
Scenario Outline: Search by parameters with OR | ||
When The user goes to <Module Name> | ||
And The user types a particular search <key> on the search bar | ||
Then The query is accepted and the results should be displayed | ||
Examples: | ||
| Module Name | key | | ||
| Security Events | cluster.name : "wazuh" or rule.level : "3" | | ||
| Integrity Monitoring | cluster.name : "wazuh" or agent.id : "001" | | ||
| NIST | cluster.name : "wazuh" or agent.name : "Ubuntu" | | ||
| TSC | cluster.name : "wazuh" or agent.name : "Ubuntu" | | ||
| PCIDSS | cluster.name : "wazuh" or agent.name : "Ubuntu" | |
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 |
---|---|---|
|
@@ -26,5 +26,4 @@ Feature: Pin filter - from dashboard to event page | |
| NIST | | ||
| TSC | | ||
| Policy Monitoring | | ||
| PCIDSS | | ||
|
||
| 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
10 changes: 10 additions & 0 deletions
10
...ess/cypress/integration/step-definitions/filters/The-user-types-particular-search.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,10 @@ | ||
import { When } from 'cypress-cucumber-preprocessor/steps'; | ||
import { fillField, elementIsVisible, getSelector, forceEnter} from '../../utils/driver'; | ||
import { FILTERS_PAGE as pageName} from '../../utils/pages-constants'; | ||
const searchInputSelector = getSelector('searchInputSelector', pageName); | ||
|
||
When('The user types a particular search {} on the search bar', (key) => { | ||
elementIsVisible(searchInputSelector); | ||
fillField(searchInputSelector, key); | ||
forceEnter(searchInputSelector); | ||
}); |
8 changes: 8 additions & 0 deletions
8
test/cypress/cypress/integration/step-definitions/filters/the-query-is-accepted.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,8 @@ | ||
import { Then } from "cypress-cucumber-preprocessor/steps"; | ||
import { elementIsNotVisible, getSelector } from '../../utils/driver'; | ||
import { FILTERS_PAGE as pageName} from '../../utils/pages-constants'; | ||
const noResultMessage = getSelector('noResultMessage', pageName); | ||
|
||
Then('The query is accepted and the results should be displayed', () => { | ||
elementIsNotVisible(noResultMessage) | ||
}) |
21 changes: 20 additions & 1 deletion
21
...ess/cypress/integration/step-definitions/settings/The-wazuh-admin-user-is-logged.given.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,10 +1,29 @@ | ||
import { Given } from 'cypress-cucumber-preprocessor/steps'; | ||
import { navigate, elementIsVisible, getSelector } from '../../utils/driver'; | ||
import { navigate, elementIsVisible, getSelector, getCookiesFromBrowser } from '../../utils/driver'; | ||
import { WAZUH_MENU_PAGE as pageName} from '../../utils/pages-constants'; | ||
const wazuhMenuButton = getSelector('wazuhMenuButton', pageName); | ||
let urlsList = ['https://localhost:5601/elastic/samplealerts/security','https://localhost:5601/elastic/samplealerts/auditing-policy-monitoring','https://localhost:5601/elastic/samplealerts/threat-detection']; | ||
let urlBodys = [{"alertCount": 27000,"index": "wazuh-alerts-4.x-sample-security"},{"alertCount": 12000,"index": "wazuh-alerts-4.x-sample-auditing-policy-monitoring"},{"alertCount": 15000,"index": "wazuh-alerts-4.x-sample-threat-detection"}] | ||
|
||
Given('The wazuh admin user is logged', () => { | ||
if (Cypress.env('type') != 'wzd') { | ||
navigate("app/wazuh");}else{navigate("/")} | ||
elementIsVisible(wazuhMenuButton); | ||
}) | ||
|
||
Given('The sample data is loaded', () => { | ||
cy.readFile('cookies.json').then((cookies) => { | ||
let headersFormat = {"content-type":"application/json; charset=utf-8","Cookie": getCookiesFromBrowser(cookies),"Accept":"application/json, text/plain, */*","Accept-Encoding":"gzip, deflate, br","osd-xsrf":"kibana"}; | ||
for(let i = 0; i < urlsList.length; i++){ | ||
cy.request({ | ||
method: 'POST', | ||
url: urlsList[i], | ||
headers: headersFormat, | ||
body: urlBodys[i] | ||
}).should((response) => { | ||
expect(response.status).to.eq(200) | ||
}) | ||
} | ||
|
||
}) | ||
}) |
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