diff --git a/cypress/integration/options/legend.cy.js b/cypress/integration/options/legend.cy.js index 6dcf3a1940..38444a62d1 100644 --- a/cypress/integration/options/legend.cy.js +++ b/cypress/integration/options/legend.cy.js @@ -93,67 +93,67 @@ const TEST_ITEMS = [ const TEST_LEGEND_SET = 'Height in cm' describe('Options - Legend', () => { - describe('Applying a legend: Column', () => { - it('navigates to the start page and adds data items', () => { - goToStartPage() - openDimension(DIMENSION_ID_DATA) - selectIndicators(TEST_ITEMS.map((item) => item.name)) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - }) - it('enables legend', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - clickOptionsModalUpdateButton() - expectChartTitleToBeVisible() - }) - it('legend by data item is applied', () => { - TEST_ITEMS.forEach((item) => - expectWindowConfigSeriesItemToHaveLegendSet( - item.name, - item.legendSet - ) + it('Applying a legend: Column', () => { + // navigates to the start page and add data items + goToStartPage() + openDimension(DIMENSION_ID_DATA) + selectIndicators(TEST_ITEMS.map((item) => item.name)) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_COLUMN) + + // enables legend + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + clickOptionsModalUpdateButton() + expectChartTitleToBeVisible() + + // verifies legend by data item is applied + TEST_ITEMS.forEach((item) => + expectWindowConfigSeriesItemToHaveLegendSet( + item.name, + item.legendSet ) - }) - it(`changes legend display strategy to fixed (${TEST_LEGEND_SET})`, () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeByDataItem() - changeDisplayStrategyToFixed() - expectLegendDisplayStrategyToBeFixed() - changeFixedLegendSet(TEST_LEGEND_SET) - clickOptionsModalUpdateButton() - expectChartTitleToBeVisible() - }) - it('fixed legend is applied', () => { - TEST_ITEMS.forEach((item) => - expectWindowConfigSeriesItemToHaveLegendSet( - item.name, - TEST_LEGEND_SET - ) + ) + + cy.log(`changes legend display strategy to fixed (${TEST_LEGEND_SET})`) + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeByDataItem() + changeDisplayStrategyToFixed() + expectLegendDisplayStrategyToBeFixed() + changeFixedLegendSet(TEST_LEGEND_SET) + clickOptionsModalUpdateButton() + expectChartTitleToBeVisible() + + // verifies fixed legend is applied + TEST_ITEMS.forEach((item) => + expectWindowConfigSeriesItemToHaveLegendSet( + item.name, + TEST_LEGEND_SET ) - }) - it('legend key is hidden', () => { - expectLegendKeyToBeHidden() - }) - it('verifies that options are persisted', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeFixed() - expectFixedLegendSetToBe(TEST_LEGEND_SET) - }) - it('enables legend key option', () => { - toggleLegendKeyOption() - expectLegendKeyOptionToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - }) - it('legend key is shown with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) + ) + + // verifies legend key is hidden + expectLegendKeyToBeHidden() + + // verifies that options are persisted + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeFixed() + expectFixedLegendSetToBe(TEST_LEGEND_SET) + + // enables legend key option + toggleLegendKeyOption() + expectLegendKeyOptionToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + + // verifies legend key is shown with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) }) - describe('Applying a legend: Single value', () => { + + it('Applying a legend: Single value', () => { const TEST_ITEM = TEST_ITEMS[0] const EXPECTED_STANDARD_TEXT_COLOR = '#212934' const EXPECTED_CONTRAST_TEXT_COLOR = '#ffffff' @@ -166,835 +166,832 @@ describe('Options - Legend', () => { const TEST_LEGEND_SET_WITH_CONTRAST = 'Age 15y interval' const EXPECTED_STANDARD_TITLE_COLOR = '#212934' const EXPECTED_STANDARD_SUBTITLE_COLOR = '#4a5768' - it('navigates to the start page and adds data items', () => { - goToStartPage() - changeVisType(visTypeDisplayNames[VIS_TYPE_SINGLE_VALUE]) - openDimension(DIMENSION_ID_DATA) - selectIndicators([TEST_ITEM.name]) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - expectSingleValueToHaveTextColor(EXPECTED_STANDARD_TEXT_COLOR) - expectSingleValueToNotHaveBackgroundColor() - }) - it('enables legend', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - expectLegendDisplayStyleToBeFill() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) + + // navigates to the start page and adds data items + goToStartPage() + changeVisType(visTypeDisplayNames[VIS_TYPE_SINGLE_VALUE]) + openDimension(DIMENSION_ID_DATA) + selectIndicators([TEST_ITEM.name]) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + expectSingleValueToHaveTextColor(EXPECTED_STANDARD_TEXT_COLOR) + expectSingleValueToNotHaveBackgroundColor() + + // enables legend + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + expectLegendDisplayStyleToBeFill() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + // Legend on background, no contrast, no custom title colors - it('background color legend is applied', () => { - expectSingleValueToHaveTextColor(EXPECTED_STANDARD_TEXT_COLOR) - expectSingleValueToHaveBackgroundColor(EXPECTED_BACKGROUND_COLOR_1) - expectSVTitleToHaveColor(EXPECTED_STANDARD_TITLE_COLOR) - expectSVSubtitleToHaveColor(EXPECTED_STANDARD_SUBTITLE_COLOR) - }) - it('changes legend display style to text color', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeByDataItem() - expectLegendDisplayStyleToBeFill() - changeDisplayStyleToText() - expectLegendDisplayStyleToBeText() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) + // verifies background color legend is applied + expectSingleValueToHaveTextColor(EXPECTED_STANDARD_TEXT_COLOR) + expectSingleValueToHaveBackgroundColor(EXPECTED_BACKGROUND_COLOR_1) + expectSVTitleToHaveColor(EXPECTED_STANDARD_TITLE_COLOR) + expectSVSubtitleToHaveColor(EXPECTED_STANDARD_SUBTITLE_COLOR) + + // changes legend display style to text color + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeByDataItem() + expectLegendDisplayStyleToBeFill() + changeDisplayStyleToText() + expectLegendDisplayStyleToBeText() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + // Legend on text, no contrast, no custom title colors - it('text color legend is applied', () => { - expectSingleValueToHaveTextColor(EXPECTED_TEXT_COLOR_1) - expectSingleValueToNotHaveBackgroundColor() - expectSVTitleToHaveColor(EXPECTED_STANDARD_TITLE_COLOR) - expectSVSubtitleToHaveColor(EXPECTED_STANDARD_SUBTITLE_COLOR) - }) - it(`changes legend display strategy to fixed (${TEST_LEGEND_SET_WITH_CONTRAST})`, () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStyleToBeText() - expectLegendDisplayStrategyToBeByDataItem() - changeDisplayStrategyToFixed() - expectLegendDisplayStrategyToBeFixed() - changeFixedLegendSet(TEST_LEGEND_SET_WITH_CONTRAST) - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) - // Legend on text, with contrast (N/A), no custom title colors - it('text color legend is applied', () => { - expectSingleValueToHaveTextColor(EXPECTED_TEXT_COLOR_2) - expectSingleValueToNotHaveBackgroundColor() - expectSVTitleToHaveColor(EXPECTED_STANDARD_TITLE_COLOR) - expectSVSubtitleToHaveColor(EXPECTED_STANDARD_SUBTITLE_COLOR) - }) - it('changes legend display style to background color', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeFixed() - expectLegendDisplayStyleToBeText() - changeDisplayStyleToFill() - expectLegendDisplayStyleToBeFill() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) + // verifies text color legend is applied + expectSingleValueToHaveTextColor(EXPECTED_TEXT_COLOR_1) + expectSingleValueToNotHaveBackgroundColor() + expectSVTitleToHaveColor(EXPECTED_STANDARD_TITLE_COLOR) + expectSVSubtitleToHaveColor(EXPECTED_STANDARD_SUBTITLE_COLOR) + + cy.log( + `changes legend display strategy to fixed ${TEST_LEGEND_SET_WITH_CONTRAST}` + ) + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStyleToBeText() + expectLegendDisplayStrategyToBeByDataItem() + changeDisplayStrategyToFixed() + expectLegendDisplayStrategyToBeFixed() + changeFixedLegendSet(TEST_LEGEND_SET_WITH_CONTRAST) + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + + // Legend on text, with contrast (N/, no custom title colors + // verifies text color legend is applied + expectSingleValueToHaveTextColor(EXPECTED_TEXT_COLOR_2) + expectSingleValueToNotHaveBackgroundColor() + expectSVTitleToHaveColor(EXPECTED_STANDARD_TITLE_COLOR) + expectSVSubtitleToHaveColor(EXPECTED_STANDARD_SUBTITLE_COLOR) + + // changees legend display style to background color + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeFixed() + expectLegendDisplayStyleToBeText() + changeDisplayStyleToFill() + expectLegendDisplayStyleToBeFill() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + // Legend on background, with contrast, no custom title colors - it('background color legend and contrast text color is applied', () => { - expectSingleValueToHaveTextColor(EXPECTED_CONTRAST_TEXT_COLOR) - expectSingleValueToHaveBackgroundColor(EXPECTED_BACKGROUND_COLOR_2) - expectSVTitleToHaveColor(EXPECTED_CONTRAST_TEXT_COLOR) - expectSVSubtitleToHaveColor(EXPECTED_CONTRAST_TEXT_COLOR) - }) - it(`changes title and subtitle colors`, () => { - openOptionsModal(OPTIONS_TAB_STYLE) - changeColor('option-chart-title', EXPECTED_CUSTOM_TITLE_COLOR) - changeColor('option-chart-subtitle', EXPECTED_CUSTOM_SUBTITLE_COLOR) - clickOptionsModalUpdateButton() - }) - // Legend on background, with contrast, with custom title colors - it('background color legend, contrast text color and custom title colors are applied', () => { - expectSingleValueToHaveTextColor(EXPECTED_CONTRAST_TEXT_COLOR) - expectSingleValueToHaveBackgroundColor(EXPECTED_BACKGROUND_COLOR_2) - expectSVTitleToHaveColor(EXPECTED_CUSTOM_TITLE_COLOR) - expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) - }) - it('changes legend display style to text color', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeFixed() - expectLegendDisplayStyleToBeFill() - changeDisplayStyleToText() - expectLegendDisplayStyleToBeText() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) - // Legend on text, with contrast, with custom title colors - it('text color legend and custom title colors are applied', () => { - expectSingleValueToHaveTextColor(EXPECTED_TEXT_COLOR_2) - expectSingleValueToNotHaveBackgroundColor() - expectSVTitleToHaveColor(EXPECTED_CUSTOM_TITLE_COLOR) - expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) - }) - it(`changes legend display strategy to by data item`, () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStyleToBeText() - expectLegendDisplayStrategyToBeFixed() - changeDisplayStrategyToByDataItem() - expectLegendDisplayStrategyToBeByDataItem() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) - // Legend on text, no contrast, with custom title colors - it('text color legend and custom title colors are applied', () => { - expectSingleValueToHaveTextColor(EXPECTED_TEXT_COLOR_1) - expectSingleValueToNotHaveBackgroundColor() - expectSVTitleToHaveColor(EXPECTED_CUSTOM_TITLE_COLOR) - expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) - }) - it('changes legend display style to background color', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - changeDisplayStrategyToByDataItem() - expectLegendDisplayStyleToBeText() - changeDisplayStyleToFill() - expectLegendDisplayStyleToBeFill() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) + // verifies background color legend and contrast text color is applied + expectSingleValueToHaveTextColor(EXPECTED_CONTRAST_TEXT_COLOR) + expectSingleValueToHaveBackgroundColor(EXPECTED_BACKGROUND_COLOR_2) + expectSVTitleToHaveColor(EXPECTED_CONTRAST_TEXT_COLOR) + expectSVSubtitleToHaveColor(EXPECTED_CONTRAST_TEXT_COLOR) + + // changes title and subtitle colors + openOptionsModal(OPTIONS_TAB_STYLE) + changeColor('option-chart-title', EXPECTED_CUSTOM_TITLE_COLOR) + changeColor('option-chart-subtitle', EXPECTED_CUSTOM_SUBTITLE_COLOR) + clickOptionsModalUpdateButton() + + // Legend on background, with contrast, with custom title colo + // verifies background color legend, contrast text color and custom title colors are applied + expectSingleValueToHaveTextColor(EXPECTED_CONTRAST_TEXT_COLOR) + expectSingleValueToHaveBackgroundColor(EXPECTED_BACKGROUND_COLOR_2) + expectSVTitleToHaveColor(EXPECTED_CUSTOM_TITLE_COLOR) + expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) + + // changes legend display style to text color + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeFixed() + expectLegendDisplayStyleToBeFill() + changeDisplayStyleToText() + expectLegendDisplayStyleToBeText() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + + // Legend on text, with contrast, with custom title colo + // verifies text color legend and custom title colors are applied + expectSingleValueToHaveTextColor(EXPECTED_TEXT_COLOR_2) + expectSingleValueToNotHaveBackgroundColor() + expectSVTitleToHaveColor(EXPECTED_CUSTOM_TITLE_COLOR) + expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) + + // changes legend display strategy to by data item + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStyleToBeText() + expectLegendDisplayStrategyToBeFixed() + changeDisplayStrategyToByDataItem() + expectLegendDisplayStrategyToBeByDataItem() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + + // Legend on text, no contrast, with custom title colo + // verifies text color legend and custom title colors are applied + expectSingleValueToHaveTextColor(EXPECTED_TEXT_COLOR_1) + expectSingleValueToNotHaveBackgroundColor() + expectSVTitleToHaveColor(EXPECTED_CUSTOM_TITLE_COLOR) + expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) + + // changes legend display style to background color + openOptionsModal(OPTIONS_TAB_LEGEND) + changeDisplayStrategyToByDataItem() + expectLegendDisplayStyleToBeText() + changeDisplayStyleToFill() + expectLegendDisplayStyleToBeFill() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + // Legend on background, no contrast, with custom title colors - it('background color legend and custom title colors are applied', () => { - expectSingleValueToHaveTextColor(EXPECTED_STANDARD_TEXT_COLOR) - expectSingleValueToHaveBackgroundColor(EXPECTED_BACKGROUND_COLOR_1) - expectSVTitleToHaveColor(EXPECTED_CUSTOM_TITLE_COLOR) - expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) - }) - it('legend key is hidden', () => { - expectLegendKeyToBeHidden() - }) - it('enables legend key option', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegendKeyOption() - expectLegendKeyOptionToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) - it('legend key is shown with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) + // verifies background color legend and custom title colors are applied + expectSingleValueToHaveTextColor(EXPECTED_STANDARD_TEXT_COLOR) + expectSingleValueToHaveBackgroundColor(EXPECTED_BACKGROUND_COLOR_1) + expectSVTitleToHaveColor(EXPECTED_CUSTOM_TITLE_COLOR) + expectSVSubtitleToHaveColor(EXPECTED_CUSTOM_SUBTITLE_COLOR) + + // verifies legend key is hidden + expectLegendKeyToBeHidden() + + // enables legend key option + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegendKeyOption() + expectLegendKeyOptionToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + + // verifies legend key is shown with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) }) - describe('Applying a legend: Gauge', () => { + it('Applying a legend: Gauge', () => { const TEST_ITEM = TEST_ITEMS[0] const EXPECTED_BY_DATA_COLOR = '#FFFFB2' const EXPECTED_FIXED_COLOR = '#c7e9c0' - it('navigates to the start page and adds data items', () => { - goToStartPage() - changeVisType(visTypeDisplayNames[VIS_TYPE_GAUGE]) - openDimension(DIMENSION_ID_DATA) - selectIndicators([TEST_ITEM.name]) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_GAUGE) - }) - it('enables legend', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - expectLegendDisplayStyleToBeFill() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_GAUGE) - }) - it('legend by data item is applied', () => { - expectWindowConfigYAxisToHaveColor(EXPECTED_BY_DATA_COLOR) - }) - it(`changes legend display strategy to fixed (${TEST_LEGEND_SET})`, () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeByDataItem() - expectLegendDisplayStyleToBeFill() - changeDisplayStrategyToFixed() - expectLegendDisplayStrategyToBeFixed() - changeFixedLegendSet(TEST_LEGEND_SET) - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_GAUGE) - }) - it('fixed legend is applied', () => { - expectWindowConfigYAxisToHaveColor(EXPECTED_FIXED_COLOR) - }) - it('changes legend display style to text color', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeFixed() - expectFixedLegendSetToBe(TEST_LEGEND_SET) - expectLegendDisplayStyleToBeFill() - changeDisplayStyleToText() - expectLegendDisplayStyleToBeText() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_GAUGE) - }) - it('legend style is applied', () => { - expectWindowConfigSeriesDataLabelsToHaveColor( - 0, - EXPECTED_FIXED_COLOR - ) - }) - it('legend key is hidden', () => { - expectLegendKeyToBeHidden() - }) - it('verifies that options are persisted', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeFixed() - expectFixedLegendSetToBe(TEST_LEGEND_SET) - }) - it('enables legend key option', () => { - toggleLegendKeyOption() - expectLegendKeyOptionToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_GAUGE) - }) - it('legend key is shown with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) + + // navigates to the start page and adds data items + goToStartPage() + changeVisType(visTypeDisplayNames[VIS_TYPE_GAUGE]) + openDimension(DIMENSION_ID_DATA) + selectIndicators([TEST_ITEM.name]) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_GAUGE) + + // enables legend + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + expectLegendDisplayStyleToBeFill() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_GAUGE) + + // legend by data item is applied + expectWindowConfigYAxisToHaveColor(EXPECTED_BY_DATA_COLOR) + + cy.log(`changes legend display strategy to fixed (${TEST_LEGEND_SET})`) + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeByDataItem() + expectLegendDisplayStyleToBeFill() + changeDisplayStrategyToFixed() + expectLegendDisplayStrategyToBeFixed() + changeFixedLegendSet(TEST_LEGEND_SET) + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_GAUGE) + + // fixed legend is applied + expectWindowConfigYAxisToHaveColor(EXPECTED_FIXED_COLOR) + + // changes legend display style to text color + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeFixed() + expectFixedLegendSetToBe(TEST_LEGEND_SET) + expectLegendDisplayStyleToBeFill() + changeDisplayStyleToText() + expectLegendDisplayStyleToBeText() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_GAUGE) + + // legend style is applied + expectWindowConfigSeriesDataLabelsToHaveColor(0, EXPECTED_FIXED_COLOR) + + // legend key is hidden + expectLegendKeyToBeHidden() + + // verifies that options are persisted + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeFixed() + expectFixedLegendSetToBe(TEST_LEGEND_SET) + + // enables legend key option + toggleLegendKeyOption() + expectLegendKeyOptionToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_GAUGE) + + // legend key is shown with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) }) - describe('Applying a legend: Stacked column', () => { - it('navigates to the start page and adds data items', () => { - goToStartPage() - changeVisType(visTypeDisplayNames[VIS_TYPE_STACKED_COLUMN]) - openDimension(DIMENSION_ID_DATA) - selectIndicators(TEST_ITEMS.map((item) => item.name)) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_STACKED_COLUMN) - }) - it('enables legend', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - clickOptionsModalUpdateButton() - expectChartTitleToBeVisible() - }) - it('legend by data item is applied', () => { - TEST_ITEMS.forEach((item) => - expectWindowConfigSeriesItemToHaveLegendSet( - item.name, - item.legendSet - ) + it('Applying a legend: Stacked column', () => { + // navigates to the start page and adds data items + goToStartPage() + changeVisType(visTypeDisplayNames[VIS_TYPE_STACKED_COLUMN]) + openDimension(DIMENSION_ID_DATA) + selectIndicators(TEST_ITEMS.map((item) => item.name)) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_STACKED_COLUMN) + + // enables legend + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + clickOptionsModalUpdateButton() + expectChartTitleToBeVisible() + + // legend by data item is applied + TEST_ITEMS.forEach((item) => + expectWindowConfigSeriesItemToHaveLegendSet( + item.name, + item.legendSet ) - }) - it(`changes legend display strategy to fixed (${TEST_LEGEND_SET})`, () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeByDataItem() - changeDisplayStrategyToFixed() - expectLegendDisplayStrategyToBeFixed() - changeFixedLegendSet(TEST_LEGEND_SET) - clickOptionsModalUpdateButton() - expectChartTitleToBeVisible() - }) - it('fixed legend is applied', () => { - TEST_ITEMS.forEach((item) => - expectWindowConfigSeriesItemToHaveLegendSet( - item.name, - TEST_LEGEND_SET - ) + ) + + cy.log(`changes legend display strategy to fixed (${TEST_LEGEND_SET})`) + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeByDataItem() + changeDisplayStrategyToFixed() + expectLegendDisplayStrategyToBeFixed() + changeFixedLegendSet(TEST_LEGEND_SET) + clickOptionsModalUpdateButton() + expectChartTitleToBeVisible() + + // fixed legend is applied + TEST_ITEMS.forEach((item) => + expectWindowConfigSeriesItemToHaveLegendSet( + item.name, + TEST_LEGEND_SET ) - }) - it('legend key is hidden', () => { - expectLegendKeyToBeHidden() - }) - it('verifies that options are persisted', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeFixed() - expectFixedLegendSetToBe(TEST_LEGEND_SET) - }) - it('enables legend key option', () => { - toggleLegendKeyOption() - expectLegendKeyOptionToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - }) - it('legend key is shown with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) + ) + + // legend key is hidden + expectLegendKeyToBeHidden() + + // verifies that options are persisted + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeFixed() + expectFixedLegendSetToBe(TEST_LEGEND_SET) + + // enables legend key option + toggleLegendKeyOption() + expectLegendKeyOptionToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + + // legend key is shown with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) }) describe('Applying a legend: Pivot table', () => { const TEST_ITEM = TEST_ITEMS[0] const EXPECTED_STANDARD_TEXT_COLOR = 'color: rgb(33, 41, 52)' const valueCellEl = 'visualization-value-cell' - it('navigates to the start page and adds data items', () => { - goToStartPage() - changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) - openDimension(DIMENSION_ID_DATA) - selectIndicators([TEST_ITEM.name]) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - }) - it('no legend is applied', () => { - cy.getBySel(valueCellEl).each(($el) => { - cy.wrap($el) - .invoke('attr', 'style') - .should('not.contain', 'color') - .and('not.contain', 'background-color') - }) - }) - it('enables legend', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - expectLegendDisplayStyleToBeFill() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - }) - it('background color legend is applied', () => { - cy.getBySel(valueCellEl).each(($el) => { - cy.wrap($el) - .invoke('attr', 'style') - .should('contain', 'background-color') - .and('contain', EXPECTED_STANDARD_TEXT_COLOR) - }) - }) - it('changes legend display style to text color', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeByDataItem() - expectLegendDisplayStyleToBeFill() - changeDisplayStyleToText() - expectLegendDisplayStyleToBeText() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - }) - it('text color legend is applied', () => { - cy.getBySel(valueCellEl).each(($el) => { - cy.wrap($el) - .invoke('attr', 'style') - .should('not.contain', 'background-color') - .and('not.contain', EXPECTED_STANDARD_TEXT_COLOR) - }) - }) - it('legend key is hidden', () => { - expectLegendKeyToBeHidden() - }) - it('verifies that options are persisted', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeByDataItem() + + // navigates to the start page and adds data items + goToStartPage() + changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) + openDimension(DIMENSION_ID_DATA) + selectIndicators([TEST_ITEM.name]) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + // no legend is applied + cy.getBySel(valueCellEl).each(($el) => { + cy.wrap($el) + .invoke('attr', 'style') + .should('not.contain', 'color') + .and('not.contain', 'background-color') }) - it('enables legend key option', () => { - toggleLegendKeyOption() - expectLegendKeyOptionToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + // enables legend + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + expectLegendDisplayStyleToBeFill() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + // background color legend is applied + cy.getBySel(valueCellEl).each(($el) => { + cy.wrap($el) + .invoke('attr', 'style') + .should('contain', 'background-color') + .and('contain', EXPECTED_STANDARD_TEXT_COLOR) }) - it('legend key is shown with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) + + // changes legend display style to text color + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeByDataItem() + expectLegendDisplayStyleToBeFill() + changeDisplayStyleToText() + expectLegendDisplayStyleToBeText() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + // text color legend is applied + cy.getBySel(valueCellEl).each(($el) => { + cy.wrap($el) + .invoke('attr', 'style') + .should('not.contain', 'background-color') + .and('not.contain', EXPECTED_STANDARD_TEXT_COLOR) }) - it('legend is applied when data is in rows', () => { - // swap data and period - openContextMenu(DIMENSION_ID_PERIOD) - clickContextMenuMove(DIMENSION_ID_PERIOD, AXIS_ID_COLUMNS) - openContextMenu(DIMENSION_ID_DATA) - clickContextMenuMove(DIMENSION_ID_DATA, AXIS_ID_ROWS) - clickMenuBarUpdateButton() - - // expect legend to still be applied - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - cy.getBySel(valueCellEl).each(($el) => { - cy.wrap($el) - .invoke('attr', 'style') - .should('not.contain', 'background-color') - .and('not.contain', EXPECTED_STANDARD_TEXT_COLOR) - }) + + // legend key is hidden + expectLegendKeyToBeHidden() + + // verifies that options are persisted + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeByDataItem() + + // enables legend key option + toggleLegendKeyOption() + expectLegendKeyOptionToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + // legend key is shown with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) + + // legend is applied when data is in rows + // swap data and period + openContextMenu(DIMENSION_ID_PERIOD) + clickContextMenuMove(DIMENSION_ID_PERIOD, AXIS_ID_COLUMNS) + openContextMenu(DIMENSION_ID_DATA) + clickContextMenuMove(DIMENSION_ID_DATA, AXIS_ID_ROWS) + clickMenuBarUpdateButton() + + // expect legend to still be applied + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) + cy.getBySel(valueCellEl).each(($el) => { + cy.wrap($el) + .invoke('attr', 'style') + .should('not.contain', 'background-color') + .and('not.contain', EXPECTED_STANDARD_TEXT_COLOR) }) }) - describe('Transferring a legend: Pivot table -> Gauge', () => { + it('Transferring a legend: Pivot table -> Gauge', () => { const TEST_ITEM = TEST_ITEMS[0] const EXPECTED_STANDARD_TEXT_COLOR = 'color: rgb(33, 41, 52)' const EXPECTED_FIXED_COLOR = '#c7e9c0' const valueCellEl = 'visualization-value-cell' - it('navigates to the start page and adds data items', () => { - goToStartPage() - changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) - openDimension(DIMENSION_ID_DATA) - selectIndicators([TEST_ITEM.name]) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - }) - it('enables legend', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - expectLegendDisplayStyleToBeFill() - changeDisplayStyleToText() - expectLegendDisplayStyleToBeText() - changeDisplayStrategyToFixed() - expectLegendDisplayStrategyToBeFixed() - changeFixedLegendSet(TEST_LEGEND_SET) - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - }) - it(`text color fixed legend (${TEST_LEGEND_SET}) is applied`, () => { - cy.getBySel(valueCellEl).each(($el) => { - cy.wrap($el) - .invoke('attr', 'style') - .should('not.contain', 'background-color') - .and('not.contain', EXPECTED_STANDARD_TEXT_COLOR) - }) - }) - it('changes vis type to Gauge', () => { - changeVisType(visTypeDisplayNames[VIS_TYPE_GAUGE]) - clickMenuBarUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_GAUGE) - }) - it(`text color fixed legend (${TEST_LEGEND_SET}) is applied`, () => { - expectWindowConfigSeriesDataLabelsToHaveColor( - 0, - EXPECTED_FIXED_COLOR - ) - }) - it('verifies that options are persisted', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStyleToBeText() - expectLegendDisplayStrategyToBeFixed() + + // navigates to the start page and adds data items + goToStartPage() + changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) + openDimension(DIMENSION_ID_DATA) + selectIndicators([TEST_ITEM.name]) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + // enables legend + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + expectLegendDisplayStyleToBeFill() + changeDisplayStyleToText() + expectLegendDisplayStyleToBeText() + changeDisplayStrategyToFixed() + expectLegendDisplayStrategyToBeFixed() + changeFixedLegendSet(TEST_LEGEND_SET) + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + cy.log(`text color fixed legend (${TEST_LEGEND_SET}) is applied`) + cy.getBySel(valueCellEl).each(($el) => { + cy.wrap($el) + .invoke('attr', 'style') + .should('not.contain', 'background-color') + .and('not.contain', EXPECTED_STANDARD_TEXT_COLOR) }) + + // changes vis type to Gauge + changeVisType(visTypeDisplayNames[VIS_TYPE_GAUGE]) + clickMenuBarUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_GAUGE) + + cy.log(`text color fixed legend (${TEST_LEGEND_SET}) is applied`) + expectWindowConfigSeriesDataLabelsToHaveColor(0, EXPECTED_FIXED_COLOR) + + // verifies that options are persisted + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStyleToBeText() + expectLegendDisplayStrategyToBeFixed() }) - describe('Transferring a legend: Pivot table -> Single value', () => { + it('Transferring a legend: Pivot table -> Single value', () => { const TEST_ITEM = TEST_ITEMS[0] const EXPECTED_FIXED_COLOR = '#c7e9c0' const valueCellEl = 'visualization-value-cell' const EXPECTED_SV_STANDARD_TEXT_COLOR = '#212934' const EXPECTED_PT_STANDARD_TEXT_COLOR = 'color: rgb(33, 41, 52)' - it('navigates to the start page and adds data items', () => { - goToStartPage() - changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) - openDimension(DIMENSION_ID_DATA) - selectIndicators([TEST_ITEM.name]) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - }) - it('enables legend', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - expectLegendDisplayStyleToBeFill() - changeDisplayStrategyToFixed() - expectLegendDisplayStrategyToBeFixed() - changeFixedLegendSet(TEST_LEGEND_SET) - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - }) - it(`background color fixed legend (${TEST_LEGEND_SET}) is applied`, () => { - cy.getBySel(valueCellEl).each(($el) => { - cy.wrap($el) - .invoke('attr', 'style') - .should('contain', 'background-color') - .and('contain', EXPECTED_PT_STANDARD_TEXT_COLOR) - }) - }) - it('changes vis type to Single value', () => { - changeVisType(visTypeDisplayNames[VIS_TYPE_SINGLE_VALUE]) - clickMenuBarUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) - it('legend is applied to Single value', () => { - expectSingleValueToHaveTextColor(EXPECTED_SV_STANDARD_TEXT_COLOR) - expectSingleValueToHaveBackgroundColor(EXPECTED_FIXED_COLOR) - }) - it('verifies that options are persisted', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStyleToBeFill() - expectLegendDisplayStrategyToBeFixed() + + // navigates to the start page and adds data items + goToStartPage() + changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) + openDimension(DIMENSION_ID_DATA) + selectIndicators([TEST_ITEM.name]) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + // enables legend + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + expectLegendDisplayStyleToBeFill() + changeDisplayStrategyToFixed() + expectLegendDisplayStrategyToBeFixed() + changeFixedLegendSet(TEST_LEGEND_SET) + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + cy.log(`background color fixed legend (${TEST_LEGEND_SET}) is applied`) + cy.getBySel(valueCellEl).each(($el) => { + cy.wrap($el) + .invoke('attr', 'style') + .should('contain', 'background-color') + .and('contain', EXPECTED_PT_STANDARD_TEXT_COLOR) }) + + // changes vis type to Single value + changeVisType(visTypeDisplayNames[VIS_TYPE_SINGLE_VALUE]) + clickMenuBarUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + + // legend is applied to Single value + expectSingleValueToHaveTextColor(EXPECTED_SV_STANDARD_TEXT_COLOR) + expectSingleValueToHaveBackgroundColor(EXPECTED_FIXED_COLOR) + + // verifies that options are persisted + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStyleToBeFill() + expectLegendDisplayStrategyToBeFixed() }) - describe('Transferring the legend key: Column -> Pivot table -> Gauge -> Single value', () => { - it('navigates to the start page and adds data items', () => { - goToStartPage() - openDimension(DIMENSION_ID_DATA) - selectIndicators(TEST_ITEMS.map((item) => item.name)) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible() - }) - it('enables legend (Column)', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - }) - it('legend key is hidden (Column)', () => { - expectLegendKeyToBeHidden() - }) - it('enables legend key option (Column)', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegendKeyOption() - expectLegendKeyOptionToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - }) - it(`legend key is shown (Column) with ${TEST_ITEMS.length} items`, () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(TEST_ITEMS.length) - }) - it('changes vis type to Pivot table', () => { - changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) - clickMenuBarUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - }) - it(`legend key is shown (Pivot table) with ${TEST_ITEMS.length} items`, () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(TEST_ITEMS.length) - }) - it('disables legend key option (Pivot table)', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegendKeyOption() - expectLegendKeyOptionToBeDisabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) - }) - it('legend key is hidden (Pivot table)', () => { - expectLegendKeyToBeHidden() - }) - it('changes vis type to Gauge', () => { - changeVisType(visTypeDisplayNames[VIS_TYPE_GAUGE]) - clickMenuBarUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_GAUGE) - }) - it('legend key is hidden (Gauge)', () => { - expectLegendKeyToBeHidden() - }) - it('enables legend key option (Gauge)', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegendKeyOption() - expectLegendKeyOptionToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_GAUGE) - }) - it('legend key is shown (Gauge) with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) - it('changes vis type to Single value', () => { - changeVisType(visTypeDisplayNames[VIS_TYPE_SINGLE_VALUE]) - clickMenuBarUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) - it('legend key is shown (Single value) with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) - it('disables legend key option (Single value)', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegendKeyOption() - expectLegendKeyOptionToBeDisabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) - }) - it('legend key is hidden (Single value)', () => { - expectLegendKeyToBeHidden() - }) + it('Transferring the legend key: Column -> Pivot table -> Gauge -> Single value', () => { + // navigates to the start page and adds data items + goToStartPage() + openDimension(DIMENSION_ID_DATA) + selectIndicators(TEST_ITEMS.map((item) => item.name)) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible() + + // enables legend (Column) + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + + // legend key is hidden (Column) + expectLegendKeyToBeHidden() + + // enables legend key option (Column) + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegendKeyOption() + expectLegendKeyOptionToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + + cy.log(`legend key is shown (Column) with ${TEST_ITEMS.length} items`) + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(TEST_ITEMS.length) + + // changes vis type to Pivot table + changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) + clickMenuBarUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + cy.log( + `legend key is shown (Pivot table) with ${TEST_ITEMS.length} items` + ) + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(TEST_ITEMS.length) + + // disables legend key option (Pivot table) + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegendKeyOption() + expectLegendKeyOptionToBeDisabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_PIVOT_TABLE) + + // legend key is hidden (Pivot table) + expectLegendKeyToBeHidden() + + // changes vis type to Gauge + changeVisType(visTypeDisplayNames[VIS_TYPE_GAUGE]) + clickMenuBarUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_GAUGE) + + // legend key is hidden (Gauge) + expectLegendKeyToBeHidden() + + // enables legend key option (Gauge) + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegendKeyOption() + expectLegendKeyOptionToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_GAUGE) + + // legend key is shown (Gauge) with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) + + // changes vis type to Single value + changeVisType(visTypeDisplayNames[VIS_TYPE_SINGLE_VALUE]) + clickMenuBarUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + + // legend key is shown (Single value) with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) + + // disables legend key option (Single value) + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegendKeyOption() + expectLegendKeyOptionToBeDisabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE) + + // legend key is hidden (Single value) + expectLegendKeyToBeHidden() }) - describe('Preventing options bleed: Column -> Area', () => { - it('navigates to the start page and adds data items', () => { - goToStartPage() - openDimension(DIMENSION_ID_DATA) - selectIndicators(TEST_ITEMS.map((item) => item.name)) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - }) - it('enables legend', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - clickOptionsModalUpdateButton() - expectChartTitleToBeVisible() - }) - it('legend is applied to Column', () => { - TEST_ITEMS.forEach((item) => - expectWindowConfigSeriesItemToHaveLegendSet( - item.name, - item.legendSet - ) - ) - }) - it('changes vis type to Area', () => { - changeVisType(visTypeDisplayNames[VIS_TYPE_AREA]) - clickMenuBarUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_AREA) - }) - it('legend is not applied to Area', () => { - TEST_ITEMS.forEach((item) => - expectWindowConfigSeriesItemToNotHaveLegendSet(item.name) + it('Preventing options bleed: Column -> Area', () => { + // navigates to the start page and adds data items + goToStartPage() + openDimension(DIMENSION_ID_DATA) + selectIndicators(TEST_ITEMS.map((item) => item.name)) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_COLUMN) + + // enables legend + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + clickOptionsModalUpdateButton() + expectChartTitleToBeVisible() + + // legend is applied to Column + TEST_ITEMS.forEach((item) => + expectWindowConfigSeriesItemToHaveLegendSet( + item.name, + item.legendSet ) - }) - it('legend options are not available', () => { - openOptionsModal() - expectOptionsTabToBeHidden(OPTIONS_TAB_LEGEND) - clickOptionsModalHideButton() - }) - it('legend key is hidden', () => { - expectLegendKeyToBeHidden() - }) - it(`series key displays the correct amount of items`, () => { - expectSeriesKeyToHaveSeriesKeyItems(2) - }) + ) + + // changes vis type to Area + changeVisType(visTypeDisplayNames[VIS_TYPE_AREA]) + clickMenuBarUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_AREA) + + // legend is not applied to Area + TEST_ITEMS.forEach((item) => + expectWindowConfigSeriesItemToNotHaveLegendSet(item.name) + ) + + // legend options are not available + openOptionsModal() + expectOptionsTabToBeHidden(OPTIONS_TAB_LEGEND) + clickOptionsModalHideButton() + + // legend key is hidden + expectLegendKeyToBeHidden() + + // series key displays the correct amount of items + expectSeriesKeyToHaveSeriesKeyItems(2) }) - describe('Non-legend set type displays correctly: Line', () => { - it('navigates to the start page and adds data items', () => { - goToStartPage() - changeVisType(visTypeDisplayNames[VIS_TYPE_LINE]) - openDimension(DIMENSION_ID_DATA) - selectIndicators(TEST_ITEMS.map((item) => item.name)) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_LINE) - }) - it('legend is not applied to Line', () => { - TEST_ITEMS.forEach((item) => - expectWindowConfigSeriesItemToNotHaveLegendSet(item.name) - ) - }) - it('legend options are not available', () => { - openOptionsModal() - expectOptionsTabToBeHidden(OPTIONS_TAB_LEGEND) - }) - it('legend key is hidden', () => { - expectLegendKeyToBeHidden() - }) - it(`series key displays the correct amount of items`, () => { - expectSeriesKeyToHaveSeriesKeyItems(2) - }) + it('Non-legend set type displays correctly: Line', () => { + // navigates to the start page and adds data items + goToStartPage() + changeVisType(visTypeDisplayNames[VIS_TYPE_LINE]) + openDimension(DIMENSION_ID_DATA) + selectIndicators(TEST_ITEMS.map((item) => item.name)) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_LINE) + + // legend is not applied to Line + TEST_ITEMS.forEach((item) => + expectWindowConfigSeriesItemToNotHaveLegendSet(item.name) + ) + + // legend options are not available + openOptionsModal() + expectOptionsTabToBeHidden(OPTIONS_TAB_LEGEND) + + // legend key is hidden + expectLegendKeyToBeHidden() + + // series key displays the correct amount of items + expectSeriesKeyToHaveSeriesKeyItems(2) }) - describe('The chart series key displaying legend colors', () => { - it('navigates to the start page and adds data items', () => { - goToStartPage() - openDimension(DIMENSION_ID_DATA) - selectIndicators(TEST_ITEMS.map((item) => item.name)) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - }) - it(`series key displays the correct amount of items`, () => { - expectSeriesKeyToHaveSeriesKeyItems(2) - }) - it('enables legend', () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - clickOptionsModalUpdateButton() - expectChartTitleToBeVisible() - }) - it(`changes legend display strategy to fixed (${TEST_ITEMS[1].legendSet})`, () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeByDataItem() - changeDisplayStrategyToFixed() - expectLegendDisplayStrategyToBeFixed() - changeFixedLegendSet(TEST_ITEMS[1].legendSet) - clickOptionsModalUpdateButton() - expectChartTitleToBeVisible() - }) + it('The chart series key displaying legend colors', () => { + // navigates to the start page and adds data items + goToStartPage() + openDimension(DIMENSION_ID_DATA) + selectIndicators(TEST_ITEMS.map((item) => item.name)) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_COLUMN) + + // series key displays the correct amount of items + expectSeriesKeyToHaveSeriesKeyItems(2) + + // enables legend + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + clickOptionsModalUpdateButton() + expectChartTitleToBeVisible() + + cy.log( + `changes legend display strategy to fixed (${TEST_ITEMS[1].legendSet})` + ) + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeByDataItem() + changeDisplayStrategyToFixed() + expectLegendDisplayStrategyToBeFixed() + changeFixedLegendSet(TEST_ITEMS[1].legendSet) + clickOptionsModalUpdateButton() + expectChartTitleToBeVisible() }) - describe('When data is not on series, legend is only applied when strategy fixed is used', () => { + it('When data is not on series, legend is only applied when strategy fixed is used', () => { const TEST_ITEM = TEST_ITEMS[0] - it('navigates to the start page and adds data items, legend and legend key', () => { - goToStartPage() - openDimension(DIMENSION_ID_DATA) - selectIndicators([TEST_ITEM.name]) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - toggleLegendKeyOption() - expectLegendKeyOptionToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - }) - it("selects period 'Last 3 months'", () => { - openDimension(DIMENSION_ID_PERIOD) - unselectAllItemsByButton() - selectRelativePeriods(['Last 3 months'], 'Months') - clickDimensionModalUpdateButton() - }) - it('legend by data item is applied', () => { - expectWindowConfigSeriesItemToHaveLegendSet( - TEST_ITEM.name, - TEST_ITEM.legendSet - ) - }) - it('legend key is shown with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) - it(`series key displays the correct amount of items`, () => { - expectSeriesKeyToHaveSeriesKeyItems(1) - }) - it('moves period dimension to series axis', () => { - openContextMenu(DIMENSION_ID_PERIOD) - clickContextMenuMove(DIMENSION_ID_PERIOD, AXIS_ID_COLUMNS) - clickMenuBarUpdateButton() - expectVisualizationToBeVisible() - expectAxisToHaveDimension(AXIS_ID_COLUMNS, DIMENSION_ID_PERIOD) - }) - it('no legend is applied', () => { - expectEachWindowConfigSeriesItemToNotHaveLegendSet() - }) - it('legend key is hidden', () => { - expectLegendKeyToBeHidden() - }) - it(`changes legend display strategy to fixed (${TEST_ITEMS[1].legendSet})`, () => { - openOptionsModal(OPTIONS_TAB_LEGEND) - expectLegendDisplayStrategyToBeByDataItem() - changeDisplayStrategyToFixed() - expectLegendDisplayStrategyToBeFixed() - changeFixedLegendSet(TEST_ITEMS[1].legendSet) - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - }) - it('fixed legend is applied', () => { - expectEachWindowConfigSeriesItemToHaveLegendSet( - TEST_ITEMS[1].legendSet - ) - }) - it('legend key is shown with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) - it(`series key displays the correct amount of items`, () => { - expectSeriesKeyToHaveSeriesKeyItems(3) - }) + + // navigates to the start page and adds data items, legend and legend key + goToStartPage() + openDimension(DIMENSION_ID_DATA) + selectIndicators([TEST_ITEM.name]) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_COLUMN) + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + toggleLegendKeyOption() + expectLegendKeyOptionToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + + // selects period 'Last 3 months' + openDimension(DIMENSION_ID_PERIOD) + unselectAllItemsByButton() + selectRelativePeriods(['Last 3 months'], 'Months') + clickDimensionModalUpdateButton() + + // legend by data item is applied + expectWindowConfigSeriesItemToHaveLegendSet( + TEST_ITEM.name, + TEST_ITEM.legendSet + ) + + // legend key is shown with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) + + // series key displays the correct amount of items + expectSeriesKeyToHaveSeriesKeyItems(1) + + // moves period dimension to series axis + openContextMenu(DIMENSION_ID_PERIOD) + clickContextMenuMove(DIMENSION_ID_PERIOD, AXIS_ID_COLUMNS) + clickMenuBarUpdateButton() + expectVisualizationToBeVisible() + expectAxisToHaveDimension(AXIS_ID_COLUMNS, DIMENSION_ID_PERIOD) + + // no legend is applied + expectEachWindowConfigSeriesItemToNotHaveLegendSet() + + // legend key is hidden + expectLegendKeyToBeHidden() + + cy.log( + `change legend display strategy to fixed ${TEST_ITEMS[1].legendSet}` + ) + openOptionsModal(OPTIONS_TAB_LEGEND) + expectLegendDisplayStrategyToBeByDataItem() + changeDisplayStrategyToFixed() + expectLegendDisplayStrategyToBeFixed() + changeFixedLegendSet(TEST_ITEMS[1].legendSet) + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + + // fixed legend is applied + expectEachWindowConfigSeriesItemToHaveLegendSet(TEST_ITEMS[1].legendSet) + + // legend key is shown with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) + + // series key displays the correct amount of items + expectSeriesKeyToHaveSeriesKeyItems(3) }) - describe('Legend is not applied to column-as-line items', () => { - it('navigates to the start page and adds data items, legend and legend key', () => { - goToStartPage() - openDimension(DIMENSION_ID_DATA) - selectIndicators(TEST_ITEMS.map((item) => item.name)) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - openOptionsModal(OPTIONS_TAB_LEGEND) - toggleLegend() - expectLegendToBeEnabled() - expectLegendDisplayStrategyToBeByDataItem() - toggleLegendKeyOption() - expectLegendKeyOptionToBeEnabled() - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - }) - it('legend by data item is applied', () => { - TEST_ITEMS.forEach((item) => - expectWindowConfigSeriesItemToHaveLegendSet( - item.name, - item.legendSet - ) - ) - }) - it(`changes all items to type ${VIS_TYPE_LINE}`, () => { - openOptionsModal(OPTIONS_TAB_SERIES) - TEST_ITEMS.forEach((item, index) => - setItemToType(index, VIS_TYPE_LINE) - ) - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - TEST_ITEMS.forEach((item, index) => - expectWindowConfigSeriesItemToBeType(index, 'line') - ) - }) - it('no legend is applied', () => { - expectEachWindowConfigSeriesItemToNotHaveLegendSet() - }) - it('legend key is hidden', () => { - expectLegendKeyToBeHidden() - }) - it(`series key displays the correct amount of items`, () => { - expectSeriesKeyToHaveSeriesKeyItems(2) - }) - it(`changes first item (${TEST_ITEMS[0].name}) to type ${VIS_TYPE_COLUMN}`, () => { - openOptionsModal(OPTIONS_TAB_SERIES) - setItemToType(0, VIS_TYPE_COLUMN) - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - expectWindowConfigSeriesItemToNotHaveType(0) - }) - it('legend by data item is applied to the first item', () => { + it('Legend is not applied to column-as-line items', () => { + // navigates to the start page and adds data items, legend and legend key + goToStartPage() + openDimension(DIMENSION_ID_DATA) + selectIndicators(TEST_ITEMS.map((item) => item.name)) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_COLUMN) + openOptionsModal(OPTIONS_TAB_LEGEND) + toggleLegend() + expectLegendToBeEnabled() + expectLegendDisplayStrategyToBeByDataItem() + toggleLegendKeyOption() + expectLegendKeyOptionToBeEnabled() + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + + // legend by data item is applied + TEST_ITEMS.forEach((item) => expectWindowConfigSeriesItemToHaveLegendSet( - TEST_ITEMS[0].name, - TEST_ITEMS[0].legendSet + item.name, + item.legendSet ) - expectWindowConfigSeriesItemToNotHaveLegendSet(TEST_ITEMS[1].name) - }) - it('legend key is shown with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) - it(`series key displays the correct amount of items`, () => { - expectSeriesKeyToHaveSeriesKeyItems(2) - }) + ) + + cy.log(`changes all items to type ${VIS_TYPE_LINE}`) + openOptionsModal(OPTIONS_TAB_SERIES) + TEST_ITEMS.forEach((item, index) => setItemToType(index, VIS_TYPE_LINE)) + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + TEST_ITEMS.forEach((item, index) => + expectWindowConfigSeriesItemToBeType(index, 'line') + ) + + // no legend is applied + expectEachWindowConfigSeriesItemToNotHaveLegendSet() + + // legend key is hidden + expectLegendKeyToBeHidden() + + // series key displays the correct amount of items + expectSeriesKeyToHaveSeriesKeyItems(2) + + cy.log( + `changes first item (${TEST_ITEMS[0].name}) to type ${VIS_TYPE_COLUMN}` + ) + openOptionsModal(OPTIONS_TAB_SERIES) + setItemToType(0, VIS_TYPE_COLUMN) + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + expectWindowConfigSeriesItemToNotHaveType(0) + + // legend by data item is applied to the first item + expectWindowConfigSeriesItemToHaveLegendSet( + TEST_ITEMS[0].name, + TEST_ITEMS[0].legendSet + ) + expectWindowConfigSeriesItemToNotHaveLegendSet(TEST_ITEMS[1].name) + + // legend key is shown with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) + + // series key displays the correct amount of items + expectSeriesKeyToHaveSeriesKeyItems(2) + const TEST_ITEM = { name: 'ANC 2 Coverage', legendSet: 'ANC Coverage', legends: 7, } - it(`adds a third item (${TEST_ITEM.name} - same legendset as the first item) with type ${VIS_TYPE_LINE}`, () => { - openDimension(DIMENSION_ID_DATA) - selectIndicators([TEST_ITEM.name]) - clickDimensionModalUpdateButton() - expectVisualizationToBeVisible(VIS_TYPE_COLUMN) - openOptionsModal(OPTIONS_TAB_SERIES) - setItemToType(2, VIS_TYPE_LINE) - clickOptionsModalUpdateButton() - expectVisualizationToBeVisible() - expectWindowConfigSeriesItemToNotHaveType(0) - }) - it('legend key is shown with 1 item', () => { - expectLegendKeyToBeVisible() - expectLegedKeyItemAmountToBe(1) - }) - it('legend by data item is applied to the first item', () => { - expectWindowConfigSeriesItemToHaveLegendSet( - TEST_ITEMS[0].name, - TEST_ITEMS[0].legendSet - ) - expectWindowConfigSeriesItemToNotHaveLegendSet(TEST_ITEMS[1].name) - expectWindowConfigSeriesItemToNotHaveLegendSet(TEST_ITEM.name) - }) - it(`series key displays the correct amount of items`, () => { - expectSeriesKeyToHaveSeriesKeyItems(3) - }) + + cy.log( + `adds a third item (${TEST_ITEM.name} - same legendset as the first item) with type ${VIS_TYPE_LINE}` + ) + openDimension(DIMENSION_ID_DATA) + selectIndicators([TEST_ITEM.name]) + clickDimensionModalUpdateButton() + expectVisualizationToBeVisible(VIS_TYPE_COLUMN) + openOptionsModal(OPTIONS_TAB_SERIES) + setItemToType(2, VIS_TYPE_LINE) + clickOptionsModalUpdateButton() + expectVisualizationToBeVisible() + expectWindowConfigSeriesItemToNotHaveType(0) + + // legend key is shown with 1 item + expectLegendKeyToBeVisible() + expectLegedKeyItemAmountToBe(1) + + // legend by data item is applied to the first item + expectWindowConfigSeriesItemToHaveLegendSet( + TEST_ITEMS[0].name, + TEST_ITEMS[0].legendSet + ) + expectWindowConfigSeriesItemToNotHaveLegendSet(TEST_ITEMS[1].name) + expectWindowConfigSeriesItemToNotHaveLegendSet(TEST_ITEM.name) + + // series key displays the correct amount of items + expectSeriesKeyToHaveSeriesKeyItems(3) }) })