From 5c7288b786cfd585fb78f2aea5759b31ae7bc553 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Thu, 2 Nov 2023 12:09:15 +0100 Subject: [PATCH] chore: enable SV test --- cypress/integration/options/legend.cy.js | 179 ++++++++++++++++++++++- 1 file changed, 173 insertions(+), 6 deletions(-) diff --git a/cypress/integration/options/legend.cy.js b/cypress/integration/options/legend.cy.js index 11c9795b2a..5a5faf49b2 100644 --- a/cypress/integration/options/legend.cy.js +++ b/cypress/integration/options/legend.cy.js @@ -1,12 +1,12 @@ import { DIMENSION_ID_DATA, VIS_TYPE_COLUMN, - // VIS_TYPE_SINGLE_VALUE, + VIS_TYPE_SINGLE_VALUE, // VIS_TYPE_GAUGE, // VIS_TYPE_PIVOT_TABLE, // VIS_TYPE_STACKED_COLUMN, // VIS_TYPE_LINE, - // visTypeDisplayNames, + visTypeDisplayNames, // DIMENSION_ID_PERIOD, // AXIS_ID_COLUMNS, // VIS_TYPE_AREA, @@ -44,10 +44,10 @@ import { expectFixedLegendSetToBe, expectLegendDisplayStrategyToBeByDataItem, expectLegendDisplayStrategyToBeFixed, - // expectLegendDisplayStyleToBeFill, + expectLegendDisplayStyleToBeFill, // expectLegendDisplayStyleToBeText, expectLegendToBeEnabled, - // expectSingleValueToHaveTextColor, + expectSingleValueToHaveTextColor, OPTIONS_TAB_LEGEND, toggleLegendKeyOption, expectLegendKeyOptionToBeEnabled, @@ -60,14 +60,14 @@ import { // setItemToType, // clickOptionsModalHideButton, // expectSingleValueToHaveBackgroundColor, - // expectSingleValueToNotHaveBackgroundColor, + expectSingleValueToNotHaveBackgroundColor, // changeDisplayStyleToFill, // changeColor, // OPTIONS_TAB_STYLE, // changeDisplayStrategyToByDataItem, } from '../../elements/optionsModal/index.js' import { goToStartPage } from '../../elements/startScreen.js' -// import { changeVisType } from '../../elements/visualizationTypeSelector.js' +import { changeVisType } from '../../elements/visualizationTypeSelector.js' import { // expectEachWindowConfigSeriesItemToHaveLegendSet, // expectEachWindowConfigSeriesItemToNotHaveLegendSet, @@ -152,4 +152,171 @@ describe('Options - Legend', () => { expectLegendKeyToBeVisible() expectLegedKeyItemAmountToBe(1) }) + + it('Applying a legend: Single value', () => { + const TEST_ITEM = TEST_ITEMS[0] + const EXPECTED_STANDARD_TEXT_COLOR = '#212934' + // const EXPECTED_CONTRAST_TEXT_COLOR = '#ffffff' + // const EXPECTED_BACKGROUND_COLOR_1 = '#FFFFB2' + // const EXPECTED_TEXT_COLOR_1 = '#FFFFB2' + // const EXPECTED_BACKGROUND_COLOR_2 = '#B3402B' + // const EXPECTED_TEXT_COLOR_2 = '#B3402B' + // const EXPECTED_CUSTOM_TITLE_COLOR = '#ff7700' + // const EXPECTED_CUSTOM_SUBTITLE_COLOR = '#ffaa00' + // const TEST_LEGEND_SET_WITH_CONTRAST = 'Age 15y interval' + // const EXPECTED_STANDARD_TITLE_COLOR = '#212934' + // const EXPECTED_STANDARD_SUBTITLE_COLOR = '#4a5768' + + // 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 + // // 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 + // // 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 + // // 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 + // // 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) + }) })