diff --git a/.gitignore b/.gitignore index 48ae57eb1..5bcf19efc 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ build cypress.env.json cypress/screenshots cypress/videos +cypress/downloads diff --git a/cypress/e2e/dashboard_filter.feature b/cypress/e2e/dashboard_filter.feature index c4c308fd9..e099c9807 100644 --- a/cypress/e2e/dashboard_filter.feature +++ b/cypress/e2e/dashboard_filter.feature @@ -1,21 +1,17 @@ Feature: Dashboard filter - Scenario: I add a Period filter + Scenario: I add and remove filters When I start a new dashboard And I add items and save Then the dashboard displays in view mode and visualizations are visible When I add a "Period" filter Then the Period filter is applied to the dashboard - - Scenario: I add a Organisation unit filter - Given I open an existing dashboard - Then the dashboard displays in view mode and visualizations are visible + When I remove the "Period" filter + Then the filter is removed from the dashboard When I add a "Organisation unit" filter Then the Organisation unit filter is applied to the dashboard - - Scenario: I add a Facility Type filter - Given I open an existing dashboard - Then the dashboard displays in view mode and visualizations are visible + When I remove the "OrgUnit" filter + Then the filter is removed from the dashboard When I add a "Facility Type" filter Then the Facility Type filter is applied to the dashboard diff --git a/cypress/e2e/dashboard_filter/dashboard_filter.js b/cypress/e2e/dashboard_filter/dashboard_filter.js index 3317131a9..693f99d28 100644 --- a/cypress/e2e/dashboard_filter/dashboard_filter.js +++ b/cypress/e2e/dashboard_filter/dashboard_filter.js @@ -1,4 +1,4 @@ -import { Then } from '@badeball/cypress-cucumber-preprocessor' +import { Then, When } from '@badeball/cypress-cucumber-preprocessor' import { filterBadgeSel, dimensionsModalSel, @@ -126,3 +126,11 @@ Then('the Org unit group filter is applied to the dashboard', () => { Then('the filter modal is opened', () => { cy.get(dimensionsModalSel).should('be.visible') }) + +When('I remove the {string} filter', () => { + cy.get(filterBadgeSel).find('button').contains('Remove').click() +}) + +Then('the filter is removed from the dashboard', () => { + cy.get(filterBadgeSel).should('not.exist') +})