From 847571cac81ef40567cbf091cec05262170bcf7c Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Tue, 17 Sep 2024 15:55:30 +0530 Subject: [PATCH 1/6] update the spec --- .../Widgets/Others/MapChart_Spec.ts | 224 +++++++----------- app/client/cypress/limited-tests.txt | 3 +- .../MapChartWidget/component/index.tsx | 1 + 3 files changed, 89 insertions(+), 139 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts index 3e4e9fa9649e..482adcdb197a 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts @@ -1,5 +1,5 @@ /// -import viewWidgetsPage from "../../../../../locators/ViewWidgets.json"; +import publishWidgetspage from "../../../../../locators/publishWidgetspage.json"; import { agHelper, entityExplorer, @@ -13,8 +13,6 @@ import EditorNavigation, { } from "../../../../../support/Pages/EditorNavigation"; const _mapChartCaption = "text:last-child"; -const _mapChartPlot = (text: string) => - "//text()[contains(., '" + text + "')]/.."; describe( "Map Chart Widget Functionality", @@ -22,10 +20,17 @@ describe( function () { it("1. Drag and drop a Map Chart widget and verify", function () { entityExplorer.DragDropWidgetNVerify(draggableWidgets.MAPCHART, 200, 200); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "AS"); deployMode.DeployApp( locators._widgetInDeployed(draggableWidgets.MAPCHART), ); - agHelper.VerifySnapshot(locators._root, "mapchartsimple"); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "AS"); deployMode.NavigateBacktoEditor(); EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); }); @@ -33,86 +38,61 @@ describe( it("2.1 Update the Map type to different types and verify - part1", function () { // Change the map type to World with Antarctica and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "World with Antarctica"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithantarctica"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); - - // Change the map type to World and verify the number of entities - propPane.SelectPropertiesDropDown("Map type", "World"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithworld"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "AT"); // Change the map type to Europe and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "Europe"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwitheurope"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "FR"); // Change the map type to North America and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "North America"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithnorthamerica"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "CA"); // Change the map type to South America and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "South America"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithsouthamerica"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "BR"); }); it("2.2 Update the Map type to different types and verify - part2", function () { // Change the map type to Oceania and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "Oceania"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithoceania"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "AU"); // Change the map type to Africa and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "Africa"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithafrica"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "ZA"); // Change the map type to USA and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "USA"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithusa"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "TX"); // Change the map type to Asia and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "Asia"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithasia"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "IN"); }); it("3. Update the Chart data and verify", function () { @@ -124,64 +104,30 @@ describe( ]; propPane.TypeTextIntoField("Chart data", JSON.stringify(data)); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithcustomdata"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "IN: 2"); }); it("4. Verify General settings", function () { // update the title and verify propPane.TypeTextIntoField("Title", "App Sign Up"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); agHelper.AssertText(_mapChartCaption, "text", "App Sign Up"); - agHelper.VerifySnapshot(locators._root, "mapwithcustomtitle"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); - - // update the visibility using toggle and verify - propPane.TogglePropertyState("Visible", "Off"); - deployMode.DeployApp(); - agHelper.AssertElementAbsence( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithvisibilityoff"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); - - // update the visibility using JS and verify - propPane.EnterJSContext("Visible", "true"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.AssertElementVisibility( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithvisibilityon"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); // update the show labels using toggle and verify propPane.TogglePropertyState("Show Labels", "Off"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithshowlabelsoff"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("not.contain.text", "IN: 2"); // update the visibility using JS and verify propPane.EnterJSContext("Show Labels", "true"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapwithshowlableson"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "IN: 2"); }); it("5. Update onDataPointClick and Verify", function () { @@ -192,13 +138,16 @@ describe( propPane._actionSelectorFieldByLabel("Message"), "Data Point {{MapChart1.selectedDataPoint.label}} Clicked", ); - agHelper.GetNClick(propPane._actionSelectorPopupClose); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.GetNClick(_mapChartPlot("RU: 1.30"), 0, true); - agHelper.ValidateToastMessage("Data Point Russian Federation Clicked"); - deployMode.NavigateBacktoEditor(); + + agHelper.GetNClick(locators._enterPreviewMode); + agHelper + .GetElement(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "IN: 2") + .click(); + agHelper.ValidateToastMessage("Data Point India Clicked"); + agHelper.GetNClick(locators._exitPreviewMode); EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); // Convert the onDataPointClick to JS, update and verify @@ -206,12 +155,15 @@ describe( "onDataPointClick", "{{showAlert('Converted to Js and clicked '+ MapChart1.selectedDataPoint.label)}}", ); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.GetNClick(_mapChartPlot("CN: .40"), 0, true); - agHelper.ValidateToastMessage("Converted to Js and clicked China"); - deployMode.NavigateBacktoEditor(); + agHelper.GetNClick(locators._enterPreviewMode); + agHelper + .GetElement(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .should("contain.text", "IN: 2") + .click(); + agHelper.ValidateToastMessage("Converted to Js and clicked India"); + agHelper.GetNClick(locators._exitPreviewMode); EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); }); @@ -226,33 +178,29 @@ describe( ]; propPane.MoveToTab("Style"); propPane.TypeTextIntoField("Color Range", JSON.stringify(colorRange)); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapChartWithColorRange"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("svg") + .find("path") + .should("have.attr", "fill", "rgb(0,0,0)"); // Change border radius and verify propPane.MoveToTab("Style"); propPane.EnterJSContext("Border radius", "1.5rem"); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapChartWithBorderRadius"); - deployMode.NavigateBacktoEditor(); - EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); + cy.get(publishWidgetspage.mapChartWidget) + .find("[data-testid='t--map-chart-container']") + .should("have.css", "border-radius", "24px"); - // Change box shadow and verify const boxShadow = "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"; propPane.MoveToTab("Style"); propPane.EnterJSContext("Box shadow", boxShadow); - deployMode.DeployApp( - locators._widgetInDeployed(draggableWidgets.MAPCHART), - ); - agHelper.VerifySnapshot(locators._root, "mapChartWithBoxShadow"); - deployMode.NavigateBacktoEditor(); + cy.get(publishWidgetspage.mapChartWidget) + .find("[data-testid='t--map-chart-container']") + .should( + "have.css", + "box-shadow", + "rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px", + ); }); }, ); diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index 31c0c0253fef..9a5d7a7a4bea 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -1,5 +1,6 @@ # To run only limited tests - give the spec names in below format: -cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js +#cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js +cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts # For running all specs - uncomment below: #cypress/e2e/**/**/* diff --git a/app/client/src/widgets/MapChartWidget/component/index.tsx b/app/client/src/widgets/MapChartWidget/component/index.tsx index d3be8617cfdb..cee05f08c023 100644 --- a/app/client/src/widgets/MapChartWidget/component/index.tsx +++ b/app/client/src/widgets/MapChartWidget/component/index.tsx @@ -153,6 +153,7 @@ export default function EchartComponent(props: MapChartComponentProps) { className={clsx({ "bp3-skeleton": isLoading, })} + data-testid="t--map-chart-container" onClick={(e) => e.stopPropagation()} >
From d771d79adbd626a71892f2319e5a07919df247d5 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Tue, 17 Sep 2024 17:52:13 +0530 Subject: [PATCH 2/6] update the spec --- .../Widgets/Others/MapChart_Spec.ts | 25 +++++++++---------- .../cypress/locators/publishWidgetspage.json | 5 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts index 482adcdb197a..a2284fafe564 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts @@ -140,12 +140,12 @@ describe( ); agHelper.GetNClick(locators._enterPreviewMode); - agHelper - .GetElement(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "IN: 2") - .click(); + agHelper.GetElement(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .contains("IN: 2") + .click(); + agHelper.ValidateToastMessage("Data Point India Clicked"); agHelper.GetNClick(locators._exitPreviewMode); EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); @@ -156,12 +156,11 @@ describe( "{{showAlert('Converted to Js and clicked '+ MapChart1.selectedDataPoint.label)}}", ); agHelper.GetNClick(locators._enterPreviewMode); - agHelper - .GetElement(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "IN: 2") - .click(); + agHelper.GetElement(publishWidgetspage.mapChartWidget) + .find("svg") + .find("text") + .contains("IN: 2") + .click(); agHelper.ValidateToastMessage("Converted to Js and clicked India"); agHelper.GetNClick(locators._exitPreviewMode); EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); @@ -181,7 +180,7 @@ describe( cy.get(publishWidgetspage.mapChartWidget) .find("svg") .find("path") - .should("have.attr", "fill", "rgb(0,0,0)"); + .should("have.attr", "fill", "#aeaeae"); // Change border radius and verify propPane.MoveToTab("Style"); diff --git a/app/client/cypress/locators/publishWidgetspage.json b/app/client/cypress/locators/publishWidgetspage.json index 43f8c1d17f25..72eb0686f253 100644 --- a/app/client/cypress/locators/publishWidgetspage.json +++ b/app/client/cypress/locators/publishWidgetspage.json @@ -6,7 +6,7 @@ "datepickerWidget": ".t--widget-datepickerwidget", "backToEditor": ".t--back-to-editor", "inputWidget": ".t--widget-inputwidgetv2", - "iconWidget":".t--widget-iconwidget", + "iconWidget": ".t--widget-iconwidget", "checkboxWidget": ".t--widget-checkboxwidget", "switchwidget": ".t--widget-switchwidget", "radioWidget": ".t--widget-radiogroupwidget", @@ -24,6 +24,7 @@ "tableWidget": ".t--widget-tablewidget", "chartCanvasVal": ".t--widget-chartwidget svg rect", "mapWidget": ".t--widget-mapwidget", + "mapChartWidget": ".t--widget-mapchartwidget", "tableLength": ".t--widget-tablewidget .tbody", "tableV2Length": ".t--widget-tablewidgetv2 .tbody", "mapSearch": ".t--widget-mapwidget input", @@ -41,7 +42,7 @@ "tableFilterInputValue": ".t--table-filter-value-input input", "canvas": ".canvas", "removeFilter": ".t--table-filter-remove-btn", - "rowHeight": ".t--property-control-rowheight .bp3-popover-target", + "rowHeight": ".t--property-control-rowheight .bp3-popover-target", "rowHeightOpt": ".t--table-compact-mode-option", "visibilityMode": ".t--table-column-visibility-toggle-btn", "visibilityOpt": ".option-title", From 19fe96adfd4bfacaddfed1b7bd9eae7560dad04a Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Tue, 17 Sep 2024 20:37:40 +0530 Subject: [PATCH 3/6] update the spec --- .../Widgets/Others/MapChart_Spec.ts | 79 ++++--------------- 1 file changed, 17 insertions(+), 62 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts index a2284fafe564..34bab4e2acb9 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts @@ -13,6 +13,8 @@ import EditorNavigation, { } from "../../../../../support/Pages/EditorNavigation"; const _mapChartCaption = "text:last-child"; +const _mapChartPlot = (text: string) => + `//*[name()='svg']//*[name()='text' and contains(text(), '${text}')]`; describe( "Map Chart Widget Functionality", @@ -20,17 +22,11 @@ describe( function () { it("1. Drag and drop a Map Chart widget and verify", function () { entityExplorer.DragDropWidgetNVerify(draggableWidgets.MAPCHART, 200, 200); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "AS"); + agHelper.AssertElementExist(_mapChartPlot("AS")); deployMode.DeployApp( locators._widgetInDeployed(draggableWidgets.MAPCHART), ); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "AS"); + agHelper.AssertElementExist(_mapChartPlot("AS")); deployMode.NavigateBacktoEditor(); EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); }); @@ -38,61 +34,37 @@ describe( it("2.1 Update the Map type to different types and verify - part1", function () { // Change the map type to World with Antarctica and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "World with Antarctica"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "AT"); + agHelper.AssertElementExist(_mapChartPlot("AT")); // Change the map type to Europe and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "Europe"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "FR"); + agHelper.AssertElementExist(_mapChartPlot("FR")); // Change the map type to North America and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "North America"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "CA"); + agHelper.AssertElementExist(_mapChartPlot("CA")); // Change the map type to South America and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "South America"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "BR"); + agHelper.AssertElementExist(_mapChartPlot("BR")); }); it("2.2 Update the Map type to different types and verify - part2", function () { // Change the map type to Oceania and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "Oceania"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "AU"); + agHelper.AssertElementExist(_mapChartPlot("AU")); // Change the map type to Africa and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "Africa"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "ZA"); + agHelper.AssertElementExist(_mapChartPlot("ZA")); // Change the map type to USA and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "USA"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "TX"); + agHelper.AssertElementExist(_mapChartPlot("TX")); // Change the map type to Asia and verify the number of entities propPane.SelectPropertiesDropDown("Map type", "Asia"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "IN"); + agHelper.AssertElementExist(_mapChartPlot("IN")); }); it("3. Update the Chart data and verify", function () { @@ -104,10 +76,7 @@ describe( ]; propPane.TypeTextIntoField("Chart data", JSON.stringify(data)); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "IN: 2"); + agHelper.AssertElementExist(_mapChartPlot("IN: 2")); }); it("4. Verify General settings", function () { @@ -117,17 +86,11 @@ describe( // update the show labels using toggle and verify propPane.TogglePropertyState("Show Labels", "Off"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("not.contain.text", "IN: 2"); + agHelper.AssertElementAbsence(_mapChartPlot("IN: 2")); // update the visibility using JS and verify propPane.EnterJSContext("Show Labels", "true"); - cy.get(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .should("contain.text", "IN: 2"); + agHelper.AssertElementExist(_mapChartPlot("IN: 2")); }); it("5. Update onDataPointClick and Verify", function () { @@ -140,11 +103,7 @@ describe( ); agHelper.GetNClick(locators._enterPreviewMode); - agHelper.GetElement(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .contains("IN: 2") - .click(); + agHelper.GetElement(_mapChartPlot("IN: 2")).click(); agHelper.ValidateToastMessage("Data Point India Clicked"); agHelper.GetNClick(locators._exitPreviewMode); @@ -156,11 +115,7 @@ describe( "{{showAlert('Converted to Js and clicked '+ MapChart1.selectedDataPoint.label)}}", ); agHelper.GetNClick(locators._enterPreviewMode); - agHelper.GetElement(publishWidgetspage.mapChartWidget) - .find("svg") - .find("text") - .contains("IN: 2") - .click(); + agHelper.GetElement(_mapChartPlot("IN: 2")).click(); agHelper.ValidateToastMessage("Converted to Js and clicked India"); agHelper.GetNClick(locators._exitPreviewMode); EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); From 4ed89debaeb78da2273b751f96d377fe09885417 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Wed, 18 Sep 2024 10:12:32 +0530 Subject: [PATCH 4/6] fix prettier error --- .../e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts index 34bab4e2acb9..50325791719c 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts @@ -104,7 +104,7 @@ describe( agHelper.GetNClick(locators._enterPreviewMode); agHelper.GetElement(_mapChartPlot("IN: 2")).click(); - + agHelper.ValidateToastMessage("Data Point India Clicked"); agHelper.GetNClick(locators._exitPreviewMode); EditorNavigation.SelectEntityByName("MapChart1", EntityType.Widget); From bf5730ec7a1c25ed4b7f4f62d342f2251808bb70 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Wed, 18 Sep 2024 10:57:49 +0530 Subject: [PATCH 5/6] update selector --- .../e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts | 4 ++-- app/client/cypress/locators/publishWidgetspage.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts index 50325791719c..d08455c47be4 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts @@ -141,7 +141,7 @@ describe( propPane.MoveToTab("Style"); propPane.EnterJSContext("Border radius", "1.5rem"); cy.get(publishWidgetspage.mapChartWidget) - .find("[data-testid='t--map-chart-container']") + .find(publishWidgetspage.mapChartWidgetContainer) .should("have.css", "border-radius", "24px"); const boxShadow = @@ -149,7 +149,7 @@ describe( propPane.MoveToTab("Style"); propPane.EnterJSContext("Box shadow", boxShadow); cy.get(publishWidgetspage.mapChartWidget) - .find("[data-testid='t--map-chart-container']") + .find(publishWidgetspage.mapChartWidgetContainer) .should( "have.css", "box-shadow", diff --git a/app/client/cypress/locators/publishWidgetspage.json b/app/client/cypress/locators/publishWidgetspage.json index 72eb0686f253..08220ba5db4f 100644 --- a/app/client/cypress/locators/publishWidgetspage.json +++ b/app/client/cypress/locators/publishWidgetspage.json @@ -25,6 +25,7 @@ "chartCanvasVal": ".t--widget-chartwidget svg rect", "mapWidget": ".t--widget-mapwidget", "mapChartWidget": ".t--widget-mapchartwidget", + "mapChartWidgetContainer": "[data-testid='t--map-chart-container']", "tableLength": ".t--widget-tablewidget .tbody", "tableV2Length": ".t--widget-tablewidgetv2 .tbody", "mapSearch": ".t--widget-mapwidget input", From 6e88177f19e0b2deff3eed2d2531a8f88ec06a68 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Wed, 18 Sep 2024 11:15:17 +0530 Subject: [PATCH 6/6] remove file from limited --- app/client/cypress/limited-tests.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/client/cypress/limited-tests.txt b/app/client/cypress/limited-tests.txt index 9a5d7a7a4bea..31c0c0253fef 100644 --- a/app/client/cypress/limited-tests.txt +++ b/app/client/cypress/limited-tests.txt @@ -1,6 +1,5 @@ # To run only limited tests - give the spec names in below format: -#cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js -cypress/e2e/Regression/ClientSide/Widgets/Others/MapChart_Spec.ts +cypress/e2e/Regression/ClientSide/Templates/Fork_Template_spec.js # For running all specs - uncomment below: #cypress/e2e/**/**/*