Merge branch 'Binding/ChartText' into 'release'

Binding/chart text

See merge request theappsmith/internal-tools-client!673
This commit is contained in:
Aditya Acharya 2020-06-04 07:50:39 +00:00
commit 303363cb60
4 changed files with 277 additions and 3 deletions

View File

@ -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": []
}

View File

@ -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"]
}

View File

@ -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
});

View File

@ -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"
}