diff --git a/app/client/cypress/fixtures/inputBindingdsl.json b/app/client/cypress/fixtures/inputBindingdsl.json new file mode 100644 index 0000000000..0970b08a6f --- /dev/null +++ b/app/client/cypress/fixtures/inputBindingdsl.json @@ -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" + } + ] + } +} \ No newline at end of file diff --git a/app/client/cypress/fixtures/testdata.json b/app/client/cypress/fixtures/testdata.json index 67fcffe98e..ada2d66723 100644 --- a/app/client/cypress/fixtures/testdata.json +++ b/app/client/cypress/fixtures/testdata.json @@ -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" } \ No newline at end of file diff --git a/app/client/cypress/integration/Smoke_TestSuite/Binding/aTobAndbToaBasictest_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Binding/aTobAndbToaBasictest_spec.js new file mode 100644 index 0000000000..4bdab29ccf --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/Binding/aTobAndbToaBasictest_spec.js @@ -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=="); + }); +}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/Binding/loadashBasictest_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Binding/loadashBasictest_spec.js new file mode 100644 index 0000000000..25296a077e --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/Binding/loadashBasictest_spec.js @@ -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"); + }); +}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/Binding/momentBasictest_spec.js b/app/client/cypress/integration/Smoke_TestSuite/Binding/momentBasictest_spec.js new file mode 100644 index 0000000000..b07f008947 --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/Binding/momentBasictest_spec.js @@ -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"); + }); +});