diff --git a/cypress/elements/fileMenu/index.js b/cypress/elements/fileMenu/index.js index db31dfaa09..cec32b8baf 100644 --- a/cypress/elements/fileMenu/index.js +++ b/cypress/elements/fileMenu/index.js @@ -1,9 +1,7 @@ -import { clickMenuBarFileButton } from '../menuBar.js' +import { clickMenuBarFileButton, menubarEl } from '../menuBar.js' const deleteModalEl = 'file-menu-delete-modal' const fileMenuContainerEl = 'file-menu-container' -const fileMenuToggleEl = 'file-menu-toggle' -const fileMenuToggleLayerEl = 'file-menu-toggle-layer' export const FILE_MENU_BUTTON_NEW = 'New' export const FILE_MENU_BUTTON_OPEN = 'Open…' @@ -16,12 +14,11 @@ export const FILE_MENU_BUTTON_SHARE = 'Share…' export const FILE_MENU_BUTTON_GETLINK = 'Get link…' export const FILE_MENU_BUTTON_DELETE = 'Delete' -export const closeFileMenuWithClick = () => - cy.getBySel(fileMenuToggleLayerEl).click('topLeft') +export const closeFileMenuWithClick = () => cy.get('body').click() export const closeFileMenuWithEsc = () => - cy.getBySel(fileMenuToggleEl).type('{esc}', { force: true }) -// use force as the element that's being typed into is hidden + // use force as the element that's being typed into is hidden + cy.getBySel(menubarEl).contains('File').type('{esc}', { force: true }) export const clickFileMenuButton = (buttonName) => cy.getBySel(fileMenuContainerEl).contains(buttonName).click() diff --git a/cypress/elements/menuBar.js b/cypress/elements/menuBar.js index 22bf72f3e0..4811c77b56 100644 --- a/cypress/elements/menuBar.js +++ b/cypress/elements/menuBar.js @@ -1,4 +1,4 @@ -const menubarEl = 'app-menubar' +export const menubarEl = 'dhis2-analytics-hovermenubar' const updateButton = 'app-menubar-update-button' const optionsButton = 'app-menubar-options-button' @@ -7,5 +7,11 @@ export const clickMenuBarUpdateButton = () => cy.getBySel(updateButton).click() export const clickMenuBarFileButton = () => cy.getBySel(menubarEl).contains('File').click() -export const clickMenuBarOptionsButton = () => - cy.getBySel(optionsButton).click() +export function clickMenuBarOptionsButton() { + return cy.getBySel(optionsButton).click() +} + +export const openOptionsModal = (section = 'Data') => { + clickMenuBarOptionsButton() + return cy.getBySel('options-menu-list').contains(section).click() +} diff --git a/cypress/integration/options/axes.cy.js b/cypress/integration/options/axes.cy.js index 6ca92a3144..8b42ce1868 100644 --- a/cypress/integration/options/axes.cy.js +++ b/cypress/integration/options/axes.cy.js @@ -8,7 +8,7 @@ import { clickDimensionModalUpdateButton, } from '../../elements/dimensionModal/index.js' import { openDimension } from '../../elements/dimensionsPanel.js' -import { clickMenuBarOptionsButton } from '../../elements/menuBar.js' +import { openOptionsModal } from '../../elements/menuBar.js' import { clickOptionsModalUpdateButton, clickOptionsTab, @@ -57,8 +57,7 @@ describe('Options - Vertical axis', () => { }) describe('title', () => { it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) }) it("sets axis title to 'Custom'", () => { setAxisTitleTextModeTo('Custom') @@ -76,8 +75,7 @@ describe('Options - Vertical axis', () => { }) describe('range', () => { it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) }) it('sets min value', () => { setAxisRangeMinValue(TEST_AXIS, TEST_MIN_VALUE) @@ -111,8 +109,7 @@ describe('Options - Vertical axis', () => { }) describe('options modal keeps changes when reopening', () => { it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) }) it(`title is "${TEST_TITLE}"`, () => { expectAxisTitleToBeValue(TEST_AXIS, TEST_TITLE) @@ -141,8 +138,7 @@ describe('Options - Horizontal axis', () => { }) describe('title', () => { it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) }) it(`switches to '${TEST_TAB}' tab`, () => { switchAxesTabTo(TEST_TAB) @@ -163,8 +159,7 @@ describe('Options - Horizontal axis', () => { }) describe('options modal keeps changes when reopening', () => { it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) }) it(`switches to '${TEST_TAB}' tab`, () => { switchAxesTabTo(TEST_TAB) @@ -185,8 +180,7 @@ describe('Options - Auto-generated axis title', () => { }) describe('Single item - single axis', () => { it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) }) it("sets axis title to 'Auto generated'", () => { setAxisTitleTextModeTo('Auto generated') @@ -238,8 +232,7 @@ describe('Options - Auto-generated axis title', () => { expectVisualizationToBeVisible(VIS_TYPE_COLUMN) }) it('opens Options -> Series', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_SERIES) + openOptionsModal(OPTIONS_TAB_SERIES) }) it('enables multi axis', () => { setItemToAxis(1, 2) diff --git a/cypress/integration/options/fontStyles.cy.js b/cypress/integration/options/fontStyles.cy.js index 4f445c95d9..15408d334f 100644 --- a/cypress/integration/options/fontStyles.cy.js +++ b/cypress/integration/options/fontStyles.cy.js @@ -9,11 +9,10 @@ import { clickDimensionModalUpdateButton, } from '../../elements/dimensionModal/index.js' import { openDimension } from '../../elements/dimensionsPanel.js' -import { clickMenuBarOptionsButton } from '../../elements/menuBar.js' +import { openOptionsModal } from '../../elements/menuBar.js' import { changeFontSizeOption, clickOptionsModalUpdateButton, - clickOptionsTab, changeTextAlignOption, clickBoldButton, clickItalicButton, @@ -129,8 +128,7 @@ describe('Options - Font styles', () => { expectWindowConfigTitleToBeValue(CONFIG_DEFAULT_TITLE) }) it('opens Options -> Style', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_STYLE) + openOptionsModal(OPTIONS_TAB_STYLE) }) setFontStyleOptions({ fontSize: TEST_FONT_SIZE_OPTION.input, @@ -174,8 +172,7 @@ describe('Options - Font styles', () => { expectWindowConfigSubtitleToBeValue(CONFIG_DEFAULT_SUBTITLE) }) it('opens Options -> Style', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_STYLE) + openOptionsModal(OPTIONS_TAB_STYLE) }) it('sets a custom subtitle', () => { setCustomSubtitle(TEST_SUBTITLE_TEXT) @@ -220,8 +217,7 @@ describe('Options - Font styles', () => { const prefix = TARGET_LINE_PREFIX it('opens Options -> Data', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_DATA) + openOptionsModal(OPTIONS_TAB_DATA) }) it('sets target line', () => { cy.log(`Test value: ${TEST_VALUE}`) @@ -280,8 +276,7 @@ describe('Options - Font styles', () => { const prefix = BASE_LINE_PREFIX it('opens Options -> Data', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_DATA) + openOptionsModal(OPTIONS_TAB_DATA) }) it('sets base line', () => { cy.log(`Test value: ${TEST_VALUE}`) @@ -338,8 +333,7 @@ describe('Options - Font styles', () => { const prefix = SERIES_KEY_PREFIX it('opens Options -> Style', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_STYLE) + openOptionsModal(OPTIONS_TAB_STYLE) }) setFontStyleOptions({ fontSize: TEST_FONT_SIZE_OPTION.input, @@ -375,8 +369,7 @@ describe('Options - Font styles', () => { const prefix = VERTICAL_AXIS_LABELS_PREFIX it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) }) setFontStyleOptions({ fontSize: TEST_FONT_SIZE_OPTION.input, @@ -410,8 +403,7 @@ describe('Options - Font styles', () => { const prefix = HORIZONTAL_AXIS_LABELS_PREFIX it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) switchAxesTabTo('Horizontal (x) axis') }) setFontStyleOptions({ @@ -451,8 +443,7 @@ describe('Options - Font styles', () => { const prefix = HORIZONTAL_AXIS_TITLE_PREFIX it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) }) it(`sets horizontal axis title to "${TEST_TITLE}"`, () => { switchAxesTabTo('Horizontal (x) axis') @@ -500,8 +491,7 @@ describe('Options - Font styles', () => { const prefix = VERTICAL_AXIS_TITLE_PREFIX it('opens Options -> Axes', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) }) it(`sets vertical axis title to "${TEST_TITLE}"`, () => { setAxisTitleTextModeTo('Custom') diff --git a/cypress/integration/options/icon.cy.js b/cypress/integration/options/icon.cy.js index 66b8942338..541e586eac 100644 --- a/cypress/integration/options/icon.cy.js +++ b/cypress/integration/options/icon.cy.js @@ -27,7 +27,7 @@ import { unselectAllItemsByButton, } from '../../elements/dimensionModal/index.js' import { openDimension } from '../../elements/dimensionsPanel.js' -import { clickMenuBarOptionsButton } from '../../elements/menuBar.js' +import { openOptionsModal } from '../../elements/menuBar.js' import { OPTIONS_TAB_LEGEND, OPTIONS_TAB_STYLE, @@ -97,8 +97,7 @@ describe('Icon', () => { TEST_TYPES.forEach((type) => { it(`icon shows when option is enabled for ${type}`, () => { // enable the icon - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_STYLE) + openOptionsModal(OPTIONS_TAB_STYLE) clickCheckbox('option-show-data-item-icon') clickOptionsModalHideButton() @@ -129,8 +128,7 @@ describe('Icon', () => { // TODO: Skipped because of the same reason as the commented out tests above it.skip('icon gets correct color when a legend is in use', () => { // enable the icon - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_STYLE) + openOptionsModal(OPTIONS_TAB_STYLE) clickCheckbox('option-show-data-item-icon') // enable the legend @@ -176,8 +174,7 @@ describe('Icon', () => { expectSingleValueToHaveIconColor('#ffffff') // switch to apply legend color to text - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) changeDisplayStyleToText() clickOptionsModalUpdateButton() diff --git a/cypress/integration/options/legend.cy.js b/cypress/integration/options/legend.cy.js index 022ea9e717..4b1d67b9cd 100644 --- a/cypress/integration/options/legend.cy.js +++ b/cypress/integration/options/legend.cy.js @@ -31,15 +31,14 @@ import { openDimension, } from '../../elements/layout.js' import { - clickMenuBarOptionsButton, clickMenuBarUpdateButton, + openOptionsModal, } from '../../elements/menuBar.js' import { changeDisplayStrategyToFixed, changeDisplayStyleToText, changeFixedLegendSet, clickOptionsModalUpdateButton, - clickOptionsTab, toggleLegend, expectFixedLegendSetToBe, expectLegendDisplayStrategyToBeByDataItem, @@ -102,8 +101,7 @@ describe('Options - Legend', () => { expectVisualizationToBeVisible(VIS_TYPE_COLUMN) }) it('enables legend', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -119,8 +117,7 @@ describe('Options - Legend', () => { ) }) it(`changes legend display strategy to fixed (${TEST_LEGEND_SET})`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeByDataItem() changeDisplayStrategyToFixed() expectLegendDisplayStrategyToBeFixed() @@ -140,8 +137,7 @@ describe('Options - Legend', () => { expectLegendKeyToBeHidden() }) it('verifies that options are persisted', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeFixed() expectFixedLegendSetToBe(TEST_LEGEND_SET) }) @@ -180,8 +176,7 @@ describe('Options - Legend', () => { expectSingleValueToNotHaveBackgroundColor() }) it('enables legend', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -197,8 +192,7 @@ describe('Options - Legend', () => { expectSVSubtitleToHaveColor(EXPECTED_STANDARD_SUBTITLE_COLOR) }) it('changes legend display style to text color', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeByDataItem() expectLegendDisplayStyleToBeFill() changeDisplayStyleToText() @@ -214,8 +208,7 @@ describe('Options - Legend', () => { expectSVSubtitleToHaveColor(EXPECTED_STANDARD_SUBTITLE_COLOR) }) it(`changes legend display strategy to fixed (${TEST_LEGEND_SET_WITH_CONTRAST})`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStyleToBeText() expectLegendDisplayStrategyToBeByDataItem() changeDisplayStrategyToFixed() @@ -232,8 +225,7 @@ describe('Options - Legend', () => { expectSVSubtitleToHaveColor(EXPECTED_STANDARD_SUBTITLE_COLOR) }) it('changes legend display style to background color', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeFixed() expectLegendDisplayStyleToBeText() changeDisplayStyleToFill() @@ -249,8 +241,7 @@ describe('Options - Legend', () => { expectSVSubtitleToHaveColor(EXPECTED_CONTRAST_TEXT_COLOR) }) it(`changes title and subtitle colors`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_STYLE) + openOptionsModal(OPTIONS_TAB_STYLE) changeColor('option-chart-title', EXPECTED_CUSTOM_TITLE_COLOR) changeColor('option-chart-subtitle', EXPECTED_CUSTOM_SUBTITLE_COLOR) clickOptionsModalUpdateButton() @@ -263,8 +254,7 @@ describe('Options - Legend', () => { expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) }) it('changes legend display style to text color', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeFixed() expectLegendDisplayStyleToBeFill() changeDisplayStyleToText() @@ -280,8 +270,7 @@ describe('Options - Legend', () => { expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) }) it(`changes legend display strategy to by data item`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStyleToBeText() expectLegendDisplayStrategyToBeFixed() changeDisplayStrategyToByDataItem() @@ -297,8 +286,7 @@ describe('Options - Legend', () => { expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) }) it('changes legend display style to background color', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) changeDisplayStrategyToByDataItem() expectLegendDisplayStyleToBeText() changeDisplayStyleToFill() @@ -317,8 +305,7 @@ describe('Options - Legend', () => { expectLegendKeyToBeHidden() }) it('enables legend key option', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegendKeyOption() expectLegendKeyOptionToBeEnabled() clickOptionsModalUpdateButton() @@ -342,8 +329,7 @@ describe('Options - Legend', () => { expectVisualizationToBeVisible(VIS_TYPE_GAUGE) }) it('enables legend', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -355,8 +341,7 @@ describe('Options - Legend', () => { expectWindowConfigYAxisToHaveColor(EXPECTED_BY_DATA_COLOR) }) it(`changes legend display strategy to fixed (${TEST_LEGEND_SET})`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeByDataItem() expectLegendDisplayStyleToBeFill() changeDisplayStrategyToFixed() @@ -369,8 +354,7 @@ describe('Options - Legend', () => { expectWindowConfigYAxisToHaveColor(EXPECTED_FIXED_COLOR) }) it('changes legend display style to text color', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeFixed() expectFixedLegendSetToBe(TEST_LEGEND_SET) expectLegendDisplayStyleToBeFill() @@ -389,8 +373,7 @@ describe('Options - Legend', () => { expectLegendKeyToBeHidden() }) it('verifies that options are persisted', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeFixed() expectFixedLegendSetToBe(TEST_LEGEND_SET) }) @@ -415,8 +398,7 @@ describe('Options - Legend', () => { expectVisualizationToBeVisible(VIS_TYPE_STACKED_COLUMN) }) it('enables legend', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -432,8 +414,7 @@ describe('Options - Legend', () => { ) }) it(`changes legend display strategy to fixed (${TEST_LEGEND_SET})`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeByDataItem() changeDisplayStrategyToFixed() expectLegendDisplayStrategyToBeFixed() @@ -453,8 +434,7 @@ describe('Options - Legend', () => { expectLegendKeyToBeHidden() }) it('verifies that options are persisted', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeFixed() expectFixedLegendSetToBe(TEST_LEGEND_SET) }) @@ -490,8 +470,7 @@ describe('Options - Legend', () => { }) }) it('enables legend', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -508,8 +487,7 @@ describe('Options - Legend', () => { }) }) it('changes legend display style to text color', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeByDataItem() expectLegendDisplayStyleToBeFill() changeDisplayStyleToText() @@ -529,8 +507,7 @@ describe('Options - Legend', () => { expectLegendKeyToBeHidden() }) it('verifies that options are persisted', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeByDataItem() }) it('enables legend key option', () => { @@ -558,8 +535,7 @@ describe('Options - Legend', () => { expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) }) it('enables legend', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -592,8 +568,7 @@ describe('Options - Legend', () => { ) }) it('verifies that options are persisted', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStyleToBeText() expectLegendDisplayStrategyToBeFixed() }) @@ -613,8 +588,7 @@ describe('Options - Legend', () => { expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) }) it('enables legend', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -643,8 +617,7 @@ describe('Options - Legend', () => { expectSingleValueToHaveBackgroundColor(EXPECTED_FIXED_COLOR) }) it('verifies that options are persisted', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStyleToBeFill() expectLegendDisplayStrategyToBeFixed() }) @@ -658,8 +631,7 @@ describe('Options - Legend', () => { expectVisualizationToBeVisible() }) it('enables legend (Column)', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() clickOptionsModalUpdateButton() @@ -669,8 +641,7 @@ describe('Options - Legend', () => { expectLegendKeyToBeHidden() }) it('enables legend key option (Column)', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegendKeyOption() expectLegendKeyOptionToBeEnabled() clickOptionsModalUpdateButton() @@ -690,8 +661,7 @@ describe('Options - Legend', () => { expectLegedKeyItemAmountToBe(TEST_ITEMS.length) }) it('disables legend key option (Pivot table)', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegendKeyOption() expectLegendKeyOptionToBeDisabled() clickOptionsModalUpdateButton() @@ -709,8 +679,7 @@ describe('Options - Legend', () => { expectLegendKeyToBeHidden() }) it('enables legend key option (Gauge)', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegendKeyOption() expectLegendKeyOptionToBeEnabled() clickOptionsModalUpdateButton() @@ -730,8 +699,7 @@ describe('Options - Legend', () => { expectLegedKeyItemAmountToBe(1) }) it('disables legend key option (Single value)', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegendKeyOption() expectLegendKeyOptionToBeDisabled() clickOptionsModalUpdateButton() @@ -750,8 +718,7 @@ describe('Options - Legend', () => { expectVisualizationToBeVisible(VIS_TYPE_COLUMN) }) it('enables legend', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -777,7 +744,7 @@ describe('Options - Legend', () => { ) }) it('legend options are not available', () => { - clickMenuBarOptionsButton() + openOptionsModal() expectOptionsTabToBeHidden(OPTIONS_TAB_LEGEND) clickOptionsModalHideButton() }) @@ -803,7 +770,7 @@ describe('Options - Legend', () => { ) }) it('legend options are not available', () => { - clickMenuBarOptionsButton() + openOptionsModal() expectOptionsTabToBeHidden(OPTIONS_TAB_LEGEND) }) it('legend key is hidden', () => { @@ -825,8 +792,7 @@ describe('Options - Legend', () => { expectSeriesKeyToHaveSeriesKeyItems(2) }) it('enables legend', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -834,8 +800,7 @@ describe('Options - Legend', () => { expectChartTitleToBeVisible() }) it(`changes legend display strategy to fixed (${TEST_ITEMS[1].legendSet})`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeByDataItem() changeDisplayStrategyToFixed() expectLegendDisplayStrategyToBeFixed() @@ -852,8 +817,7 @@ describe('Options - Legend', () => { selectIndicators([TEST_ITEM.name]) clickDimensionModalUpdateButton() expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -895,8 +859,7 @@ describe('Options - Legend', () => { expectLegendKeyToBeHidden() }) it(`changes legend display strategy to fixed (${TEST_ITEMS[1].legendSet})`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) expectLegendDisplayStrategyToBeByDataItem() changeDisplayStrategyToFixed() expectLegendDisplayStrategyToBeFixed() @@ -924,8 +887,7 @@ describe('Options - Legend', () => { selectIndicators(TEST_ITEMS.map((item) => item.name)) clickDimensionModalUpdateButton() expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_LEGEND) + openOptionsModal(OPTIONS_TAB_LEGEND) toggleLegend() expectLegendToBeEnabled() expectLegendDisplayStrategyToBeByDataItem() @@ -943,8 +905,7 @@ describe('Options - Legend', () => { ) }) it(`changes all items to type ${VIS_TYPE_LINE}`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_SERIES) + openOptionsModal(OPTIONS_TAB_SERIES) TEST_ITEMS.forEach((item, index) => setItemToType(index, VIS_TYPE_LINE) ) @@ -964,8 +925,7 @@ describe('Options - Legend', () => { expectSeriesKeyToHaveSeriesKeyItems(2) }) it(`changes first item (${TEST_ITEMS[0].name}) to type ${VIS_TYPE_COLUMN}`, () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_SERIES) + openOptionsModal(OPTIONS_TAB_SERIES) setItemToType(0, VIS_TYPE_COLUMN) clickOptionsModalUpdateButton() expectVisualizationToBeVisible() @@ -995,8 +955,7 @@ describe('Options - Legend', () => { selectIndicators([TEST_ITEM.name]) clickDimensionModalUpdateButton() expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_SERIES) + openOptionsModal(OPTIONS_TAB_SERIES) setItemToType(2, VIS_TYPE_LINE) clickOptionsModalUpdateButton() expectVisualizationToBeVisible() diff --git a/cypress/integration/options/lines.cy.js b/cypress/integration/options/lines.cy.js index 839925efe5..ea8fef0357 100644 --- a/cypress/integration/options/lines.cy.js +++ b/cypress/integration/options/lines.cy.js @@ -8,10 +8,9 @@ import { clickDimensionModalUpdateButton, } from '../../elements/dimensionModal/index.js' import { openDimension } from '../../elements/dimensionsPanel.js' -import { clickMenuBarOptionsButton } from '../../elements/menuBar.js' +import { openOptionsModal } from '../../elements/menuBar.js' import { clickOptionsModalUpdateButton, - clickOptionsTab, clickTrendLineCheckbox, OPTIONS_TAB_DATA, selectTrendLineType, @@ -51,8 +50,7 @@ describe('Options - Lines', () => { trendLineTypes.forEach((trendLineType, index) => { describe(trendLineType.name, () => { it('opens Options -> Data', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_DATA) + openOptionsModal(OPTIONS_TAB_DATA) }) if (index === 0) { it('enables trendline', () => { @@ -79,7 +77,7 @@ describe('Options - Lines', () => { }) }) }) - /* TODO: + /* TODO: - Test base line and target line like trend line (above) - Pie, PT, SV shouldn't have the lines section in options - Gauge should only display base and target line (no trend line) diff --git a/cypress/integration/visTypes/scatter.cy.js b/cypress/integration/visTypes/scatter.cy.js index 88dea58ccd..6fba12f094 100644 --- a/cypress/integration/visTypes/scatter.cy.js +++ b/cypress/integration/visTypes/scatter.cy.js @@ -36,12 +36,11 @@ import { openDimensionOnAxis, } from '../../elements/layout.js' import { - clickMenuBarOptionsButton, clickMenuBarUpdateButton, + openOptionsModal, } from '../../elements/menuBar.js' import { clickOptionsModalUpdateButton, - clickOptionsTab, clickOutliersCheckbox, OPTIONS_TAB_AXES, OPTIONS_TAB_OUTLIERS, @@ -166,8 +165,7 @@ describe('using a Scatter chart', () => { max: 200, }, ] - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_AXES) + openOptionsModal(OPTIONS_TAB_AXES) TEST_AXES.forEach((test) => { switchAxesTabTo(test.label) setAxisRangeMinValue(test.axis, test.min) @@ -181,8 +179,7 @@ describe('using a Scatter chart', () => { expectWindowConfigXAxisToHaveRangeMaxValue(TEST_AXES[1].max) }) it('Options -> Outliers -> enables outliers', () => { - clickMenuBarOptionsButton() - clickOptionsTab(OPTIONS_TAB_OUTLIERS) + openOptionsModal(OPTIONS_TAB_OUTLIERS) clickOutliersCheckbox() // TODO: Set more outlier options clickOptionsModalUpdateButton() diff --git a/i18n/en.pot b/i18n/en.pot index e739fac14c..148b9e9dcb 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2023-03-07T12:07:38.393Z\n" -"PO-Revision-Date: 2023-03-07T12:07:38.393Z\n" +"POT-Creation-Date: 2023-05-30T12:32:59.044Z\n" +"PO-Revision-Date: 2023-05-30T12:32:59.044Z\n" msgid "All items" msgstr "All items" @@ -210,9 +210,6 @@ msgstr "Select a period" msgid "Select years" msgstr "Select years" -msgid "Interpretations" -msgstr "Interpretations" - msgid "" "This visualization can't be deleted because it is used on one or more " "dashboards" diff --git a/package.json b/package.json index 24b19270ee..d647189afb 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "start-server-and-test": "^2.0.0" }, "dependencies": { - "@dhis2/analytics": "^25.1.11", + "@dhis2/analytics": "^26.0.7", "@dhis2/app-runtime": "^3.7.0", "@dhis2/app-runtime-adapter-d2": "^1.1.0", "@dhis2/app-service-datastore": "^1.0.0-beta.3", diff --git a/src/components/App.css b/src/components/App.css index 8aea36a21f..9508d24b08 100644 --- a/src/components/App.css +++ b/src/components/App.css @@ -37,22 +37,6 @@ body { height: 48px; } -/* Toolbar */ - -.section-toolbar { - height: 39px; -} - -.toolbar-type { - width: 260px; - border-right: 1px solid var(--colors-grey400); - border-bottom: 1px solid var(--colors-grey400); -} - -.toolbar-menubar { - background-color: var(--colors-grey400); -} - /* Main */ .section-main { overflow: hidden; diff --git a/src/components/App.js b/src/components/App.js index 7e67b30a06..f268ab0f4c 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -1,4 +1,4 @@ -import { apiFetchOrganisationUnitLevels } from '@dhis2/analytics' +import { apiFetchOrganisationUnitLevels, Toolbar } from '@dhis2/analytics' import { useSetting } from '@dhis2/app-service-datastore' import i18n from '@dhis2/d2-i18n' import { @@ -233,17 +233,13 @@ export class UnconnectedApp extends Component { return ( <>