-
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.
Add feature rules are displayed when user clicks the first page - wzd…
… - 4648 (#4663) * draft commit for evidence * draft commit for evidencie * add validate paginator on Rule page feature * fix for some issue * Update draft--check-rows-dropdow.feature * Update the-user-see-that-the-rule-list-is-paginated.then.js * Update the-page-button-disable.then.js * Update the-first-page-is-displayed-then.js * Update a-new-set-of-rules-displayed.when.js * Update validate-paginator.feature * Update draft--check-rows-dropdow.feature Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
- Loading branch information
1 parent
31c6a9d
commit 7dfe4d6
Showing
12 changed files
with
227 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.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,51 @@ | ||
Feature: Validate row dropdown on Rule page | ||
|
||
As a wazuh user | ||
I want to see the Rules pages | ||
in order to manage them | ||
|
||
Scenario: Rules are displayed - Select 10 rows | ||
Given the wazuh admin user is logged | ||
When the user navigates to management rules | ||
And the user sees that the rule list is displayed with a limit per rows | ||
And the user clicks the limit selector | ||
And the user selects 10 rows | ||
Then a maximum of 10 rows of rules are displayed per page | ||
|
||
|
||
Scenario: Rules are displayed - Select 15 rows | ||
Given the wazuh admin user is logged | ||
When the user navigates to management rules | ||
And the user sees that the rule list is displayed with a limit per rows | ||
And the user clicks the limit selector | ||
And the user selects 15 rows | ||
Then a maximum of 15 rows of rules are displayed per page | ||
|
||
|
||
Scenario: Rules are displayed - Select 25 rows | ||
Given the wazuh admin user is logged | ||
When the user navigates to management rules | ||
And the user sees that the rule list is displayed with a limit per rows | ||
And the user clicks the limit selector | ||
And the user selects 25 rows | ||
Then a maximum of 25 rows of rules are displayed per page | ||
|
||
|
||
|
||
Scenario: Rules are displayed - Select 50 rows | ||
Given the wazuh admin user is logged | ||
When the user navigates to management rules | ||
And the user sees that the rule list is displayed with a limit per rows | ||
And the user clicks the limit selector | ||
And the user selects 50 rows | ||
Then a maximum of 50 rows of rules are displayed per page | ||
|
||
|
||
|
||
Scenario: Rules are displayed - Select 100 rows | ||
Given the wazuh admin user is logged | ||
When the user navigates to management rules | ||
And the user sees that the rule list is displayed with a limit per rows | ||
And the user clicks the limit selector | ||
And the user selects 100 rows | ||
Then a maximum of 100 rows of rules are displayed per page |
File renamed without changes.
36 changes: 36 additions & 0 deletions
36
test/cypress/cypress/integration/features/management/rules/validate-paginator.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,36 @@ | ||
Feature: Validate paginator on Rule page | ||
|
||
As a wazuh user | ||
i want to see the Rules pages | ||
in order to manage them | ||
|
||
Background: the user navigate to the Rules page | ||
Given The wazuh admin user is logged | ||
When The user navigates to rules | ||
Then The user see that the rule list is paginated | ||
|
||
Scenario: Rules are displayed when user clicks the first page | ||
When The user clicks on the second page button | ||
And A new set of rules it's displayed | ||
And The user clicks on the first page button | ||
Then The first page of rules it displayed | ||
|
||
Scenario: Rules are displayed - Select a previous page | ||
When The user clicks on the second page button | ||
And The rule page is not the first available | ||
And The user clicks on the previous page button | ||
Then The user should be redirected to the next rule page available | ||
|
||
Scenario: Rules are displayed - Select a next page | ||
When The user clicks on the second page button | ||
And The rule page is not the last available | ||
And The user clicks on the next page button | ||
Then The user should be redirected to the next rule page available | ||
|
||
Scenario: Rules are displayed - Last Page | ||
When The rule page is the last available page | ||
Then The next page button should be disabled | ||
|
||
Scenario: Rules are displayed - First Page | ||
When The rule page is the first available page | ||
Then The previous page button should be disabled |
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
40 changes: 40 additions & 0 deletions
40
...cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-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,40 @@ | ||
import { Then, When } from 'cypress-cucumber-preprocessor/steps'; | ||
import { clickElement, elementIsVisible, getSelector } from '../../../utils/driver'; | ||
import { RULES_PAGE as pageName } from '../../../utils/pages-constants'; | ||
const paginatorSelector = getSelector('paginatorSelector', pageName); | ||
const paginatorSecondSelector = getSelector('paginatorSecondSelector', pageName); | ||
const paginatorNextSelector = getSelector('paginatorNextSelector', pageName); | ||
const paginatorPreviousSelector = getSelector('paginatorPreviousSelector', pageName); | ||
const paginatorFirstSelector = getSelector('paginatorFirstSelector', pageName); | ||
|
||
When('The user clicks on the {} page button', (page) => { | ||
let selector; | ||
elementIsVisible(paginatorSelector); | ||
switch (page) { | ||
case 'first': | ||
selector = paginatorFirstSelector; | ||
break; | ||
case 'second': | ||
selector = paginatorSecondSelector; | ||
break; | ||
case 'next': | ||
selector = paginatorNextSelector; | ||
break; | ||
case 'previous': | ||
selector = paginatorPreviousSelector; | ||
break; | ||
default: | ||
throw new Error(`The page ${page} is not defined`); | ||
} | ||
clickElement(selector); | ||
cy.wait(3000); | ||
}); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
10 changes: 10 additions & 0 deletions
10
...ypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.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 { elementIsVisible, getSelector } from '../../../utils/driver'; | ||
import { RULES_PAGE as pageName } from '../../../utils/pages-constants'; | ||
const paginatorSelector = getSelector('paginatorSelector', pageName); | ||
|
||
|
||
When('A new set of rules is displayed', () => { | ||
cy.wait(2500); | ||
elementIsVisible(paginatorSelector); | ||
}); |
16 changes: 16 additions & 0 deletions
16
...cypress/integration/step-definitions/management/rules/the-first-page-is-displayed-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 { getSelector } from '../../../utils/driver'; | ||
import { RULES_PAGE as pageName } from '../../../utils/pages-constants'; | ||
const rulestableSelector = getSelector('rulestableSelector', pageName); | ||
|
||
Then('The first page of rules is displayed', () => { | ||
cy.wait(1500); | ||
cy.get(rulestableSelector).then(($rules) => { | ||
const rulesText = $rules.text(); | ||
cy.log(rulesText); | ||
cy.get('@listRulesText').then(($e) => { | ||
expect(rulesText).to.be.equals($e); | ||
}) | ||
}) | ||
|
||
}); |
11 changes: 11 additions & 0 deletions
11
...ess/cypress/integration/step-definitions/management/rules/the-page-button-disable.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,11 @@ | ||
import { Then } from 'cypress-cucumber-preprocessor/steps'; | ||
import { getSelector } from '../../../utils/driver'; | ||
import { RULES_PAGE as pageName } from '../../../utils/pages-constants'; | ||
const paginatorNextSelector = getSelector('paginatorNextSelector', pageName); | ||
const paginatorPreviousSelector = getSelector('paginatorPreviousSelector', pageName); | ||
|
||
|
||
Then('The {} page button should be disabled',(positionPage) => { | ||
cy.wait(2000); | ||
(positionPage == 'next') ? cy.get(paginatorNextSelector).should('have.attr', 'disabled') : cy.get(paginatorPreviousSelector).should('have.attr', 'disabled'); | ||
}); |
16 changes: 16 additions & 0 deletions
16
.../cypress/integration/step-definitions/management/rules/the-rule-page-is-available.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 { clickElement, getSelector, elementIsVisible } from '../../../utils/driver'; | ||
import { RULES_PAGE as pageName } from '../../../utils/pages-constants'; | ||
const paginatorFirstSelector = getSelector('paginatorFirstSelector', pageName); | ||
const paginatorLastSelector = getSelector('paginatorLastSelector', pageName); | ||
|
||
Then('The rule page is the {} available page', (page) => { | ||
if (page == 'first') { | ||
elementIsVisible(paginatorFirstSelector) | ||
clickElement(paginatorFirstSelector) | ||
} else { | ||
elementIsVisible(paginatorLastSelector); | ||
clickElement(paginatorLastSelector); | ||
} | ||
cy.wait(1500); | ||
}); |
9 changes: 9 additions & 0 deletions
9
...ress/integration/step-definitions/management/rules/the-rule-page-is-not-available.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,9 @@ | ||
import { When } from 'cypress-cucumber-preprocessor/steps'; | ||
import { getSelector } from '../../../utils/driver'; | ||
import { RULES_PAGE as pageName } from '../../../utils/pages-constants'; | ||
const paginatorFirstSelector = getSelector('paginatorFirstSelector', pageName); | ||
const paginatorLastSelector = getSelector('paginatorLastSelector', pageName); | ||
|
||
When('The rule page is not the {} available', (page) => { | ||
(page == 'first') ? cy.get(paginatorFirstSelector).should('not.have.attr', 'disabled') : cy.get(paginatorLastSelector).should('not.have.attr', 'disabled'); | ||
}) |
15 changes: 15 additions & 0 deletions
15
.../integration/step-definitions/management/rules/the-user-redirected-next-rule-page-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,15 @@ | ||
import { Then } from 'cypress-cucumber-preprocessor/steps'; | ||
import { getSelector } from '../../../utils/driver'; | ||
import { RULES_PAGE as pageName } from '../../../utils/pages-constants'; | ||
const rulestableSelector = getSelector('rulestableSelector', pageName); | ||
|
||
Then('The user should be redirected to the next rule page available',() => { | ||
cy.wait(3000); | ||
cy.get(rulestableSelector).then(($rules) => { | ||
const rulesText = $rules.text(); | ||
cy.log(rulesText); | ||
assert.isNotEmpty(rulesText); | ||
assert.isNotNaN(rulesText); | ||
assert.isNotNull(rulesText); | ||
}) | ||
}); |
14 changes: 14 additions & 0 deletions
14
...on/step-definitions/management/rules/the-user-see-that-the-rule-list-is-paginated.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,14 @@ | ||
import { Then } from 'cypress-cucumber-preprocessor/steps'; | ||
import { elementIsVisible, getSelector} from '../../../utils/driver'; | ||
import { RULES_PAGE as pageName} from '../../../utils/pages-constants'; | ||
const paginatorSelector = getSelector('paginatorSelector', pageName); | ||
const rulestableSelector = getSelector('rulestableSelector', pageName); | ||
|
||
Then('The user sees that the rule list is paginated', () => { | ||
elementIsVisible(paginatorSelector); | ||
cy.get(rulestableSelector).then(($e) =>{ | ||
const listRulesText = $e.text(); | ||
cy.log(listRulesText); | ||
cy.wrap(listRulesText).as('listRulesText'); | ||
}) | ||
}); |