-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: restore dashboard filter tests (#1986)
These tests had been temporarily removed due to a bug in dependency. So the files dashboard_filter.js and dashboard_filter.feature are unchanged. Some extended timeouts were added to a few tests that were acting flaky, and a test dashboard name was shortened.
- Loading branch information
1 parent
271463b
commit 391b168
Showing
7 changed files
with
139 additions
and
5 deletions.
There are no files selected for viewing
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,33 @@ | ||
Feature: Dashboard filter | ||
|
||
Scenario: I add a Period filter | ||
When I start a new dashboard | ||
And I add a MAP and a CHART and save | ||
Then the dashboard displays in view mode | ||
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 existing dashboard | ||
Then the dashboard displays in view mode | ||
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 existing dashboard | ||
Then the dashboard displays in view mode | ||
When I add a "Facility Type" filter | ||
Then the Facility Type filter is applied to the dashboard | ||
|
||
Scenario: I can access the dimensions modal from the filter badge | ||
Given I open existing dashboard | ||
When I add a "Period" filter | ||
And I click on the "Period" filter badge | ||
Then the filter modal is opened | ||
|
||
Scenario: I delete a dashboard | ||
Given I open existing dashboard | ||
When I choose to edit dashboard | ||
And I choose to delete dashboard | ||
When I confirm delete | ||
Then different dashboard displays in view mode |
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
84 changes: 84 additions & 0 deletions
84
cypress/integration/view/dashboard_filter/dashboard_filter.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,84 @@ | ||
import { Then } from 'cypress-cucumber-preprocessor/steps' | ||
import { | ||
filterBadgeSel, | ||
dimensionsModalSel, | ||
} from '../../../elements/dashboardFilter' | ||
import { | ||
gridItemSel, | ||
mapLegendButtonSel, | ||
mapLegendContentSel, | ||
chartSubtitleSel, | ||
chartXAxisLabelSel, | ||
} from '../../../elements/dashboardItem' | ||
import { innerScrollContainerSel } from '../../../elements/viewDashboard' | ||
import { EXTENDED_TIMEOUT } from '../../../support/utils' | ||
|
||
const PERIOD = 'Last 6 months' | ||
const OU = 'Sierra Leone' | ||
const FACILITY_TYPE = 'Clinic' | ||
|
||
/* | ||
Scenario: I add a Period filter | ||
*/ | ||
|
||
Then('the Period filter is applied to the dashboard', () => { | ||
cy.get(filterBadgeSel).contains(`Period: ${PERIOD}`).should('be.visible') | ||
|
||
// check the CHART | ||
cy.get(`${gridItemSel}.VISUALIZATION`) | ||
.find(chartSubtitleSel, EXTENDED_TIMEOUT) | ||
.scrollIntoView() | ||
.contains(PERIOD, EXTENDED_TIMEOUT) | ||
.should('be.visible') | ||
|
||
cy.get(innerScrollContainerSel).scrollTo('top') | ||
// check the MAP | ||
cy.get('.dhis2-map-legend-button', EXTENDED_TIMEOUT).trigger('mouseover') | ||
cy.get('.dhis2-map-legend-period', EXTENDED_TIMEOUT) | ||
.contains(PERIOD) | ||
.should('be.visible') | ||
}) | ||
|
||
/* | ||
Scenario: I add an Organisation Unit filter | ||
*/ | ||
|
||
Then('the Organisation Unit filter is applied to the dashboard', () => { | ||
cy.get(filterBadgeSel) | ||
.contains(`Organisation Unit: ${OU}`) | ||
.should('be.visible') | ||
|
||
cy.get(innerScrollContainerSel).scrollTo('bottom') | ||
cy.get(`${gridItemSel}.VISUALIZATION`) | ||
.find(chartXAxisLabelSel, EXTENDED_TIMEOUT) | ||
.scrollIntoView() | ||
.contains(OU, EXTENDED_TIMEOUT) | ||
.should('be.visible') | ||
}) | ||
|
||
/* | ||
Scenario: I add a Facility Type filter | ||
*/ | ||
Then('the Facility Type filter is applied to the dashboard', () => { | ||
cy.get(filterBadgeSel) | ||
.contains(`Facility Type: ${FACILITY_TYPE}`) | ||
.should('be.visible') | ||
|
||
cy.get(innerScrollContainerSel).scrollTo('top') | ||
cy.get(`${gridItemSel}.VISUALIZATION`) | ||
.find(chartSubtitleSel, EXTENDED_TIMEOUT) | ||
.scrollIntoView() | ||
.contains(FACILITY_TYPE, EXTENDED_TIMEOUT) | ||
.should('be.visible') | ||
|
||
cy.get(innerScrollContainerSel).scrollTo('top') | ||
cy.get(mapLegendButtonSel, EXTENDED_TIMEOUT).trigger('mouseover') | ||
cy.get(mapLegendContentSel, EXTENDED_TIMEOUT) | ||
.find('div') | ||
.contains(`Facility Type: ${FACILITY_TYPE}`) | ||
.should('be.visible') | ||
}) | ||
|
||
Then('the filter modal is opened', () => { | ||
cy.get(dimensionsModalSel, EXTENDED_TIMEOUT).should('be.visible') | ||
}) |
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
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
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
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