From 378330815bcb05a83128e3e8768451821c83adf8 Mon Sep 17 00:00:00 2001 From: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com> Date: Thu, 25 Mar 2021 16:31:51 +0530 Subject: [PATCH] Added test for tableWidget bug (#3528) * Added test for tableWidget bug * updated test * review comment incorporated * updated collapse pane test Co-authored-by: nandan.anantharamu Co-authored-by: Arpit Mohan --- ...ble_Derived_Column_Data_validation_spec.js | 84 +++++++++++++++++++ .../DisplayWidgets/Table_PropertyPane_spec.js | 1 + app/client/cypress/support/commands.js | 1 - 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Derived_Column_Data_validation_spec.js diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Derived_Column_Data_validation_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Derived_Column_Data_validation_spec.js new file mode 100644 index 0000000000..426d0095cc --- /dev/null +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_Derived_Column_Data_validation_spec.js @@ -0,0 +1,84 @@ +const commonlocators = require("../../../../locators/commonlocators.json"); +const dsl = require("../../../../fixtures/tableTextPaginationDsl.json"); +const apiPage = require("../../../../locators/ApiEditor.json"); +const publishPage = require("../../../../locators/publishWidgetspage.json"); +const testdata = require("../../../../fixtures/testdata.json"); +const widgetsPage = require("../../../../locators/Widgets.json"); +const publish = require("../../../../locators/publishWidgetspage.json"); +const pages = require("../../../../locators/Pages.json"); + +describe("Test Create Api and Bind to Table widget", function() { + before(() => { + cy.addDsl(dsl); + }); + + it("Create an API and Execute the API and bind with Table", function() { + cy.createAndFillApi(this.data.paginationUrl, this.data.paginationParam); + cy.RunAPI(); + }); + + it("Validate Table with API data and then add a column", function() { + cy.SearchEntityandOpen("Table1"); + cy.testJsontext("tabledata", "{{Api1.data.users}}"); + cy.CheckWidgetProperties(commonlocators.serverSidePaginationCheckbox); + cy.SearchEntityandOpen("Text1"); + cy.testJsontext("text", "{{Table1.selectedRow.url}}"); + cy.SearchEntityandOpen("Table1"); + cy.readTabledata("0", "0").then((tabData) => { + const tableData = tabData; + localStorage.setItem("tableDataPage1", tableData); + }); + cy.ValidateTableData("1"); + cy.addColumn("CustomColumn"); + }); + + it("Table widget toggle test for background color", function() { + cy.editColumn("id"); + cy.wait(1000); + cy.get(widgetsPage.toggleJsBcgColor) + .first() + .click({ force: true }); + cy.wait(1000); + cy.toggleJsAndUpdate("tabledata", "Green"); + cy.get(commonlocators.editPropCrossButton).click(); + cy.wait("@updateLayout"); + cy.readTabledataValidateCSS( + "1", + "0", + "background-color", + "rgb(0, 128, 0)", + ); + }); + + it("Edit column name and validate test for computed value based on column type selected", function() { + cy.SearchEntityandOpen("Table1"); + cy.editColumn("customColumn1"); + cy.readTabledataPublish("1", "9").then((tabData) => { + const tabValue = tabData; + cy.updateComputedValue("{{Api1.data.users[0].email}}"); + cy.readTabledataPublish("1", "9").then((tabData) => { + expect(tabData).not.to.be.equal(tabValue); + cy.log("computed value of plain text " + tabData); + }); + }); + cy.closePropertyPane(); + }); + + it("Update table json data and check the column names updated", function() { + cy.SearchEntityandOpen("Table1"); + cy.testJsontext("tabledata", JSON.stringify(this.data.TableInputUpdate)); + cy.wait("@updateLayout"); + cy.tableColumnDataValidation("id"); + cy.tableColumnDataValidation("email"); + cy.tableColumnDataValidation("userName"); + cy.tableColumnDataValidation("productName"); + cy.tableColumnDataValidation("orderAmount"); + cy.tableColumnDataValidation("customColumn1"); + cy.hideColumn("email"); + cy.hideColumn("userName"); + cy.hideColumn("productName"); + cy.hideColumn("orderAmount"); + cy.get(".draggable-header:contains('CustomColumn')").should("be.visible"); + cy.closePropertyPane(); + }); +}); diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_PropertyPane_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_PropertyPane_spec.js index de911f6f55..0a1b4860a7 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_PropertyPane_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/DisplayWidgets/Table_PropertyPane_spec.js @@ -22,6 +22,7 @@ describe("Table Widget property pane feature validation", function() { it("Check open section and column data in property pane", function() { cy.get(commonlocators.collapsesection) + .scrollIntoView() .first() .should("be.visible") .click(); diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 8f15bed44a..5fddbd63c8 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -1278,7 +1278,6 @@ Cypress.Commands.add("toggleJsAndUpdate", (endp, value) => { Cypress.Commands.add("tableDataHide", (endp, value) => { cy.get(".t--property-control-" + endp + " .CodeMirror textarea") .first() - .focus({ force: true }) .should("not.be.visible"); });