WIP : Added test for chart datapoint validation (#3176)
* Added test for chart datapoint validation * updated test Co-authored-by: nandan.anantharamu <nandan.anantharamu@thoughtspot.com>
This commit is contained in:
parent
6b13347157
commit
21eecb1fe6
69
app/client/cypress/fixtures/ChartDsl.json
Normal file
69
app/client/cypress/fixtures/ChartDsl.json
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"dsl": {
|
||||||
|
"widgetName": "MainContainer",
|
||||||
|
"backgroundColor": "none",
|
||||||
|
"rightColumn": 1224,
|
||||||
|
"snapColumns": 16,
|
||||||
|
"detachFromLayout": true,
|
||||||
|
"widgetId": "0",
|
||||||
|
"topRow": 0,
|
||||||
|
"bottomRow": 1280,
|
||||||
|
"containerStyle": "none",
|
||||||
|
"snapRows": 33,
|
||||||
|
"parentRowSpace": 1,
|
||||||
|
"type": "CANVAS_WIDGET",
|
||||||
|
"canExtend": true,
|
||||||
|
"version": 11,
|
||||||
|
"minHeight": 1292,
|
||||||
|
"parentColumnSpace": 1,
|
||||||
|
"dynamicBindingPathList": [],
|
||||||
|
"leftColumn": 0,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"isVisible": true,
|
||||||
|
"widgetName": "Chart1",
|
||||||
|
"chartType": "BAR_CHART",
|
||||||
|
"chartName": "Sales on working days",
|
||||||
|
"allowHorizontalScroll": false,
|
||||||
|
"version": 1,
|
||||||
|
"chartData": [
|
||||||
|
{
|
||||||
|
"seriesName": "Sales",
|
||||||
|
"data": "[\n {\n \"x\": \"Mon\",\n \"y\": 10000\n },\n {\n \"x\": \"Tue\",\n \"y\": 12000\n },\n {\n \"x\": \"Wed\",\n \"y\": 32000\n },\n {\n \"x\": \"Thu\",\n \"y\": 28000\n },\n {\n \"x\": \"Fri\",\n \"y\": 14000\n },\n {\n \"x\": \"Sat\",\n \"y\": 19000\n },\n {\n \"x\": \"Sun\",\n \"y\": 36000\n }\n]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"xAxisName": "Last Week",
|
||||||
|
"yAxisName": "Total Order Revenue $",
|
||||||
|
"type": "CHART_WIDGET",
|
||||||
|
"isLoading": false,
|
||||||
|
"parentColumnSpace": 74,
|
||||||
|
"parentRowSpace": 40,
|
||||||
|
"leftColumn": 0,
|
||||||
|
"rightColumn": 6,
|
||||||
|
"topRow": 0,
|
||||||
|
"bottomRow": 8,
|
||||||
|
"parentId": "0",
|
||||||
|
"widgetId": "d1o9lu9jzs",
|
||||||
|
"dynamicBindingPathList": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"isVisible": true,
|
||||||
|
"inputType": "TEXT",
|
||||||
|
"label": "",
|
||||||
|
"widgetName": "Input1",
|
||||||
|
"version": 1,
|
||||||
|
"resetOnSubmit": true,
|
||||||
|
"type": "INPUT_WIDGET",
|
||||||
|
"isLoading": false,
|
||||||
|
"parentColumnSpace": 74,
|
||||||
|
"parentRowSpace": 40,
|
||||||
|
"leftColumn": 8,
|
||||||
|
"rightColumn": 13,
|
||||||
|
"topRow": 5,
|
||||||
|
"bottomRow": 6,
|
||||||
|
"parentId": "0",
|
||||||
|
"widgetId": "y4gcv7cjg0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -113,5 +113,7 @@
|
||||||
"currentRowWithIdInside": "{{\"#\" + currentRow.email}}",
|
"currentRowWithIdInside": "{{\"#\" + currentRow.email}}",
|
||||||
"defaultdataBinding": "{'Test','This'}",
|
"defaultdataBinding": "{'Test','This'}",
|
||||||
"dropdownErrorMsg": "This value does not evaluate to type \"Array<{ label: string, value: string }>\". Transform it using JS inside '{{ }}'",
|
"dropdownErrorMsg": "This value does not evaluate to type \"Array<{ label: string, value: string }>\". Transform it using JS inside '{{ }}'",
|
||||||
"tableWidgetErrorMsg": "This value does not evaluate to type \"Array<Object>\". Transform it using JS inside '{{ }}'"
|
"tableWidgetErrorMsg": "This value does not evaluate to type \"Array<Object>\". Transform it using JS inside '{{ }}'",
|
||||||
|
"bindingDataPoint": "{{JSON.stringify(Chart1.selectedDataPoint)}}",
|
||||||
|
"bindChardData": "{{Chart1.selectedDataPoint"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
const commonlocators = require("../../../../locators/commonlocators.json");
|
||||||
|
const viewWidgetsPage = require("../../../../locators/ViewWidgets.json");
|
||||||
|
const publish = require("../../../../locators/publishWidgetspage.json");
|
||||||
|
const dsl = require("../../../../fixtures/ChartDsl.json");
|
||||||
|
const pages = require("../../../../locators/Pages.json");
|
||||||
|
const testdata = require("../../../../fixtures/testdata.json");
|
||||||
|
const widgetsPage = require("../../../../locators/Widgets.json");
|
||||||
|
|
||||||
|
describe("Chart Widget Functionality", function() {
|
||||||
|
before(() => {
|
||||||
|
cy.addDsl(dsl);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Input widget test with default value from chart datapoint", function() {
|
||||||
|
cy.SearchEntityandOpen("Input1");
|
||||||
|
cy.wait(500);
|
||||||
|
cy.get(widgetsPage.defaultInput).type(testdata.bindChardData);
|
||||||
|
cy.get(commonlocators.editPropCrossButton).click();
|
||||||
|
cy.wait("@updateLayout").should(
|
||||||
|
"have.nested.property",
|
||||||
|
"response.body.responseMeta.status",
|
||||||
|
200,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Chart with datapoint feature validation", function() {
|
||||||
|
cy.SearchEntityandOpen("Chart1");
|
||||||
|
cy.addAction(testdata.bindingDataPoint);
|
||||||
|
cy.closePropertyPane();
|
||||||
|
cy.wait(500);
|
||||||
|
cy.xpath("(//*[local-name()='rect'])[13]")
|
||||||
|
.first()
|
||||||
|
.click({ force: true });
|
||||||
|
cy.get(publish.inputWidget + " " + "input")
|
||||||
|
.first()
|
||||||
|
.invoke("attr", "value")
|
||||||
|
.then(($value) => {
|
||||||
|
const text = $value;
|
||||||
|
cy.log(text);
|
||||||
|
cy.wait(3000);
|
||||||
|
cy.get(".t--toast-action span")
|
||||||
|
.first()
|
||||||
|
.invoke("text")
|
||||||
|
.then((text) => {
|
||||||
|
const toasttext = text;
|
||||||
|
cy.log(toasttext);
|
||||||
|
expect(text.trim()).to.equal(toasttext.trim());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -1309,6 +1309,17 @@ Cypress.Commands.add("evaluateErrorMessage", (value) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add("addAction", (value) => {
|
||||||
|
cy.get(commonlocators.dropdownSelectButton)
|
||||||
|
.last()
|
||||||
|
.click();
|
||||||
|
cy.get(commonlocators.chooseAction)
|
||||||
|
.children()
|
||||||
|
.contains("Show Message")
|
||||||
|
.click();
|
||||||
|
cy.enterActionValue(value);
|
||||||
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("selectShowMsg", (value) => {
|
Cypress.Commands.add("selectShowMsg", (value) => {
|
||||||
cy.get(commonlocators.chooseAction)
|
cy.get(commonlocators.chooseAction)
|
||||||
.children()
|
.children()
|
||||||
|
|
@ -1326,6 +1337,7 @@ Cypress.Commands.add("addSuccessMessage", (value) => {
|
||||||
.click();
|
.click();
|
||||||
cy.enterActionValue(value);
|
cy.enterActionValue(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add("SetDateToToday", () => {
|
Cypress.Commands.add("SetDateToToday", () => {
|
||||||
cy.get(formWidgetsPage.datepickerFooter)
|
cy.get(formWidgetsPage.datepickerFooter)
|
||||||
.contains("Today")
|
.contains("Today")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user