From 13296c3d28cfd7e91f156cb808f7dfe4fbc65d0d Mon Sep 17 00:00:00 2001 From: mauceballos Date: Wed, 5 Oct 2022 18:08:52 -0300 Subject: [PATCH 01/11] draft commit for evidence --- .../rules/draft--check-rows-dropdow.feature | 51 +++++++++++++++++++ .../rules/draft-check-paginator.feature | 38 ++++++++++++++ ...-rules-is-displayed-after-refresh.feature} | 0 .../pageobjects/wzd/wazuh-menu/rules.page.js | 9 ++++ .../rules/The-user-clicks-on-the-page-when.js | 47 +++++++++++++++++ ...ee-that-the-rule-list-is-paginated.then.js | 14 +++++ 6 files changed, 159 insertions(+) create mode 100644 test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature create mode 100644 test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature rename test/cypress/cypress/integration/features/management/rules/{filter-rules-si-displayed-after-refresh.feature => filter-rules-is-displayed-after-refresh.feature} (100%) create mode 100644 test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js create mode 100644 test/cypress/cypress/integration/step-definitions/management/rules/the-user-see-that-the-rule-list-is-paginated.then.js diff --git a/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature b/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature new file mode 100644 index 0000000000..466256ea4c --- /dev/null +++ b/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature @@ -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 see that the rule list is displayed with a limit per rows + And the user click the limit selector + And the user select 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 see that the rule list is displayed with a limit per rows + And the user click the limit selector + And the user select 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 see that the rule list is displayed with a limit per rows + And the user click the limit selector + And the user select 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 see that the rule list is displayed with a limit per rows + And the user click the limit selector + And the user select 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 see that the rule list is displayed with a limit per rows + And the user click the limit selector + And the user select 100 rows + Then a maximum of 100 rows of rules are displayed per page diff --git a/test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature b/test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature new file mode 100644 index 0000000000..ba130b26ed --- /dev/null +++ b/test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature @@ -0,0 +1,38 @@ +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 next page + When 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 - Select a previous page + When The rule page is not the first available + And The user clicks on the previos 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 + Then The next page button should be disable + + + Scenario: Rules are displayed - First Page + When The rule page is the first available page + Then The previos page button should be disable \ No newline at end of file diff --git a/test/cypress/cypress/integration/features/management/rules/filter-rules-si-displayed-after-refresh.feature b/test/cypress/cypress/integration/features/management/rules/filter-rules-is-displayed-after-refresh.feature similarity index 100% rename from test/cypress/cypress/integration/features/management/rules/filter-rules-si-displayed-after-refresh.feature rename to test/cypress/cypress/integration/features/management/rules/filter-rules-is-displayed-after-refresh.feature diff --git a/test/cypress/cypress/integration/pageobjects/wzd/wazuh-menu/rules.page.js b/test/cypress/cypress/integration/pageobjects/wzd/wazuh-menu/rules.page.js index fecb4f338d..d53d99bbb1 100644 --- a/test/cypress/cypress/integration/pageobjects/wzd/wazuh-menu/rules.page.js +++ b/test/cypress/cypress/integration/pageobjects/wzd/wazuh-menu/rules.page.js @@ -22,4 +22,13 @@ export const RULES_PAGE = { filterLevelSelector: 'button:contains("level")', filterNumberSelector: 'button:nth-child(0)', filterLabelSelector: '.euiPopover.euiPopover--anchorDownLeft [data-testid="wz-search-badge-0"]', + paginatorSelector: '.euiBasicTable .euiPagination', + paginatorPreviousSelector: '[data-test-subj="pagination-button-previous"]', + paginatorNextSelector: '[data-test-subj="pagination-button-next"]', + paginatorFirstSelector: '.euiBasicTable .euiPagination li.euiPagination__item:first-child', + paginatorSecondSelector: '.euiBasicTable .euiPagination li.euiPagination__item:nth-child(2)', + paginatorthirdSelector: '.euiBasicTable .euiPagination li.euiPagination__item:nth-child(3)', + paginatorFourthSelector: '.euiBasicTable .euiPagination li.euiPagination__item:nth-child(4)', + paginatorLastSelector: '.euiBasicTable .euiPagination li.euiPagination__item:last-child', + }; diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js b/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js new file mode 100644 index 0000000000..3a83f1dfe4 --- /dev/null +++ b/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js @@ -0,0 +1,47 @@ +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 rulestableSelector = getSelector('rulestableSelector', pageName); + +When('The user clicks on the {} page button', (page) => { + let selector; + elementIsVisible(paginatorSelector); + switch (page) { + case 'first': + selector = paginatorSelector; + 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`); + } + elementIsVisible(selector); + clickElement(selector) + cy.wait(1500); +}); + +When('A new set of rules it\'s displayed', () => { + cy.wait(1500); + elementIsVisible(paginatorSelector); +}); + +Then('The first page of rules it displayed', () => { + cy.wait(1500); + cy.get(rulestableSelector).then(($rules) => { + cy.get('@listRulesText').then(($e) => { + expect($rules).to.be.equals($e); + }) + }) + +}); \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-see-that-the-rule-list-is-paginated.then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-see-that-the-rule-list-is-paginated.then.js new file mode 100644 index 0000000000..6f4043ae46 --- /dev/null +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-see-that-the-rule-list-is-paginated.then.js @@ -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 see 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'); + }) +}); From f8fe1f9ff0dcafd91c61e2d704f72b6a86eebba0 Mon Sep 17 00:00:00 2001 From: mauceballos Date: Thu, 6 Oct 2022 16:10:49 -0300 Subject: [PATCH 02/11] draft commit for evidencie --- .../rules/draft-check-paginator.feature | 12 +++++---- .../rules/The-user-clicks-on-the-page-when.js | 26 +++++++------------ .../a-new-set-of-rules-displayed.when.js | 10 +++++++ .../rules/the-first-page-is-displayed-then.js | 16 ++++++++++++ .../rules/the-page-button-disable.then.js | 11 ++++++++ .../rules/the-rule-page-is-available.then.js | 16 ++++++++++++ .../the-rule-page-is-not-available.when.js | 9 +++++++ ...the-user-redirected-next-rule-page-then.js | 15 +++++++++++ 8 files changed, 94 insertions(+), 21 deletions(-) create mode 100644 test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js create mode 100644 test/cypress/cypress/integration/step-definitions/management/rules/the-first-page-is-displayed-then.js create mode 100644 test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js create mode 100644 test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js create mode 100644 test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-not-available.when.js create mode 100644 test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js diff --git a/test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature b/test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature index ba130b26ed..d1dbe2b7c5 100644 --- a/test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature +++ b/test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature @@ -17,22 +17,24 @@ Feature: Validate paginator on Rule page Scenario: Rules are displayed - Select a next page - When The rule page is not the last available + 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 - Select a previous page - When The rule page is not the first available - And The user clicks on the previos page button + 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 - Last Page - When The rule page is the last available + When The rule page is the last available page Then The next page button should be disable Scenario: Rules are displayed - First Page When The rule page is the first available page - Then The previos page button should be disable \ No newline at end of file + Then The previous page button should be disable \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js b/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js index 3a83f1dfe4..be83e6d187 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js @@ -5,14 +5,14 @@ const paginatorSelector = getSelector('paginatorSelector', pageName); const paginatorSecondSelector = getSelector('paginatorSecondSelector', pageName); const paginatorNextSelector = getSelector('paginatorNextSelector', pageName); const paginatorPreviousSelector = getSelector('paginatorPreviousSelector', pageName); -const rulestableSelector = getSelector('rulestableSelector', pageName); +const paginatorFirstSelector = getSelector('paginatorFirstSelector', pageName); When('The user clicks on the {} page button', (page) => { let selector; elementIsVisible(paginatorSelector); switch (page) { case 'first': - selector = paginatorSelector; + selector = paginatorFirstSelector; break; case 'second': selector = paginatorSecondSelector; @@ -26,22 +26,16 @@ When('The user clicks on the {} page button', (page) => { default: throw new Error(`The page ${page} is not defined`); } - elementIsVisible(selector); - clickElement(selector) + // elementIsVisible(selector); + clickElement(selector); cy.wait(1500); }); -When('A new set of rules it\'s displayed', () => { - cy.wait(1500); - elementIsVisible(paginatorSelector); -}); -Then('The first page of rules it displayed', () => { - cy.wait(1500); - cy.get(rulestableSelector).then(($rules) => { - cy.get('@listRulesText').then(($e) => { - expect($rules).to.be.equals($e); - }) - }) -}); \ No newline at end of file + + + + + + diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js b/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js new file mode 100644 index 0000000000..f808af55a4 --- /dev/null +++ b/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js @@ -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 it\'s displayed', () => { + cy.wait(1500); + elementIsVisible(paginatorSelector); +}); \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-first-page-is-displayed-then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-first-page-is-displayed-then.js new file mode 100644 index 0000000000..12cd562428 --- /dev/null +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-first-page-is-displayed-then.js @@ -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 it 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); + }) + }) + +}); \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js new file mode 100644 index 0000000000..935424658e --- /dev/null +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js @@ -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 disable',(positionPage) => { + cy.wait(1500); + (positionPage == 'next') ? cy.get(paginatorNextSelector).should('have.attr', 'disabled') : cy.get(paginatorPreviousSelector).should('have.attr', 'disabled'); +}); \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js new file mode 100644 index 0000000000..16a51fee8c --- /dev/null +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js @@ -0,0 +1,16 @@ +import { Then } from 'cypress-cucumber-preprocessor/steps'; +import { clickElement, 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 rulestableSelector = getSelector('rulestableSelector', pageName); +const paginatorFirstSelector = getSelector('paginatorFirstSelector', pageName); +const paginatorLastSelector = getSelector('paginatorLastSelector', pageName); + + +Then('The rule page is the {} available page', (page) => { + (page == 'first') ? clickElement(paginatorFirstSelector) : clickElement(paginatorLastSelector); + cy.wait(1500); +}); \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-not-available.when.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-not-available.when.js new file mode 100644 index 0000000000..ce014e3aaf --- /dev/null +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-not-available.when.js @@ -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'); +}) \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js new file mode 100644 index 0000000000..5b69d894b3 --- /dev/null +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js @@ -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(1500); + cy.get(rulestableSelector).then(($rules) => { + const rulesText = $rules.text(); + cy.log(rulesText); + cy.get('@listRulesText').then(($e) => { + expect(rulesText).to.not.be.equals($e); + }) + }) +}); From 5af03cccea1c9e7937e7116621134274a1ef94b2 Mon Sep 17 00:00:00 2001 From: mauceballos Date: Tue, 11 Oct 2022 12:09:51 -0300 Subject: [PATCH 03/11] add validate paginator on Rule page feature --- ...aginator.feature => validate-paginator.feature} | 14 +++++--------- .../rules/The-user-clicks-on-the-page-when.js | 1 - .../rules/the-rule-page-is-available.then.js | 6 ------ .../the-user-redirected-next-rule-page-then.js | 6 +++--- 4 files changed, 8 insertions(+), 19 deletions(-) rename test/cypress/cypress/integration/features/management/rules/{draft-check-paginator.feature => validate-paginator.feature} (99%) diff --git a/test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature b/test/cypress/cypress/integration/features/management/rules/validate-paginator.feature similarity index 99% rename from test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature rename to test/cypress/cypress/integration/features/management/rules/validate-paginator.feature index d1dbe2b7c5..bc0f5147c1 100644 --- a/test/cypress/cypress/integration/features/management/rules/draft-check-paginator.feature +++ b/test/cypress/cypress/integration/features/management/rules/validate-paginator.feature @@ -15,26 +15,22 @@ Feature: Validate paginator on Rule page And The user clicks on the first page button Then The first page of rules it displayed - - 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 - 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 disable - Scenario: Rules are displayed - First Page When The rule page is the first available page Then The previous page button should be disable \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js b/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js index be83e6d187..a8d7bdf2b4 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js @@ -26,7 +26,6 @@ When('The user clicks on the {} page button', (page) => { default: throw new Error(`The page ${page} is not defined`); } - // elementIsVisible(selector); clickElement(selector); cy.wait(1500); }); diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js index 16a51fee8c..940e6b4d07 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js @@ -1,15 +1,9 @@ import { Then } from 'cypress-cucumber-preprocessor/steps'; import { clickElement, 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 rulestableSelector = getSelector('rulestableSelector', pageName); const paginatorFirstSelector = getSelector('paginatorFirstSelector', pageName); const paginatorLastSelector = getSelector('paginatorLastSelector', pageName); - Then('The rule page is the {} available page', (page) => { (page == 'first') ? clickElement(paginatorFirstSelector) : clickElement(paginatorLastSelector); cy.wait(1500); diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js index 5b69d894b3..f6decbc8d2 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js @@ -8,8 +8,8 @@ Then('The user should be redirected to the next rule page available',() => { cy.get(rulestableSelector).then(($rules) => { const rulesText = $rules.text(); cy.log(rulesText); - cy.get('@listRulesText').then(($e) => { - expect(rulesText).to.not.be.equals($e); - }) + assert.isNotEmpty(rulesText); + assert.isNotNaN(rulesText); + assert.isNotNull(rulesText); }) }); From e53bc516deba08f5a59ade504e6d45e8d1aa6c90 Mon Sep 17 00:00:00 2001 From: mauceballos Date: Tue, 11 Oct 2022 12:34:29 -0300 Subject: [PATCH 04/11] fix for some issue --- .../rules/The-user-clicks-on-the-page-when.js | 2 +- .../rules/a-new-set-of-rules-displayed.when.js | 2 +- .../management/rules/the-page-button-disable.then.js | 2 +- .../rules/the-rule-page-is-available.then.js | 10 ++++++++-- .../rules/the-user-redirected-next-rule-page-then.js | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js b/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js index a8d7bdf2b4..035d219988 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/The-user-clicks-on-the-page-when.js @@ -27,7 +27,7 @@ When('The user clicks on the {} page button', (page) => { throw new Error(`The page ${page} is not defined`); } clickElement(selector); - cy.wait(1500); + cy.wait(3000); }); diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js b/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js index f808af55a4..bcbd6ad310 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js @@ -5,6 +5,6 @@ const paginatorSelector = getSelector('paginatorSelector', pageName); When('A new set of rules it\'s displayed', () => { - cy.wait(1500); + cy.wait(2500); elementIsVisible(paginatorSelector); }); \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js index 935424658e..a4e9cd049b 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js @@ -6,6 +6,6 @@ const paginatorPreviousSelector = getSelector('paginatorPreviousSelector', pageN Then('The {} page button should be disable',(positionPage) => { - cy.wait(1500); + cy.wait(2000); (positionPage == 'next') ? cy.get(paginatorNextSelector).should('have.attr', 'disabled') : cy.get(paginatorPreviousSelector).should('have.attr', 'disabled'); }); \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js index 940e6b4d07..3d879449a4 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-rule-page-is-available.then.js @@ -1,10 +1,16 @@ import { Then } from 'cypress-cucumber-preprocessor/steps'; -import { clickElement, getSelector } from '../../../utils/driver'; +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) => { - (page == 'first') ? clickElement(paginatorFirstSelector) : clickElement(paginatorLastSelector); + if (page == 'first') { + elementIsVisible(paginatorFirstSelector) + clickElement(paginatorFirstSelector) + } else { + elementIsVisible(paginatorLastSelector); + clickElement(paginatorLastSelector); + } cy.wait(1500); }); \ No newline at end of file diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js index f6decbc8d2..1765238c11 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-redirected-next-rule-page-then.js @@ -4,7 +4,7 @@ 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(1500); + cy.wait(3000); cy.get(rulestableSelector).then(($rules) => { const rulesText = $rules.text(); cy.log(rulesText); From c4ebe6401aeb7dce34ea3031e594f8965c431139 Mon Sep 17 00:00:00 2001 From: mauceballos <76791841+mauceballos@users.noreply.github.com> Date: Wed, 12 Oct 2022 09:11:51 -0300 Subject: [PATCH 05/11] Update draft--check-rows-dropdow.feature --- .../features/management/rules/draft--check-rows-dropdow.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature b/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature index 466256ea4c..f0456507ef 100644 --- a/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature +++ b/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature @@ -1,7 +1,7 @@ Feature: Validate row dropdown on Rule page As a wazuh user - i want to see the Rules pages + I want to see the Rules pages in order to manage them Scenario: Rules are displayed - Select 10 rows From a843b0cb16c21eb7e5779aed596a0534bebaeee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex?= Date: Thu, 13 Oct 2022 10:59:36 +0200 Subject: [PATCH 06/11] Update the-user-see-that-the-rule-list-is-paginated.then.js --- .../rules/the-user-see-that-the-rule-list-is-paginated.then.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-see-that-the-rule-list-is-paginated.then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-see-that-the-rule-list-is-paginated.then.js index 6f4043ae46..80f5f66ce9 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/the-user-see-that-the-rule-list-is-paginated.then.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-user-see-that-the-rule-list-is-paginated.then.js @@ -4,7 +4,7 @@ import { RULES_PAGE as pageName} from '../../../utils/pages-constants'; const paginatorSelector = getSelector('paginatorSelector', pageName); const rulestableSelector = getSelector('rulestableSelector', pageName); -Then('The user see that the rule list is paginated', () => { +Then('The user sees that the rule list is paginated', () => { elementIsVisible(paginatorSelector); cy.get(rulestableSelector).then(($e) =>{ const listRulesText = $e.text(); From a97867828ae8edc586459249de3744951aa90075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex?= Date: Thu, 13 Oct 2022 11:00:06 +0200 Subject: [PATCH 07/11] Update the-page-button-disable.then.js --- .../management/rules/the-page-button-disable.then.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js index a4e9cd049b..6f6dbc1e5a 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-page-button-disable.then.js @@ -5,7 +5,7 @@ const paginatorNextSelector = getSelector('paginatorNextSelector', pageName); const paginatorPreviousSelector = getSelector('paginatorPreviousSelector', pageName); -Then('The {} page button should be disable',(positionPage) => { +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'); -}); \ No newline at end of file +}); From 92e72cf008540038455f14b58e534d74a0e190f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex?= Date: Thu, 13 Oct 2022 11:00:22 +0200 Subject: [PATCH 08/11] Update the-first-page-is-displayed-then.js --- .../management/rules/the-first-page-is-displayed-then.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/the-first-page-is-displayed-then.js b/test/cypress/cypress/integration/step-definitions/management/rules/the-first-page-is-displayed-then.js index 12cd562428..063cbf699a 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/the-first-page-is-displayed-then.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/the-first-page-is-displayed-then.js @@ -3,7 +3,7 @@ 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 it displayed', () => { +Then('The first page of rules is displayed', () => { cy.wait(1500); cy.get(rulestableSelector).then(($rules) => { const rulesText = $rules.text(); @@ -13,4 +13,4 @@ Then('The first page of rules it displayed', () => { }) }) -}); \ No newline at end of file +}); From d1874b2758cc1d31e19b5cc9b4a1b9c910e86e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex?= Date: Thu, 13 Oct 2022 11:00:57 +0200 Subject: [PATCH 09/11] Update a-new-set-of-rules-displayed.when.js --- .../management/rules/a-new-set-of-rules-displayed.when.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js b/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js index bcbd6ad310..394bf843c2 100644 --- a/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js +++ b/test/cypress/cypress/integration/step-definitions/management/rules/a-new-set-of-rules-displayed.when.js @@ -4,7 +4,7 @@ import { RULES_PAGE as pageName } from '../../../utils/pages-constants'; const paginatorSelector = getSelector('paginatorSelector', pageName); -When('A new set of rules it\'s displayed', () => { +When('A new set of rules is displayed', () => { cy.wait(2500); elementIsVisible(paginatorSelector); -}); \ No newline at end of file +}); From 0cbac24510999164d65b9a1033824ec047e250e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex?= Date: Thu, 13 Oct 2022 11:01:11 +0200 Subject: [PATCH 10/11] Update validate-paginator.feature --- .../features/management/rules/validate-paginator.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cypress/cypress/integration/features/management/rules/validate-paginator.feature b/test/cypress/cypress/integration/features/management/rules/validate-paginator.feature index bc0f5147c1..a168ef2af5 100644 --- a/test/cypress/cypress/integration/features/management/rules/validate-paginator.feature +++ b/test/cypress/cypress/integration/features/management/rules/validate-paginator.feature @@ -29,8 +29,8 @@ Feature: Validate paginator on Rule page Scenario: Rules are displayed - Last Page When The rule page is the last available page - Then The next page button should be disable + 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 disable \ No newline at end of file + Then The previous page button should be disabled From 068eb10ee1d3300fe654085a8f258d45076200df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex?= Date: Thu, 13 Oct 2022 11:02:07 +0200 Subject: [PATCH 11/11] Update draft--check-rows-dropdow.feature --- .../rules/draft--check-rows-dropdow.feature | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature b/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature index f0456507ef..fe2b65c431 100644 --- a/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature +++ b/test/cypress/cypress/integration/features/management/rules/draft--check-rows-dropdow.feature @@ -7,27 +7,27 @@ Feature: Validate row dropdown on Rule page Scenario: Rules are displayed - Select 10 rows Given the wazuh admin user is logged When the user navigates to management rules - And the user see that the rule list is displayed with a limit per rows - And the user click the limit selector - And the user select 10 rows + 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 see that the rule list is displayed with a limit per rows - And the user click the limit selector - And the user select 15 rows + 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 see that the rule list is displayed with a limit per rows - And the user click the limit selector - And the user select 25 rows + 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 @@ -35,9 +35,9 @@ Feature: Validate row dropdown on Rule 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 see that the rule list is displayed with a limit per rows - And the user click the limit selector - And the user select 50 rows + 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 @@ -45,7 +45,7 @@ Feature: Validate row dropdown on Rule 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 see that the rule list is displayed with a limit per rows - And the user click the limit selector - And the user select 100 rows + 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