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 <nandan.anantharamu@thoughtspot.com>
Co-authored-by: Arpit Mohan <arpit@appsmith.com>
This commit is contained in:
NandanAnantharamu 2021-03-25 16:31:51 +05:30 committed by GitHub
parent c6e4f91ffb
commit 378330815b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 85 additions and 1 deletions

View File

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

View File

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

View File

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