Added tests for dependencies (#1679)

* Added tests for dependencies

* updated review comments

* moved files to binding folder

Co-authored-by: nandan.anantharamu <nandan.anantharamu@thoughtspot.com>
This commit is contained in:
NandanAnantharamu 2020-11-11 15:44:01 +05:30 committed by GitHub
parent 3c37645d12
commit d5ce1dfa52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 206 additions and 1 deletions

View File

@ -0,0 +1,56 @@
{
"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,
"dynamicBindings": {},
"version": 6,
"minHeight": 1292,
"parentColumnSpace": 1,
"leftColumn": 0,
"children": [
{
"isVisible": true,
"inputType": "TEXT",
"label": "",
"widgetName": "Input1",
"type": "INPUT_WIDGET",
"isLoading": false,
"parentColumnSpace": 74,
"parentRowSpace": 40,
"leftColumn": 3,
"rightColumn": 8,
"topRow": 3,
"bottomRow": 4,
"parentId": "0",
"widgetId": "ufr2ik3x1q"
},
{
"isVisible": true,
"inputType": "TEXT",
"label": "",
"widgetName": "Input2",
"type": "INPUT_WIDGET",
"isLoading": false,
"parentColumnSpace": 74,
"parentRowSpace": 40,
"leftColumn": 4,
"rightColumn": 9,
"topRow": 5,
"bottomRow": 6,
"parentId": "0",
"widgetId": "qfc7a4t3p8"
}
]
}
}

View File

@ -174,5 +174,10 @@
}
],
"addInputWidgetBinding": "{{Table1.selectedRow.id",
"externalPage": "https://www.appsmith.com/"
"externalPage": "https://www.appsmith.com/",
"loadashInput": "{{_.add(3,4)",
"momentInput": "{{moment(new Date).format('yyyy')",
"atobInput": "{{atob('QQ==')",
"btoaInput": "{{btoa('A')",
"defaultInputBinding": "{{Input2.text"
}

View File

@ -0,0 +1,48 @@
const commonlocators = require("../../../locators/commonlocators.json");
const formWidgetsPage = require("../../../locators/FormWidgets.json");
const dsl = require("../../../fixtures/inputBindingdsl.json");
const pages = require("../../../locators/Pages.json");
const widgetsPage = require("../../../locators/Widgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const testdata = require("../../../fixtures/testdata.json");
describe("aTob and bToa library tests ", function() {
before(() => {
cy.addDsl(dsl);
});
it("Input widget test with default value for atob method", function() {
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type(testdata.atobInput);
cy.get(commonlocators.editPropCrossButton).click();
cy.wait("@updateLayout").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
});
it("Input widget test with default value for btoa method", function() {
cy.SearchEntityandOpen("Input2");
cy.get(widgetsPage.defaultInput).type(testdata.btoaInput);
cy.get(commonlocators.editPropCrossButton).click();
cy.wait("@updateLayout").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
cy.reload();
});
it("publish widget and validate the data displayed in input widgets value for aToB and bToa", function() {
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input")
.first()
.invoke("attr", "value")
.should("contain", "A");
cy.get(publish.inputWidget + " " + "input")
.last()
.invoke("attr", "value")
.should("contain", "QQ==");
});
});

View File

@ -0,0 +1,48 @@
const commonlocators = require("../../../locators/commonlocators.json");
const formWidgetsPage = require("../../../locators/FormWidgets.json");
const dsl = require("../../../fixtures/inputBindingdsl.json");
const pages = require("../../../locators/Pages.json");
const widgetsPage = require("../../../locators/Widgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const testdata = require("../../../fixtures/testdata.json");
describe("Loadash basic test with input Widget", function() {
before(() => {
cy.addDsl(dsl);
});
it("Input widget test with default value from another Input widget", function() {
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type(testdata.defaultInputBinding);
cy.get(commonlocators.editPropCrossButton).click();
cy.wait("@updateLayout").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
});
it("Input widget test with default value for loadash function", function() {
cy.SearchEntityandOpen("Input2");
cy.get(widgetsPage.defaultInput).type(testdata.loadashInput);
cy.get(commonlocators.editPropCrossButton).click();
cy.wait("@updateLayout").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
cy.reload();
});
it("publish widget and validate the data displayed in input widgets from loadash function", function() {
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input")
.first()
.invoke("attr", "value")
.should("contain", "7");
cy.get(publish.inputWidget + " " + "input")
.last()
.invoke("attr", "value")
.should("contain", "7");
});
});

View File

@ -0,0 +1,48 @@
const commonlocators = require("../../../locators/commonlocators.json");
const formWidgetsPage = require("../../../locators/FormWidgets.json");
const dsl = require("../../../fixtures/inputBindingdsl.json");
const pages = require("../../../locators/Pages.json");
const widgetsPage = require("../../../locators/Widgets.json");
const publish = require("../../../locators/publishWidgetspage.json");
const testdata = require("../../../fixtures/testdata.json");
describe("Moment basic test with input Widget", function() {
before(() => {
cy.addDsl(dsl);
});
it("Input widget test with default value from another Input widget", function() {
cy.SearchEntityandOpen("Input1");
cy.get(widgetsPage.defaultInput).type(testdata.defaultInputBinding);
cy.get(commonlocators.editPropCrossButton).click();
cy.wait("@updateLayout").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
});
it("Binding second input widget with first input widget and validating", function() {
cy.SearchEntityandOpen("Input2");
cy.get(widgetsPage.defaultInput).type(testdata.momentInput);
cy.get(commonlocators.editPropCrossButton).click();
cy.wait("@updateLayout").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
cy.reload();
});
it("publish widget and validate the data displayed in input widgets", function() {
cy.PublishtheApp();
cy.get(publish.inputWidget + " " + "input")
.first()
.invoke("attr", "value")
.should("contain", "2020");
cy.get(publish.inputWidget + " " + "input")
.last()
.invoke("attr", "value")
.should("contain", "2020");
});
});