diff --git a/cypress/elements/dimensionsPanel.js b/cypress/elements/dimensionsPanel.js index e795e99d11..73b2e09d01 100644 --- a/cypress/elements/dimensionsPanel.js +++ b/cypress/elements/dimensionsPanel.js @@ -75,6 +75,7 @@ export const expectDimensionToNotHaveSelectedStyle = (dimensionId) => export const expectRecommendedIconToBeVisible = (dimensionId) => cy .getBySel(getDimensionButtonById(dimensionId)) + .scrollIntoView() .findBySel(recommendedIconEl) .should('have.length', 1) .and('be.visible') diff --git a/cypress/integration/dimensions/data.cy.js b/cypress/integration/dimensions/data.cy.js index 92e3f96e09..5303175fe2 100644 --- a/cypress/integration/dimensions/data.cy.js +++ b/cypress/integration/dimensions/data.cy.js @@ -251,7 +251,7 @@ describe('Data dimension', () => { { name: 'Event data items', testGroup: { name: 'Information Campaign', itemAmount: 6 }, - testItem: { name: 'Diagnosis (ICD-10)' }, + testItem: { name: 'E2E TE program 1 First name' }, defaultGroup: { name: 'All programs' }, endpoint: { hasMultiplePages: true, diff --git a/cypress/integration/dimensions/dynamic.cy.js b/cypress/integration/dimensions/dynamic.cy.js index ad60d02f3e..f1e9948be3 100644 --- a/cypress/integration/dimensions/dynamic.cy.js +++ b/cypress/integration/dimensions/dynamic.cy.js @@ -20,11 +20,8 @@ import { expectDimensionToHaveItemAmount, } from '../../elements/layout.js' import { goToStartPage } from '../../elements/startScreen.js' -import { TEST_DATA_ELEMENTS } from '../../utils/data.js' -import { getRandomArrayItem } from '../../utils/random.js' import { expectWindowConfigSeriesToHaveLength } from '../../utils/window.js' -const TEST_DATA_ELEMENT_NAME = getRandomArrayItem(TEST_DATA_ELEMENTS).name const TEST_DYNAMIC_DIMENSION = { id: 'J5jldMd8OHv', name: 'Facility type', @@ -32,15 +29,16 @@ const TEST_DYNAMIC_DIMENSION = { } describe(`Dynamic dimension - ${TEST_DYNAMIC_DIMENSION.name}`, () => { - it('navigates to the start page and adds a data item', () => { + it('can add and remove items, which persist after saving', () => { + cy.log('navigates to the start page and adds a data item') goToStartPage() openDimension(DIMENSION_ID_DATA) - selectDataElements([TEST_DATA_ELEMENT_NAME]) + selectDataElements(['ANC 2nd visit']) clickDimensionModalUpdateButton() expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - }) - const TEST_ITEM = 'Hospital' - it('adds an item manually', () => { + + const TEST_ITEM = 'Hospital' + cy.log('adds an item manually') openDimension(TEST_DYNAMIC_DIMENSION.id) expectDimensionModalToBeVisible(TEST_DYNAMIC_DIMENSION.id) expectManualSelectionToBeChecked() @@ -49,8 +47,8 @@ describe(`Dynamic dimension - ${TEST_DYNAMIC_DIMENSION.name}`, () => { expectVisualizationToBeVisible(VIS_TYPE_COLUMN) expectWindowConfigSeriesToHaveLength(1) expectDimensionToHaveItemAmount(TEST_DYNAMIC_DIMENSION.id, 1) - }) - it('adds all items automatically', () => { + + cy.log('adds all items automatically') openDimension(TEST_DYNAMIC_DIMENSION.id) expectDimensionModalToBeVisible(TEST_DYNAMIC_DIMENSION.id) expectManualSelectionToBeChecked() @@ -60,8 +58,8 @@ describe(`Dynamic dimension - ${TEST_DYNAMIC_DIMENSION.name}`, () => { expectVisualizationToBeVisible(VIS_TYPE_COLUMN) expectWindowConfigSeriesToHaveLength(TEST_DYNAMIC_DIMENSION.itemAmount) expectDimensionToHaveAllItemsSelected(TEST_DYNAMIC_DIMENSION.id) - }) - it('switches back to manual and previous item is presisted', () => { + + cy.log('switches back to manual and previous item is persisted') openDimension(TEST_DYNAMIC_DIMENSION.id) expectDimensionModalToBeVisible(TEST_DYNAMIC_DIMENSION.id) expectAutomaticSelectionToBeChecked() @@ -72,8 +70,8 @@ describe(`Dynamic dimension - ${TEST_DYNAMIC_DIMENSION.name}`, () => { expectVisualizationToBeVisible(VIS_TYPE_COLUMN) expectWindowConfigSeriesToHaveLength(1) expectDimensionToHaveItemAmount(TEST_DYNAMIC_DIMENSION.id, 1) - }) - it('switches back to automatic, saving, the selection is presisted', () => { + + cy.log('switches back to automatic, saving, the selection is persisted') openDimension(TEST_DYNAMIC_DIMENSION.id) expectDimensionModalToBeVisible(TEST_DYNAMIC_DIMENSION.id) expectManualSelectionToBeChecked() diff --git a/packages/plugin/src/VisualizationPlugin.js b/packages/plugin/src/VisualizationPlugin.js index 2ad794e643..a46c704924 100644 --- a/packages/plugin/src/VisualizationPlugin.js +++ b/packages/plugin/src/VisualizationPlugin.js @@ -267,6 +267,12 @@ export const VisualizationPlugin = ({ } : style + // force height when no value available otherwise the PivotTable container sets 0 as height hiding the table content + // and Highcharts does not render correctly the chart/legend + if (!transformedStyle.height) { + transformedStyle.height = '100%' + } + const getLegendKey = () => { if (hasLegendSet && forDashboard) { return ( @@ -330,8 +336,7 @@ export const VisualizationPlugin = ({ onDrill ? onToggleContextualMenu : undefined } id={id} - // force height otherwise the PivotTable container sets 0 as height hiding the table content - style={{ ...transformedStyle, height: '100%' }} + style={transformedStyle} /> ) : (