diff --git a/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Map_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Map_spec.js index da5fff0f59..1389a8fb32 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Map_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ViewWidgets/Map_spec.js @@ -1,13 +1,17 @@ const commonlocators = require("../../../locators/commonlocators.json"); const viewWidgetsPage = require("../../../locators/ViewWidgets.json"); const dsl = require("../../../fixtures/Mapdsl.json"); +const publishPage = require("../../../locators/publishWidgetspage.json"); describe("Map Widget Functionality", function() { - beforeEach(() => { + before(() => { cy.addDsl(dsl); }); - it("Map Widget Functionality", function() { + + this.beforeEach(() => { cy.openPropertyPane("mapwidget"); + }); + it("Map Widget Functionality", function() { /** * @param{Text} Random Text * @param{MapWidget}Mouseover @@ -35,18 +39,88 @@ describe("Map Widget Functionality", function() { cy.get(viewWidgetsPage.zoomLevel) .eq(1) .click({ force: true }); - - cy.get(viewWidgetsPage.mapSearch).should("be.visible"); - cy.get(viewWidgetsPage.mapSearch) - .invoke("attr", "placeholder") - .should("contain", "Enter location to search"); cy.get(viewWidgetsPage.mapSearch) .click({ force: true }) .clear() .type(this.data.location2) .type("{enter}"); }); - afterEach(() => { - // put your clean up code if any + it("Map-Enable Location,Map search and Create Marker Property Validation", function() { + /** + * Enable the Search Location checkbox and Validate the same in editor mode + */ + cy.CheckWidgetProperties(commonlocators.enableSearchLocCheckbox); + cy.get(viewWidgetsPage.mapSearch).should("be.visible"); + cy.get(viewWidgetsPage.mapSearch) + .invoke("attr", "placeholder") + .should("contain", "Enter location to search"); + /** + * Enable the Pick Location checkbox and Validate the same in editor mode + */ + cy.CheckWidgetProperties(commonlocators.enablePickLocCheckbox); + cy.get(viewWidgetsPage.pickMyLocation).should("exist"); + + /** + * Enable the Createnew Marker checkbox and Validate the same in editor mode + */ + cy.CheckWidgetProperties(commonlocators.enableCreateMarkerCheckbox); + /** + * Validation will be added when create marker fun is working fine + */ + + cy.PublishtheApp(); + /** + * Publish mode Validation + */ + cy.get(publishPage.mapSearch).should("be.visible"); + cy.get(publishPage.mapSearch) + .invoke("attr", "placeholder") + .should("contain", "Enter location to search"); + cy.get(publishPage.pickMyLocation).should("exist"); + cy.get(publishPage.backToEditor).click(); + }); + + it("Map-Disable Location, Mapsearch and Create Marker Property Validation", function() { + /** + * Disable the Search Location checkbox and Validate the same in editor mode + */ + cy.UncheckWidgetProperties(commonlocators.enableSearchLocCheckbox); + cy.get(viewWidgetsPage.mapSearch).should("not.be.visible"); + /** + * Disable the Pick Location checkbox and Validate the same in editor mode + */ + cy.UncheckWidgetProperties(commonlocators.enablePickLocCheckbox); + cy.get(viewWidgetsPage.pickMyLocation).should("not.exist"); + + /** + * Disable the Createnew Marker checkbox and Validate the same in editor mode + */ + cy.UncheckWidgetProperties(commonlocators.enableCreateMarkerCheckbox); + /** + * Validation will be added when create marker fun is working fine + */ + + cy.PublishtheApp(); + /** + * Publish mode Validation + */ + cy.get(publishPage.mapSearch).should("not.be.visible"); + cy.get(publishPage.pickMyLocation).should("not.exist"); + cy.get(publishPage.backToEditor).click(); + }); + + it("Map-Check Visible field Validation", function() { + //Check the disableed checkbox and Validate + cy.CheckWidgetProperties(commonlocators.visibleCheckbox); + cy.PublishtheApp(); + cy.get(publishPage.mapWidget).should("be.visible"); + cy.get(publishPage.backToEditor).click(); + }); + + it("Map-Unckeck Visible field Validation", function() { + //Uncheck the disabled checkbox and validate + cy.UncheckWidgetProperties(commonlocators.visibleCheckbox); + cy.PublishtheApp(); + cy.get(publishPage.mapWidget).should("not.be.visible"); }); }); diff --git a/app/client/cypress/locators/ViewWidgets.json b/app/client/cypress/locators/ViewWidgets.json index 242824e97c..a84df6bc25 100644 --- a/app/client/cypress/locators/ViewWidgets.json +++ b/app/client/cypress/locators/ViewWidgets.json @@ -27,5 +27,6 @@ "createMarker": ".t--property-control-createnewmarker [type='checkbox']", "zoomLevel": ".t--property-control-zoomlevel svg", "defaultImage": ".t--property-control-defaultimage .CodeMirror-code", - "Chartlabel": ".t--draggable-chartwidget g:nth-child(5) text" + "Chartlabel": ".t--draggable-chartwidget g:nth-child(5) text", + "pickMyLocation": ".t--draggable-mapwidget div[title='Pick My Location']" } \ No newline at end of file diff --git a/app/client/cypress/locators/commonlocators.json b/app/client/cypress/locators/commonlocators.json index 8179a90e20..1189d93ba2 100644 --- a/app/client/cypress/locators/commonlocators.json +++ b/app/client/cypress/locators/commonlocators.json @@ -45,5 +45,8 @@ "disabledBtn": " button[disabled='disabled']", "inputField": " .bp3-input", "csvSupport": ".t--property-control-csvexport input", - "backToEditor": ".bp3-icon.bp3-icon-chevron-left + span.bp3-button-text" + "backToEditor": ".bp3-icon.bp3-icon-chevron-left + span.bp3-button-text", + "enableSearchLocCheckbox": ".t--property-control-enablesearchlocation input", + "enablePickLocCheckbox": ".t--property-control-enablepicklocation input", + "enableCreateMarkerCheckbox": ".t--property-control-createnewmarker input" } diff --git a/app/client/cypress/locators/publishWidgetspage.json b/app/client/cypress/locators/publishWidgetspage.json index a861d50118..da1c929029 100644 --- a/app/client/cypress/locators/publishWidgetspage.json +++ b/app/client/cypress/locators/publishWidgetspage.json @@ -14,5 +14,8 @@ "chartWidget": ".t--widget-chartwidget", "horizontalTab": ".t--widget-chartwidget g[class='raphael-group-104-axis-Line-group'] rect", "tableWidget": ".t--widget-tablewidget", - "tableLength": ".t--widget-tablewidget .e-gridcontent.e-lib.e-droppable" + "mapWidget": ".t--widget-mapwidget", + "tableLength": ".t--widget-tablewidget .e-gridcontent.e-lib.e-droppable", + "mapSearch": ".t--widget-mapwidget input", + "pickMyLocation": ".t--widget-mapwidget div[title='Pick My Location']" } \ No newline at end of file