From 3f10d16bfbaee6c94b383ac5979f06cf66597acc Mon Sep 17 00:00:00 2001 From: Aditya Acharya Date: Thu, 4 Jun 2020 07:50:39 +0000 Subject: [PATCH] Binding/chart text --- app/client/cypress/fixtures/ChartTextDsl.json | 186 ++++++++++++++++++ app/client/cypress/fixtures/example.json | 17 +- .../Smoke_TestSuite/Binding/ChartText.js | 69 +++++++ .../cypress/locators/publishWidgetspage.json | 8 +- 4 files changed, 277 insertions(+), 3 deletions(-) create mode 100644 app/client/cypress/fixtures/ChartTextDsl.json create mode 100644 app/client/cypress/integration/Smoke_TestSuite/Binding/ChartText.js diff --git a/app/client/cypress/fixtures/ChartTextDsl.json b/app/client/cypress/fixtures/ChartTextDsl.json new file mode 100644 index 0000000000..469fe4d7b9 --- /dev/null +++ b/app/client/cypress/fixtures/ChartTextDsl.json @@ -0,0 +1,186 @@ +{ +"dsl": { + "widgetName": "MainContainer", + "backgroundColor": "none", + "rightColumn": 1224, + "snapColumns": 16, + "detachFromLayout": true, + "widgetId": "0", + "topRow": 0, + "bottomRow": 1292, + "containerStyle": "none", + "snapRows": 33, + "parentRowSpace": 1, + "type": "CANVAS_WIDGET", + "canExtend": true, + "dynamicBindings": {}, + "version": 4, + "minHeight": 1292, + "parentColumnSpace": 1, + "leftColumn": 0, + "children": [ + { + "backgroundColor": "#FFFFFF", + "widgetName": "Container1", + "type": "CONTAINER_WIDGET", + "containerStyle": "card", + "isVisible": true, + "isLoading": false, + "parentColumnSpace": 75.25, + "parentRowSpace": 38, + "dynamicBindings": {}, + "leftColumn": 0, + "rightColumn": 8, + "topRow": 0, + "bottomRow": 9, + "snapColumns": 16, + "orientation": "VERTICAL", + "children": [ + { + "backgroundColor": "transparent", + "widgetName": "kydabisaxj", + "type": "CANVAS_WIDGET", + "containerStyle": "none", + "isVisible": true, + "isLoading": false, + "parentColumnSpace": 1, + "parentRowSpace": 1, + "leftColumn": 0, + "rightColumn": 602, + "topRow": 0, + "bottomRow": 342, + "snapColumns": 16, + "orientation": "VERTICAL", + "children": [ + { + "isVisible": true, + "widgetName": "Chart1", + "chartType": "LINE_CHART", + "chartName": "Sales on working days", + "allowHorizontalScroll": false, + "chartData": "[{\"seriesName\":\"\",\"data\":\"\"}]", + "xAxisName": "Last Week", + "yAxisName": "Total Order Revenue $", + "type": "CHART_WIDGET", + "isLoading": false, + "parentColumnSpace": 34.6875, + "parentRowSpace": 38, + "leftColumn": 5, + "rightColumn": 11, + "topRow": 0, + "bottomRow": 8, + "parentId": "56c5odk5ic", + "widgetId": "64jukpgbzh", + "dynamicBindings": {} + } + ], + "widgetId": "56c5odk5ic", + "detachFromLayout": true, + "canExtend": false + } + ], + "widgetId": "kzlk5ductp" + }, + { + "backgroundColor": "#FFFFFF", + "widgetName": "Container3", + "type": "CONTAINER_WIDGET", + "containerStyle": "card", + "isVisible": true, + "isLoading": false, + "parentColumnSpace": 75.25, + "parentRowSpace": 38, + "dynamicBindings": {}, + "leftColumn": 0, + "rightColumn": 16, + "topRow": 9, + "bottomRow": 23, + "snapColumns": 16, + "orientation": "VERTICAL", + "children": [ + { + "backgroundColor": "transparent", + "widgetName": "za6o0unktq", + "type": "CANVAS_WIDGET", + "containerStyle": "none", + "isVisible": true, + "isLoading": false, + "parentColumnSpace": 1, + "parentRowSpace": 1, + "leftColumn": 0, + "rightColumn": 1204, + "topRow": 0, + "bottomRow": 532, + "snapColumns": 16, + "orientation": "VERTICAL", + "children": [ + { + "isVisible": true, + "text": "Label", + "textStyle": "LABEL", + "textAlign": "LEFT", + "widgetName": "Text1", + "type": "TEXT_WIDGET", + "isLoading": false, + "parentColumnSpace": 71.75, + "parentRowSpace": 38, + "leftColumn": 3, + "rightColumn": 7, + "topRow": 2, + "bottomRow": 3, + "parentId": "d2i9xsy2fk", + "widgetId": "u210slvpsz", + "dynamicBindings": {} + } + ], + "widgetId": "d2i9xsy2fk", + "detachFromLayout": true, + "canExtend": false + } + ], + "widgetId": "t2a7se9pxe" + }, + { + "backgroundColor": "#FFFFFF", + "widgetName": "Container4", + "type": "CONTAINER_WIDGET", + "containerStyle": "card", + "isVisible": true, + "isLoading": false, + "parentColumnSpace": 75.25, + "parentRowSpace": 38, + "dynamicBindings": {}, + "leftColumn": 8, + "rightColumn": 16, + "topRow": 0, + "bottomRow": 9, + "snapColumns": 16, + "orientation": "VERTICAL", + "children": [ + { + "backgroundColor": "transparent", + "widgetName": "cli9vgw4yj", + "type": "CANVAS_WIDGET", + "containerStyle": "none", + "isVisible": true, + "isLoading": false, + "parentColumnSpace": 1, + "parentRowSpace": 1, + "leftColumn": 0, + "rightColumn": 602, + "topRow": 0, + "bottomRow": 342, + "snapColumns": 16, + "orientation": "VERTICAL", + "children": [], + "widgetId": "qzniae78ab", + "detachFromLayout": true, + "canExtend": false + } + ], + "widgetId": "gtsbf2q08n" + } + ] +}, +"layoutOnLoadActions": [] +} diff --git a/app/client/cypress/fixtures/example.json b/app/client/cypress/fixtures/example.json index 35d6382f86..9613f42363 100644 --- a/app/client/cypress/fixtures/example.json +++ b/app/client/cypress/fixtures/example.json @@ -152,5 +152,20 @@ "productName": "Avocado Panini", "orderAmount": 7.99 } - ] + ], + "chartInputValidate": [ + { + "x": "Test1", + "y": 5400 + }, + { + "x": "Test2", + "y": 10000 + }, + { + "x": "Test3", + "y": 1000 + } + ], + "Chartval":["Test1", "Test2", "Test3"] } \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/Binding/ChartText.js b/app/client/cypress/integration/Smoke_TestSuite/Binding/ChartText.js new file mode 100644 index 0000000000..ef94ba05bf --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/Binding/ChartText.js @@ -0,0 +1,69 @@ +const commonlocators = require("../../../locators/commonlocators.json"); +const viewWidgetsPage = require("../../../locators/ViewWidgets.json"); +const publish = require("../../../locators/publishWidgetspage.json"); +const dsl = require("../../../fixtures/ChartTextDsl.json"); + +describe("Text-Chart Binding Functionality", function() { + before(() => { + cy.addDsl(dsl); + }); + it("Text-Chart Binding Functionality View", function() { + cy.openPropertyPane("textwidget"); + cy.testJsontext("text", JSON.stringify(this.data.chartInputValidate)); + cy.get(commonlocators.TextInside).should( + "have.text", + JSON.stringify(this.data.chartInputValidate), + ); + cy.openPropertyPane("chartwidget"); + cy.get(viewWidgetsPage.chartType) + .find(commonlocators.dropdownbuttonclick) + .click({ force: true }) + .get(commonlocators.dropdownmenu) + .children() + .contains("Column Chart") + .click(); + cy.get(viewWidgetsPage.chartType) + .find(commonlocators.menuSelection) + .should("have.text", "Column Chart"); + cy.testJsontext("chartdata", "{{Text1.text}}"); + const labels = [ + this.data.Chartval[0], + this.data.Chartval[1], + this.data.Chartval[2], + ]; + [0, 1, 2].forEach(k => { + cy.get(viewWidgetsPage.rectangleChart) + .eq(k) + .trigger("mousemove", { force: true }); + cy.get(viewWidgetsPage.Chartlabel) + .eq(k) + .should("have.text", labels[k]); + }); + cy.PublishtheApp(); + }); + it("Text-Chart Binding Functionality Publish", function() { + cy.get(publish.chartCanvasVal).should("be.visible"); + cy.get(publish.chartWidget).should("have.css", "opacity", "1"); + const labels = [ + this.data.Chartval[0], + this.data.Chartval[1], + this.data.Chartval[2], + ]; + [0, 1, 2].forEach(k => { + cy.get(publish.rectChart) + .eq(k) + .trigger("mousemove", { force: true }); + cy.get(publish.chartLab) + .eq(k) + .should("have.text", labels[k]); + }); + cy.get(commonlocators.TextInside).should( + "have.text", + JSON.stringify(this.data.chartInputValidate), + ); + }); +}); + +afterEach(() => { + // put your clean up code if any +}); diff --git a/app/client/cypress/locators/publishWidgetspage.json b/app/client/cypress/locators/publishWidgetspage.json index 05ddfc623e..a5e6f071c4 100644 --- a/app/client/cypress/locators/publishWidgetspage.json +++ b/app/client/cypress/locators/publishWidgetspage.json @@ -14,8 +14,12 @@ "chartWidget": ".t--widget-chartwidget", "horizontalTab": ".t--widget-chartwidget g[class*='-scrollContainer'] rect", "tableWidget": ".t--widget-tablewidget", + "chartCanvasVal": ".t--widget-chartwidget g[class*='-canvas'] rect ", "mapWidget": ".t--widget-mapwidget", "tableLength": ".t--widget-tablewidget .tbody", "mapSearch": ".t--widget-mapwidget input", - "pickMyLocation": ".t--widget-mapwidget div[title='Pick My Location']" -} + "pickMyLocation": ".t--widget-mapwidget div[title='Pick My Location']", + "rectChart":".t--widget-chartwidget g rect", + "chartLab":".t--widget-chartwidget g:nth-child(5) text" + +} \ No newline at end of file