Table UI test cases (#5910)

* TableUITestCases

Commit

* Table-widget-testcases

On Search Text Change Action
Default array data
On Row Selected Action
Explore Widget related documents Verification
On Page Change Action
Default search text
Default selected row
Delete Table Widget
Changing Column data type to "Image"
Changing Column data type to "URL"
Table Widget Functionality To Verify Row Height Functionality
Drage and Drop Table widget and verify default data
Table Widget Functionality To Filter The Data using 'Empty
Table Widget Functionality To Filter The Data using 'Not Empty'

* Discarded changes in cypress.json

Discarded changes in cypress.json

* Updated the test cases

* Undo changes to Cypress.json

Undo changes to Cypress.json

* Added new dsl json file

* Merge branch 'release' into SelectUITestCases

* table test cases fix

Co-authored-by: arslan <>
This commit is contained in:
arslanhaiderbuttar 2021-08-21 12:34:23 +05:00 committed by GitHub
parent 652950d239
commit 01e5d8d839
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 646 additions and 195 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
# test coverage # test coverage
coverage-summary.json coverage-summary.json
app/client/cypress/locators/Widgets.json

View File

@ -1,129 +1,127 @@
{ {
"dsl": { "dsl": {
"widgetName": "MainContainer", "widgetName": "MainContainer",
"backgroundColor": "none", "backgroundColor": "none",
"rightColumn": 1224, "rightColumn": 1224,
"snapColumns": 16, "snapColumns": 16,
"detachFromLayout": true, "detachFromLayout": true,
"widgetId": "0", "widgetId": "0",
"topRow": 0, "topRow": 0,
"bottomRow": 1280, "bottomRow": 1280,
"containerStyle": "none", "containerStyle": "none",
"snapRows": 33, "snapRows": 33,
"parentRowSpace": 1, "parentRowSpace": 1,
"type": "CANVAS_WIDGET", "type": "CANVAS_WIDGET",
"canExtend": true, "canExtend": true,
"version": 8, "version": 8,
"minHeight": 1292, "minHeight": 1292,
"parentColumnSpace": 1, "parentColumnSpace": 1,
"dynamicBindingPathList": [],
"leftColumn": 0,
"children": [
{
"isVisible": true,
"label": "Data",
"widgetName": "Table1",
"searchKey": "",
"tableData": "{{\n[\n {\n \"id\": 2381224,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 2736212,\n \"email\": \"lindsay.ferguson@reqres.in\",\n \"userName\": \"Lindsay Ferguson\",\n \"productName\": \"Tuna Salad\",\n \"orderAmount\": 9.99\n },\n {\n \"id\": 6788734,\n \"email\": \"tobias.funke@reqres.in\",\n \"userName\": \"Tobias Funke\",\n \"productName\": \"Beef steak\",\n \"orderAmount\": 19.99\n }\n]\n}}",
"type": "TABLE_WIDGET",
"isLoading": false,
"parentColumnSpace": 74,
"parentRowSpace": 40,
"leftColumn": 2,
"rightColumn": 10,
"topRow": 12,
"bottomRow": 19,
"parentId": "0",
"widgetId": "sb070qr2ir",
"dynamicBindingPathList": [], "dynamicBindingPathList": [],
"primaryColumns": { "leftColumn": 0,
"id": { "children": [{
"index": 0,
"width": 150,
"id": "id",
"horizontalAlignment": "LEFT",
"verticalAlignment": "CENTER",
"columnType": "text",
"textColor": "#4E5D78",
"textSize": "PARAGRAPH",
"fontStyle": "NORMAL",
"enableFilter": true,
"enableSort": true,
"isVisible": true, "isVisible": true,
"isDerived": false, "label": "Data",
"label": "id", "widgetName": "Table1",
"computedValue": "" "searchKey": "",
}, "tableData": "{{\n[\n {\n \"id\": 2381224,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 2736212,\n \"email\": \"lindsay.ferguson@reqres.in\",\n \"userName\": \"Lindsay Ferguson\",\n \"productName\": \"Tuna Salad\",\n \"orderAmount\": 9.99\n },\n {\n \"id\": 6788734,\n \"email\": \"tobias.funke@reqres.in\",\n \"userName\": \"Tobias Funke\",\n \"productName\": \"Beef steak\",\n \"orderAmount\": 19.99\n }\n]\n}}",
"email": { "type": "TABLE_WIDGET",
"index": 1, "isLoading": false,
"width": 150, "parentColumnSpace": 74,
"id": "email", "parentRowSpace": 40,
"horizontalAlignment": "LEFT", "leftColumn": 2,
"verticalAlignment": "CENTER", "rightColumn": 10,
"columnType": "text", "topRow": 12,
"textColor": "#4E5D78", "bottomRow": 19,
"textSize": "PARAGRAPH", "parentId": "0",
"fontStyle": "NORMAL", "widgetId": "sb070qr2ir",
"enableFilter": true, "dynamicBindingPathList": [],
"enableSort": true, "primaryColumns": {
"isVisible": true, "id": {
"isDerived": false, "index": 0,
"label": "email", "width": 150,
"computedValue": "" "id": "id",
}, "horizontalAlignment": "LEFT",
"userName": { "verticalAlignment": "CENTER",
"index": 2, "columnType": "text",
"width": 150, "textColor": "#4E5D78",
"id": "userName", "textSize": "PARAGRAPH",
"horizontalAlignment": "LEFT", "fontStyle": "NORMAL",
"verticalAlignment": "CENTER", "enableFilter": true,
"columnType": "text", "enableSort": true,
"textColor": "#4E5D78", "isVisible": true,
"textSize": "PARAGRAPH", "isDerived": false,
"fontStyle": "NORMAL", "label": "id",
"enableFilter": true, "computedValue": ""
"enableSort": true, },
"isVisible": true, "email": {
"isDerived": false, "index": 1,
"label": "userName", "width": 150,
"computedValue": "" "id": "email",
}, "horizontalAlignment": "LEFT",
"productName": { "verticalAlignment": "CENTER",
"index": 3, "columnType": "text",
"width": 150, "textColor": "#4E5D78",
"id": "productName", "textSize": "PARAGRAPH",
"horizontalAlignment": "LEFT", "fontStyle": "NORMAL",
"verticalAlignment": "CENTER", "enableFilter": true,
"columnType": "text", "enableSort": true,
"textColor": "#4E5D78", "isVisible": true,
"textSize": "PARAGRAPH", "isDerived": false,
"fontStyle": "NORMAL", "label": "email",
"enableFilter": true, "computedValue": ""
"enableSort": true, },
"isVisible": true, "userName": {
"isDerived": false, "index": 2,
"label": "productName", "width": 150,
"computedValue": "" "id": "userName",
}, "horizontalAlignment": "LEFT",
"orderAmount": { "verticalAlignment": "CENTER",
"index": 4, "columnType": "text",
"width": 150, "textColor": "#4E5D78",
"id": "orderAmount", "textSize": "PARAGRAPH",
"horizontalAlignment": "LEFT", "fontStyle": "NORMAL",
"verticalAlignment": "CENTER", "enableFilter": true,
"columnType": "text", "enableSort": true,
"textColor": "#4E5D78", "isVisible": true,
"textSize": "PARAGRAPH", "isDerived": false,
"fontStyle": "NORMAL", "label": "userName",
"enableFilter": true, "computedValue": ""
"enableSort": true, },
"isVisible": true, "productName": {
"isDerived": false, "index": 3,
"label": "orderAmount", "width": 150,
"computedValue": "" "id": "productName",
} "horizontalAlignment": "LEFT",
} "verticalAlignment": "CENTER",
} "columnType": "text",
] "textColor": "#4E5D78",
} "textSize": "PARAGRAPH",
} "fontStyle": "NORMAL",
"enableFilter": true,
"enableSort": true,
"isVisible": true,
"isDerived": false,
"label": "productName",
"computedValue": ""
},
"orderAmount": {
"index": 4,
"width": 150,
"id": "orderAmount",
"horizontalAlignment": "LEFT",
"verticalAlignment": "CENTER",
"columnType": "text",
"textColor": "#4E5D78",
"textSize": "PARAGRAPH",
"fontStyle": "NORMAL",
"enableFilter": true,
"enableSort": true,
"isVisible": true,
"isDerived": false,
"label": "orderAmount",
"computedValue": ""
}
}
}]
}
}

View File

@ -0,0 +1,127 @@
{
"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": 8,
"minHeight": 1292,
"parentColumnSpace": 1,
"dynamicBindingPathList": [],
"leftColumn": 0,
"children": [{
"isVisible": true,
"label": "Data",
"widgetName": "Table1",
"searchKey": "",
"tableData": "{{[\n {\n \"id\": 2381224,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 2736212,\n \"email\": \"lindsay.ferguson@reqres.in\",\n \"userName\": \"Lindsay Ferguson\",\n \"productName\": \"Tuna Salad\",\n \"orderAmount\": 9.99\n },\n {\n \"id\": 6788734,\n \"email\": \"tobias.funke@reqres.in\",\n \"userName\": \"Tobias Funke\",\n \"productName\": \"Beef steak\",\n \"orderAmount\": 19.99\n },\n {\n \"id\": 2381224,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 2736212,\n \"email\": \"lindsay.ferguson@reqres.in\",\n \"userName\": \"Lindsay Ferguson\",\n \"productName\": \"Tuna Salad\",\n \"orderAmount\": 9.99\n },\n {\n \"id\": 6788734,\n \"email\": \"tobias.funke@reqres.in\",\n \"userName\": \"Tobias Funke\",\n \"productName\": \"Beef steak\",\n \"orderAmount\": 19.99\n }\n]}}",
"type": "TABLE_WIDGET",
"isLoading": false,
"parentColumnSpace": 74,
"parentRowSpace": 40,
"leftColumn": 2,
"rightColumn": 10,
"topRow": 12,
"bottomRow": 19,
"parentId": "0",
"widgetId": "sb070qr2ir",
"dynamicBindingPathList": [],
"primaryColumns": {
"id": {
"index": 0,
"width": 150,
"id": "id",
"horizontalAlignment": "LEFT",
"verticalAlignment": "CENTER",
"columnType": "text",
"textColor": "#4E5D78",
"textSize": "PARAGRAPH",
"fontStyle": "NORMAL",
"enableFilter": true,
"enableSort": true,
"isVisible": true,
"isDerived": false,
"label": "id",
"computedValue": ""
},
"email": {
"index": 1,
"width": 150,
"id": "email",
"horizontalAlignment": "LEFT",
"verticalAlignment": "CENTER",
"columnType": "text",
"textColor": "#4E5D78",
"textSize": "PARAGRAPH",
"fontStyle": "NORMAL",
"enableFilter": true,
"enableSort": true,
"isVisible": true,
"isDerived": false,
"label": "email",
"computedValue": ""
},
"userName": {
"index": 2,
"width": 150,
"id": "userName",
"horizontalAlignment": "LEFT",
"verticalAlignment": "CENTER",
"columnType": "text",
"textColor": "#4E5D78",
"textSize": "PARAGRAPH",
"fontStyle": "NORMAL",
"enableFilter": true,
"enableSort": true,
"isVisible": true,
"isDerived": false,
"label": "userName",
"computedValue": ""
},
"productName": {
"index": 3,
"width": 150,
"id": "productName",
"horizontalAlignment": "LEFT",
"verticalAlignment": "CENTER",
"columnType": "text",
"textColor": "#4E5D78",
"textSize": "PARAGRAPH",
"fontStyle": "NORMAL",
"enableFilter": true,
"enableSort": true,
"isVisible": true,
"isDerived": false,
"label": "productName",
"computedValue": ""
},
"orderAmount": {
"index": 4,
"width": 150,
"id": "orderAmount",
"horizontalAlignment": "LEFT",
"verticalAlignment": "CENTER",
"columnType": "text",
"textColor": "#4E5D78",
"textSize": "PARAGRAPH",
"fontStyle": "NORMAL",
"enableFilter": true,
"enableSort": true,
"isVisible": true,
"isDerived": false,
"label": "orderAmount",
"computedValue": ""
}
}
}]
}
}

View File

@ -11,13 +11,14 @@ describe("Table Widget Functionality with Hidden and Resized Columns", function(
it("Table Widget Functionality with Hidden and Resized Columns", function() { it("Table Widget Functionality with Hidden and Resized Columns", function() {
cy.PublishtheApp(); cy.PublishtheApp();
// Verify column header width should be equal to table width
cy.get(".t--widget-tablewidget") cy.get(".t--widget-tablewidget")
.invoke("outerWidth") .invoke("outerWidth")
.then((tableWidth) => { .then((tableWidth) => {
cy.get(".t--widget-tablewidget .thead .tr") cy.get(".t--widget-tablewidget .thead .tr")
.invoke("outerWidth") .invoke("outerWidth")
.then((width) => { .then((columnHeaderWidth) => {
expect(width).to.be.at.least(tableWidth); expect(columnHeaderWidth).to.be.at.least(tableWidth);
}); });
}); });
}); });

View File

@ -14,42 +14,59 @@ describe("Test Create Api and Bind to Table widget", function() {
}); });
it("Create an API and Execute the API and bind with Table", function() { it("Create an API and Execute the API and bind with Table", function() {
// Create and execute an API and bind with table
cy.createAndFillApi(this.data.paginationUrl, this.data.paginationParam); cy.createAndFillApi(this.data.paginationUrl, this.data.paginationParam);
cy.RunAPI(); cy.RunAPI();
}); });
it("Validate Table with API data and then add a column", function() { it("Validate Table with API data and then add a column", function() {
// Open property pane
cy.SearchEntityandOpen("Table1"); cy.SearchEntityandOpen("Table1");
// Clear Table data and enter Apil data into table data
cy.testJsontext("tabledata", "{{Api1.data.users}}"); cy.testJsontext("tabledata", "{{Api1.data.users}}");
// Check Widget properties
cy.CheckWidgetProperties(commonlocators.serverSidePaginationCheckbox); cy.CheckWidgetProperties(commonlocators.serverSidePaginationCheckbox);
// Open Text1 in propert pane
cy.SearchEntityandOpen("Text1"); cy.SearchEntityandOpen("Text1");
// Change the Text value to selected row url
cy.testJsontext("text", "{{Table1.selectedRow.url}}"); cy.testJsontext("text", "{{Table1.selectedRow.url}}");
// Open Table1 propert pane
cy.SearchEntityandOpen("Table1"); cy.SearchEntityandOpen("Table1");
// Compare table 1st index data with itself
cy.readTabledata("0", "0").then((tabData) => { cy.readTabledata("0", "0").then((tabData) => {
const tableData = tabData; const tableData = tabData;
localStorage.setItem("tableDataPage1", tableData); localStorage.setItem("tableDataPage1", tableData);
}); });
// Verify 1st index data
cy.ValidateTableData("1"); cy.ValidateTableData("1");
// add new column
cy.addColumn("CustomColumn"); cy.addColumn("CustomColumn");
}); });
it("Table widget toggle test for background color", function() { it("Table widget toggle test for background color", function() {
// Open id property pane
cy.editColumn("id"); cy.editColumn("id");
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000); cy.wait(1000);
// Click on cell background JS button
cy.get(widgetsPage.toggleJsBcgColor) cy.get(widgetsPage.toggleJsBcgColor)
.first() .first()
.click({ force: true }); .click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000); cy.wait(1000);
// Change the cell background color to green
cy.toggleJsAndUpdate("tabledata", "Green"); cy.toggleJsAndUpdate("tabledata", "Green");
// Go back to table property pane
cy.get(".t--property-pane-back-btn").click({ force: true }); cy.get(".t--property-pane-back-btn").click({ force: true });
cy.wait("@updateLayout"); cy.wait("@updateLayout");
// verify the cell background color
cy.readTabledataValidateCSS("1", "0", "background-color", "rgb(0, 128, 0)"); 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() { it("Edit column name and validate test for computed value based on column type selected", function() {
// opoen customColumn1 property pane
cy.editColumn("customColumn1"); cy.editColumn("customColumn1");
// Enter Apil 1st user email data into customColumn1
cy.readTabledataPublish("1", "9").then((tabData) => { cy.readTabledataPublish("1", "9").then((tabData) => {
const tabValue = tabData; const tabValue = tabData;
cy.updateComputedValue("{{Api1.data.users[0].email}}"); cy.updateComputedValue("{{Api1.data.users[0].email}}");
@ -62,19 +79,24 @@ describe("Test Create Api and Bind to Table widget", function() {
}); });
it("Update table json data and check the column names updated", function() { it("Update table json data and check the column names updated", function() {
// Open table propert pane
cy.SearchEntityandOpen("Table1"); cy.SearchEntityandOpen("Table1");
// Change the table data
cy.testJsontext("tabledata", JSON.stringify(this.data.TableInputUpdate)); cy.testJsontext("tabledata", JSON.stringify(this.data.TableInputUpdate));
cy.wait("@updateLayout"); cy.wait("@updateLayout");
// verify columns are visible or not in the propert pane
cy.tableColumnDataValidation("id"); cy.tableColumnDataValidation("id");
cy.tableColumnDataValidation("email"); cy.tableColumnDataValidation("email");
cy.tableColumnDataValidation("userName"); cy.tableColumnDataValidation("userName");
cy.tableColumnDataValidation("productName"); cy.tableColumnDataValidation("productName");
cy.tableColumnDataValidation("orderAmount"); cy.tableColumnDataValidation("orderAmount");
cy.tableColumnDataValidation("customColumn1"); cy.tableColumnDataValidation("customColumn1");
// Hide the columns in property pane
cy.hideColumn("email"); cy.hideColumn("email");
cy.hideColumn("userName"); cy.hideColumn("userName");
cy.hideColumn("productName"); cy.hideColumn("productName");
cy.hideColumn("orderAmount"); cy.hideColumn("orderAmount");
// verify customColumn is visible in the table
cy.get(".draggable-header:contains('CustomColumn')").should("be.visible"); cy.get(".draggable-header:contains('CustomColumn')").should("be.visible");
cy.closePropertyPane(); cy.closePropertyPane();
}); });

View File

@ -13,161 +13,222 @@ describe("Table Widget property pane feature validation", function() {
}); });
it("Test to validate table pagination is disabled", function() { it("Test to validate table pagination is disabled", function() {
// Verify pagination is disabled
cy.get(".t--table-widget-prev-page").should("have.attr", "disabled"); cy.get(".t--table-widget-prev-page").should("have.attr", "disabled");
cy.get(".t--table-widget-next-page").should("have.attr", "disabled"); cy.get(".t--table-widget-next-page").should("have.attr", "disabled");
cy.get(".t--table-widget-page-input input").should("have.attr", "disabled"); cy.get(".t--table-widget-page-input input").should("have.attr", "disabled");
}); });
it("Test to validate text allignment", function() { it("Test to validate text allignment", function() {
// Open property pane
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
// Change the text align to center
cy.get(widgetsPage.centerAlign) cy.get(widgetsPage.centerAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
// Verify the center text alignment
cy.readTabledataValidateCSS("1", "0", "justify-content", "center"); cy.readTabledataValidateCSS("1", "0", "justify-content", "center");
// Change the text align to right
cy.get(widgetsPage.rightAlign) cy.get(widgetsPage.rightAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
// Verify the right text alignment
cy.readTabledataValidateCSS("1", "0", "justify-content", "flex-end"); cy.readTabledataValidateCSS("1", "0", "justify-content", "flex-end");
// Change the text align to left
cy.get(widgetsPage.leftAlign) cy.get(widgetsPage.leftAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
// verify the left text alignment
cy.readTabledataValidateCSS("1", "0", "justify-content", "flex-start"); cy.readTabledataValidateCSS("1", "0", "justify-content", "flex-start");
}); });
it("Test to validate column heading allignment", function() { it("Test to validate column heading allignment", function() {
// cy.openPropertyPane("tablewidget"); // cy.openPropertyPane("tablewidget");
// Change the text align to center
cy.get(widgetsPage.centerAlign) cy.get(widgetsPage.centerAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
// Verify the column headings are center aligned
cy.get(".draggable-header") cy.get(".draggable-header")
.first() .first()
.should("have.css", "text-align", "center"); .should("have.css", "text-align", "center");
// Change the text align to right
cy.get(widgetsPage.rightAlign) cy.get(widgetsPage.rightAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
// Verify the column headings are right aligned
cy.get(".draggable-header") cy.get(".draggable-header")
.first() .first()
.should("have.css", "text-align", "right"); .should("have.css", "text-align", "right");
// Change the text align to left
cy.get(widgetsPage.leftAlign) cy.get(widgetsPage.leftAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
// Verify the column headings are left aligned
cy.get(".draggable-header") cy.get(".draggable-header")
.first() .first()
.should("have.css", "text-align", "left"); .should("have.css", "text-align", "left");
}); });
it("Test to validate text format", function() { it("Test to validate text format", function() {
// Select the bold font style
cy.get(widgetsPage.bold).click({ force: true }); cy.get(widgetsPage.bold).click({ force: true });
// Varify the font style is bold
cy.readTabledataValidateCSS("1", "0", "font-weight", "700"); cy.readTabledataValidateCSS("1", "0", "font-weight", "700");
// Change the font style to italic
cy.get(widgetsPage.italics).click({ force: true }); cy.get(widgetsPage.italics).click({ force: true });
// Verify the font style is italic
cy.readTabledataValidateCSS("1", "0", "font-style", "italic"); cy.readTabledataValidateCSS("1", "0", "font-style", "italic");
}); });
it("Test to validate vertical allignment", function() { it("Test to validate vertical allignment", function() {
// Select the top vertical alignment
cy.get(widgetsPage.verticalTop).click({ force: true }); cy.get(widgetsPage.verticalTop).click({ force: true });
// verify vertical alignment is top
cy.readTabledataValidateCSS("1", "0", "align-items", "flex-start"); cy.readTabledataValidateCSS("1", "0", "align-items", "flex-start");
// Change the vertical alignment to center
cy.get(widgetsPage.verticalCenter) cy.get(widgetsPage.verticalCenter)
.last() .last()
.click({ force: true }); .click({ force: true });
// Verify the vertical alignment is centered
cy.readTabledataValidateCSS("1", "0", "align-items", "center"); cy.readTabledataValidateCSS("1", "0", "align-items", "center");
// Change the vertical alignment to bottom
cy.get(widgetsPage.verticalBottom) cy.get(widgetsPage.verticalBottom)
.last() .last()
.click({ force: true }); .click({ force: true });
// Verify the vertical alignment is bottom
cy.readTabledataValidateCSS("1", "0", "align-items", "flex-end"); cy.readTabledataValidateCSS("1", "0", "align-items", "flex-end");
cy.get(commonlocators.editPropCrossButton).click({ force: true }); cy.get(commonlocators.editPropCrossButton).click({ force: true });
}); });
it("Table widget toggle test for text alignment", function() { it("Table widget toggle test for text alignment", function() {
// Open property pane
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
// Open property pane of column "id"
cy.editColumn("id"); cy.editColumn("id");
// Click on text align JS
cy.get(widgetsPage.toggleTextAlign) cy.get(widgetsPage.toggleTextAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000); cy.wait(1000);
// Change the text align value to right for michael and left for others
cy.toggleJsAndUpdate("tabledata", testdata.bindingGenAlign); cy.toggleJsAndUpdate("tabledata", testdata.bindingGenAlign);
// Close propert pane
cy.get(commonlocators.editPropCrossButton).click({ force: true }); cy.get(commonlocators.editPropCrossButton).click({ force: true });
// Verify the text michael id is right aligned
cy.readTabledataValidateCSS("0", "0", "justify-content", "flex-end"); cy.readTabledataValidateCSS("0", "0", "justify-content", "flex-end");
// Verify the 2nd id is left aligned
cy.readTabledataValidateCSS("1", "0", "justify-content", "flex-start"); cy.readTabledataValidateCSS("1", "0", "justify-content", "flex-start");
}); });
it("Table widget change text size and validate", function() { it("Table widget change text size and validate", function() {
// Verify font size is 14px
cy.readTabledataValidateCSS("0", "0", "font-size", "14px"); cy.readTabledataValidateCSS("0", "0", "font-size", "14px");
// Open property pane
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
// Open property pane
cy.editColumn("id"); cy.editColumn("id");
// Click on text size JS
cy.get(widgetsPage.toggleTextAlign) cy.get(widgetsPage.toggleTextAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000); cy.wait(1000);
// Open txe size dropdown options
cy.get(widgetsPage.textSize) cy.get(widgetsPage.textSize)
.last() .last()
.click({ force: true }); .click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000); cy.wait(1000);
// Select Heading 1 text size
cy.selectTextSize("Heading 1"); cy.selectTextSize("Heading 1");
// Verify the font size is 24px
cy.readTabledataValidateCSS("0", "0", "font-size", "24px"); cy.readTabledataValidateCSS("0", "0", "font-size", "24px");
// close propert pane
cy.get(commonlocators.editPropCrossButton).click({ force: true }); cy.get(commonlocators.editPropCrossButton).click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000); cy.wait(1000);
// Verify the font size is 24px
cy.readTabledataValidateCSS("0", "0", "font-size", "24px"); cy.readTabledataValidateCSS("0", "0", "font-size", "24px");
}); });
it("Test to validate open new tab icon shows when URL type data is hovered", function() { it("Test to validate open new tab icon shows when URL type data is hovered", function() {
// Open property pane
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
// Open email property pane
cy.editColumn("email"); cy.editColumn("email");
// Change column type to url
cy.changeColumnType("URL"); cy.changeColumnType("URL");
// Show the url hidden icon in front of first email
cy.get( cy.get(
`.t--widget-tablewidget .tbody .td[data-rowindex=1][data-colindex=1] .hidden-icon`, `.t--widget-tablewidget .tbody .td[data-rowindex=1][data-colindex=1] .hidden-icon`,
).invoke("show"); ).invoke("show");
// Verify the url icon is visible on hover over email
cy.get( cy.get(
`.t--widget-tablewidget .tbody .td[data-rowindex=1][data-colindex=1] .hidden-icon`, `.t--widget-tablewidget .tbody .td[data-rowindex=1][data-colindex=1] .hidden-icon`,
).should("be.visible"); ).should("be.visible");
// Close property pane
cy.get(commonlocators.editPropCrossButton).click(); cy.get(commonlocators.editPropCrossButton).click();
}); });
it("Edit column name and test for table header changes", function() { it("Edit column name and test for table header changes", function() {
// Open property pane
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
// Open email property pane
cy.editColumn("email"); cy.editColumn("email");
// CHange the Column email name to Email Address
cy.editColName("Email Address"); cy.editColName("Email Address");
// verify changed email name is visible
cy.get(".draggable-header:contains('Email Address')").should("be.visible"); cy.get(".draggable-header:contains('Email Address')").should("be.visible");
cy.get(commonlocators.editPropCrossButton).click(); cy.get(commonlocators.editPropCrossButton).click();
}); });
it("Test to validate text color and text background", function() { it("Test to validate text color and text background", function() {
// Open property pane
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
// Click on text color input field
cy.get(widgetsPage.textColor) cy.get(widgetsPage.textColor)
.first() .first()
.click({ force: true }); .click({ force: true });
// Select green color
cy.xpath(widgetsPage.greenColor).click(); cy.xpath(widgetsPage.greenColor).click();
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
cy.wait("@updateLayout"); cy.wait("@updateLayout");
// Verify the text color is green
cy.readTabledataValidateCSS("1", "0", "color", "rgb(3, 179, 101)"); cy.readTabledataValidateCSS("1", "0", "color", "rgb(3, 179, 101)");
// Change the text color and enter purple in input field
cy.get(widgetsPage.textColor) cy.get(widgetsPage.textColor)
.clear({ force: true }) .clear({ force: true })
.type("purple", { force: true }); .type("purple", { force: true });
cy.wait("@updateLayout"); cy.wait("@updateLayout");
// Verify the text color is purple
cy.readTabledataValidateCSS("1", "0", "color", "rgb(128, 0, 128)"); cy.readTabledataValidateCSS("1", "0", "color", "rgb(128, 0, 128)");
// Click on cell background color
cy.get(widgetsPage.backgroundColor) cy.get(widgetsPage.backgroundColor)
.first() .first()
.click({ force: true }); .click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
// select the green color
cy.xpath(widgetsPage.greenColor) cy.xpath(widgetsPage.greenColor)
.first() .first()
.click(); .click();
cy.wait("@updateLayout"); cy.wait("@updateLayout");
// Verify the cell background color is green
cy.readTabledataValidateCSS( cy.readTabledataValidateCSS(
"1", "1",
"0", "0",
"background", "background",
"rgb(3, 179, 101) none repeat scroll 0% 0% / auto padding-box border-box", "rgb(3, 179, 101) none repeat scroll 0% 0% / auto padding-box border-box",
); );
// Change the cell background color and enter purple in input field
cy.get(widgetsPage.backgroundColor) cy.get(widgetsPage.backgroundColor)
.clear({ force: true }) .clear({ force: true })
.type("purple", { force: true }); .type("purple", { force: true });
cy.wait("@updateLayout"); cy.wait("@updateLayout");
// Verify the cell background color is purple
cy.readTabledataValidateCSS( cy.readTabledataValidateCSS(
"1", "1",
"0", "0",

View File

@ -1,8 +1,7 @@
const widgetsPage = require("../../../../locators/Widgets.json"); const widgetsPage = require("../../../../locators/Widgets.json");
const commonlocators = require("../../../../locators/commonlocators.json"); const commonlocators = require("../../../../locators/commonlocators.json");
const publish = require("../../../../locators/publishWidgetspage.json"); const publish = require("../../../../locators/publishWidgetspage.json");
const dsl = require("../../../../fixtures/tableNewDsl.json"); const dsl = require("../../../../fixtures/tableNewDslWithPagination.json");
const pages = require("../../../../locators/Pages.json");
const testdata = require("../../../../fixtures/testdata.json"); const testdata = require("../../../../fixtures/testdata.json");
describe("Table Widget property pane feature validation", function() { describe("Table Widget property pane feature validation", function() {
@ -10,71 +9,205 @@ describe("Table Widget property pane feature validation", function() {
cy.addDsl(dsl); cy.addDsl(dsl);
}); });
// To be done:
// Column Data type: Video
it("Verify default array data", function() {
// Open property pane
cy.openPropertyPane("tablewidget");
// Open Widget side bar
cy.get(widgetsPage.addWidget).click();
// Drag and drop table widget
cy.dragAndDropToCanvas("tablewidget", { x: 300, y: 200 });
// close Widget side bar
cy.get(widgetsPage.closeWidgetBar).click({ force: true });
cy.wait(2000);
cy.SearchEntityandOpen("Table2");
// Verify default array data
cy.get(widgetsPage.tabedataField).should("not.be.empty");
cy.deleteWidget(widgetsPage.tableWidget);
cy.wait(2000);
});
it("Verify On Row Selected Action", function() {
// Open property pane
cy.openPropertyPane("tablewidget");
// Select show message in the "on selected row" dropdown
cy.onTableAction(0, "onrowselected", "Row is selected");
cy.PublishtheApp();
// Select 1st row
cy.isSelectRow(2);
cy.wait(2000);
// Verify Row is selected by showing the message
cy.get(commonlocators.toastmsg).contains("Row is selected");
cy.get(publish.backToEditor).click();
});
it("Check On Page Change Action", function() {
// Open property pane
cy.openPropertyPane("tablewidget");
// Select show message in the "on selected row" dropdown
cy.onTableAction(1, "onpagechange", "Page Changed");
cy.PublishtheApp();
cy.wait(2000);
// Change the page
cy.get(widgetsPage.nextPageButton).click({ force: true });
// Verify the page is changed
cy.get(commonlocators.toastmsg).contains("Page Changed");
cy.get(publish.backToEditor).click();
});
it("Verify On Search Text Change Action", function() {
// Open property pane
cy.openPropertyPane("tablewidget");
// Show Message on Search text change Action
cy.onTableAction(3, "onsearchtextchanged", "Search Text Changed");
cy.PublishtheApp();
// Change the Search text
cy.get(widgetsPage.searchField).type("Hello");
cy.wait(2000);
// Verify the search text is changed
cy.get(commonlocators.toastmsg).contains("Search Text Changed");
cy.get(publish.backToEditor).click();
});
it("Explore Widget related documents Verification", function() {
// Open property pane
cy.openPropertyPane("tablewidget");
// Click on "Explore widget related docs" button
cy.get(widgetsPage.exploreWidget).click();
// Verify the widget related document
cy.get(widgetsPage.widgetRelatedDocument).should("contain", "Table");
cy.wait(2000);
cy.get(widgetsPage.header).click();
cy.wait(1000);
cy.PublishtheApp();
});
it("Check open section and column data in property pane", function() { it("Check open section and column data in property pane", function() {
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
// Validate the columns are visible in the property pane
cy.tableColumnDataValidation("id"); cy.tableColumnDataValidation("id");
cy.tableColumnDataValidation("email"); cy.tableColumnDataValidation("email");
cy.tableColumnDataValidation("userName"); cy.tableColumnDataValidation("userName");
cy.tableColumnDataValidation("productName"); cy.tableColumnDataValidation("productName");
cy.tableColumnDataValidation("orderAmount"); cy.tableColumnDataValidation("orderAmount");
// Updating the column name ; "id" > "TestUpdated"
cy.tableColumnPopertyUpdate("id", "TestUpdated"); cy.tableColumnPopertyUpdate("id", "TestUpdated");
// Add new column in the table with name "CustomColumn"
cy.addColumn("CustomColumn"); cy.addColumn("CustomColumn");
cy.tableColumnDataValidation("customColumn1"); //To be updated later cy.tableColumnDataValidation("customColumn1"); //To be updated later
// Hide all other columns
cy.hideColumn("email"); cy.hideColumn("email");
cy.hideColumn("userName"); cy.hideColumn("userName");
cy.hideColumn("productName"); cy.hideColumn("productName");
cy.hideColumn("orderAmount"); cy.hideColumn("orderAmount");
// Verifying the newly added column
cy.get(".draggable-header:contains('CustomColumn')").should("be.visible"); cy.get(".draggable-header:contains('CustomColumn')").should("be.visible");
}); });
it("Edit column name and validate test for computed value based on column type selected", function() { it("Column Detail - Edit column name and validate test for computed value based on column type selected", function() {
cy.makeColumnVisible("email");
cy.makeColumnVisible("userName");
cy.makeColumnVisible("productName");
cy.makeColumnVisible("orderAmount");
// Open column detail to be edited by draggable id
cy.editColumn("id"); cy.editColumn("id");
// Change the column name
cy.editColName("updatedId"); cy.editColName("updatedId");
cy.readTabledataPublish("1", "2").then((tabData) => { // Reading single cell value of the table and verify it's value.
cy.readTabledataPublish("1", "1").then((tabData) => {
const tabValue = tabData; const tabValue = tabData;
cy.log(tabData);
expect(tabData).to.not.equal("2736212"); expect(tabData).to.not.equal("2736212");
// Changing the Computed value from "id" to "Email"
cy.updateComputedValue(testdata.currentRowEmail); cy.updateComputedValue(testdata.currentRowEmail);
cy.readTabledataPublish("1", "2").then((tabData) => { // Reading single cell value of the table and verify it's value.
expect(tabData).to.be.equal(tabValue); cy.readTabledataPublish("1", "0").then((tabData2) => {
cy.log("computed value of plain text " + tabData); cy.log(tabData2);
expect(tabData2).to.be.equal(tabValue);
cy.log("computed value of plain text " + tabData2);
}); });
}); });
// Changing Column data type from "Plain text" to "Number"
cy.changeColumnType("Number"); cy.changeColumnType("Number");
cy.readTabledataPublish("1", "5").then((tabData) => { cy.readTabledataPublish("1", "4").then((tabData) => {
const tabValue = tabData; cy.log(tabData);
expect(tabData).to.not.equal("lindsay.ferguson@reqres.in"); expect(tabData).to.not.equal("lindsay.ferguson@reqres.in");
// Email to "orderAmount"
cy.updateComputedValue(testdata.currentRowOrderAmt); cy.updateComputedValue(testdata.currentRowOrderAmt);
cy.readTabledataPublish("1", "0").then((tabData) => { cy.readTabledataPublish("1", "0").then((tabData2) => {
expect(tabData).to.be.equal(tabValue); cy.log(tabData2);
cy.log("computed value of number is " + tabData); expect(tabData2).to.be.equal(tabData);
cy.log("computed value of number is " + tabData2);
}); });
}); });
// Changing Column data type from "Number" to "Date"
cy.changeColumnType("Date"); cy.changeColumnType("Date");
// orderAmout to "Moment Date"
cy.updateComputedValue(testdata.momentDate); cy.updateComputedValue(testdata.momentDate);
cy.readTabledataPublish("1", "1").then((tabData) => { cy.readTabledataPublish("1", "1").then((tabData) => {
expect(tabData).to.not.equal("9.99"); expect(tabData).to.not.equal("9.99");
cy.log("computed value of Date is " + tabData); cy.log("computed value of Date is " + tabData);
}); });
// cy.changeColumnType("Time"); // Changing Column data type from "URL" to "Video"
// cy.updateComputedValue(testdata.momentDate); /* const videoVal = 'https://youtu.be/Sc-m3ceZyfk';
// cy.readTabledataPublish("1", "0").then(tabData => { cy.changeColumnType("Video");
// expect(tabData).to.not.equal("2736212"); // "Moement "date" to "Video"
// cy.log("computed value of time is " + tabData); cy.updateComputedValue(videoVal);
// }); // cy.testJson text("computedvalue", videoVal, )
// Verifying the href of the Video added.
cy.readTableLinkPublish("1", "1").then((hrefVal) => {
expect(hrefVal).to.be.equal(videoVal);
});*/
// Changing Column data type from "Date" to "Image"
const imageVal =
"https://images.pexels.com/photos/736230/pexels-photo-736230.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500";
cy.changeColumnType("Image");
// "Moement "date" to "Image"
cy.updateComputedValue(imageVal);
// Verifying the href of the image added.
cy.readTableLinkPublish("1", "0").then((hrefVal) => {
expect(hrefVal).to.be.contains(imageVal);
});
// Changing Column data type from "Date" to "URl"
cy.readTabledataPublish("1", "1").then(() => {
cy.changeColumnType("URL");
// "Image" to "url"
cy.updateComputedValue(testdata.currentRowEmail);
cy.readTabledataPublish("1", "0").then((tabData2) => {
expect(tabData2).to.not.equal("lindsay.ferguson@reqres.in");
cy.log("computed value of URL is " + tabData2);
});
});
}); });
it("Test to validate text allignment", function() { it("Test to validate text allignment", function() {
// Verifying Center Alignment
cy.get(widgetsPage.centerAlign) cy.get(widgetsPage.centerAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
cy.readTabledataValidateCSS("0", "0", "justify-content", "center"); cy.readTabledataValidateCSS("1", "0", "justify-content", "center");
// Verifying Right Alignment
cy.get(widgetsPage.rightAlign) cy.get(widgetsPage.rightAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
cy.readTabledataValidateCSS("0", "0", "justify-content", "flex-end"); cy.readTabledataValidateCSS("1", "0", "justify-content", "flex-end");
// Verifying Left Alignment
cy.get(widgetsPage.leftAlign) cy.get(widgetsPage.leftAlign)
.first() .first()
.click({ force: true }); .click({ force: true });
@ -82,19 +215,24 @@ describe("Table Widget property pane feature validation", function() {
}); });
it("Test to validate text format", function() { it("Test to validate text format", function() {
// Validate Bold text
cy.get(widgetsPage.bold).click({ force: true }); cy.get(widgetsPage.bold).click({ force: true });
cy.readTabledataValidateCSS("0", "0", "font-weight", "700"); cy.readTabledataValidateCSS("1", "0", "font-weight", "700");
// Validate Italic text
cy.get(widgetsPage.italics).click({ force: true }); cy.get(widgetsPage.italics).click({ force: true });
cy.readTabledataValidateCSS("0", "0", "font-style", "italic"); cy.readTabledataValidateCSS("0", "0", "font-style", "italic");
}); });
it("Test to validate vertical allignment", function() { it("Test to validate vertical allignment", function() {
// Validate vertical alignemnt of Cell text to TOP
cy.get(widgetsPage.verticalTop).click({ force: true }); cy.get(widgetsPage.verticalTop).click({ force: true });
cy.readTabledataValidateCSS("0", "0", "align-items", "flex-start"); cy.readTabledataValidateCSS("1", "0", "align-items", "flex-start");
// Validate vertical alignemnt of Cell text to Center
cy.get(widgetsPage.verticalCenter) cy.get(widgetsPage.verticalCenter)
.last() .last()
.click({ force: true }); .click({ force: true });
cy.readTabledataValidateCSS("0", "0", "align-items", "center"); cy.readTabledataValidateCSS("1", "0", "align-items", "center");
// Validate vertical alignemnt of Cell text to Bottom
cy.get(widgetsPage.verticalBottom) cy.get(widgetsPage.verticalBottom)
.last() .last()
.click({ force: true }); .click({ force: true });
@ -105,26 +243,30 @@ describe("Table Widget property pane feature validation", function() {
cy.get(widgetsPage.textColor) cy.get(widgetsPage.textColor)
.first() .first()
.click({ force: true }); .click({ force: true });
// Changing text color to GREEN and validate
cy.xpath(widgetsPage.greenColor).click(); cy.xpath(widgetsPage.greenColor).click();
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(5000); cy.wait(5000);
cy.wait("@updateLayout"); cy.wait("@updateLayout");
cy.readTabledataValidateCSS("0", "0", "color", "rgb(3, 179, 101)"); cy.readTabledataValidateCSS("1", "0", "color", "rgb(3, 179, 101)");
// Changing text color to PURPLE and validate using JS
cy.get(widgetsPage.toggleJsColor).click(); cy.get(widgetsPage.toggleJsColor).click();
cy.testCodeMirrorLast("purple"); cy.testCodeMirrorLast("purple");
cy.wait("@updateLayout"); cy.wait("@updateLayout");
cy.readTabledataValidateCSS("0", "0", "color", "rgb(128, 0, 128)"); cy.readTabledataValidateCSS("1", "0", "color", "rgb(128, 0, 128)");
// Changing Cell backgroud color to GREEN and validate
cy.get(widgetsPage.backgroundColor) cy.get(widgetsPage.backgroundColor)
.first() .first()
.click({ force: true }); .click({ force: true });
cy.xpath(widgetsPage.greenColor).click(); cy.xpath(widgetsPage.greenColor).click();
cy.wait("@updateLayout"); cy.wait("@updateLayout");
cy.readTabledataValidateCSS( cy.readTabledataValidateCSS(
"0", "1",
"0", "0",
"background", "background",
"rgb(3, 179, 101) none repeat scroll 0% 0% / auto padding-box border-box", "rgb(3, 179, 101) none repeat scroll 0% 0% / auto padding-box border-box",
); );
// Changing Cell backgroud color to PURPLE and validate using JS
cy.get(widgetsPage.toggleJsBcgColor).click(); cy.get(widgetsPage.toggleJsBcgColor).click();
cy.testCodeMirrorLast("purple"); cy.testCodeMirrorLast("purple");
cy.wait("@updateLayout"); cy.wait("@updateLayout");
@ -134,5 +276,50 @@ describe("Table Widget property pane feature validation", function() {
"background", "background",
"rgb(128, 0, 128) none repeat scroll 0% 0% / auto padding-box border-box", "rgb(128, 0, 128) none repeat scroll 0% 0% / auto padding-box border-box",
); );
// close property pane
cy.closePropertyPane();
});
it("Verify default search text", function() {
// Open property pane
cy.openPropertyPane("tablewidget");
// Chage deat search text value to "data"
cy.testJsontext("defaultsearchtext", "data");
cy.PublishtheApp();
// Verify the deaullt search text
cy.get(widgetsPage.searchField).should("have.value", "data");
cy.get(publish.backToEditor).click();
});
it("Verify default selected row", function() {
// Open property pane
cy.openPropertyPane("tablewidget");
cy.testJsontext("defaultsearchtext", "");
// Change default selected row value to 1
cy.get(widgetsPage.defaultSelectedRowField).type("1");
cy.wait(2000);
cy.PublishtheApp();
// Verify the default selected row
cy.get(widgetsPage.selectedRow).should(
"have.css",
"background-color",
"rgba(106, 134, 206, 0.1)",
);
cy.get(publish.backToEditor).click();
});
it("Table-Delete Verification", function() {
// Open property pane
cy.openPropertyPane("tablewidget");
// Delete the Table widget
cy.deleteWidget(widgetsPage.tableWidget);
cy.PublishtheApp();
// Verify the Table widget is deleted
cy.get(widgetsPage.tableWidget).should("not.exist");
});
afterEach(() => {
// put your clean up code if any
cy.goToEditFromPublish();
}); });
}); });

View File

@ -16,36 +16,52 @@ describe("Test Create Api and Bind to Table widget", function() {
}); });
it("Validate Table with API data and then add a column", function() { it("Validate Table with API data and then add a column", function() {
// Open property pane
cy.SearchEntityandOpen("Table1"); cy.SearchEntityandOpen("Table1");
// Change the table data to Apil data users
cy.testJsontext("tabledata", "{{Api1.data.users}}"); cy.testJsontext("tabledata", "{{Api1.data.users}}");
// Check server sided pagination
cy.CheckWidgetProperties(commonlocators.serverSidePaginationCheckbox); cy.CheckWidgetProperties(commonlocators.serverSidePaginationCheckbox);
// Open property pane of Text1
cy.SearchEntityandOpen("Text1"); cy.SearchEntityandOpen("Text1");
// Change the text value to selected url
cy.testJsontext("text", "{{Table1.selectedRow.url}}"); cy.testJsontext("text", "{{Table1.selectedRow.url}}");
// Open property pane
cy.SearchEntityandOpen("Table1"); cy.SearchEntityandOpen("Table1");
// Copmre the table 1st index with itself
cy.readTabledata("0", "0").then((tabData) => { cy.readTabledata("0", "0").then((tabData) => {
const tableData = tabData; const tableData = tabData;
localStorage.setItem("tableDataPage1", tableData); localStorage.setItem("tableDataPage1", tableData);
}); });
// Validate the table 1st index
cy.ValidateTableData("1"); cy.ValidateTableData("1");
// Add new column
cy.addColumn("CustomColumn"); cy.addColumn("CustomColumn");
}); });
it("Update table json data and check the column names updated and validate empty value", function() { it("Update table json data and check the column names updated and validate empty value", function() {
// Open property pane
cy.SearchEntityandOpen("Table1"); cy.SearchEntityandOpen("Table1");
// Change the table data
cy.testJsontext("tabledata", JSON.stringify(this.data.TableInputWithNull)); cy.testJsontext("tabledata", JSON.stringify(this.data.TableInputWithNull));
cy.wait("@updateLayout"); cy.wait("@updateLayout");
// Verify the columns are visible in property pane
cy.tableColumnDataValidation("id"); cy.tableColumnDataValidation("id");
cy.tableColumnDataValidation("email"); cy.tableColumnDataValidation("email");
cy.tableColumnDataValidation("userName"); cy.tableColumnDataValidation("userName");
cy.tableColumnDataValidation("productName"); cy.tableColumnDataValidation("productName");
cy.tableColumnDataValidation("orderAmount"); cy.tableColumnDataValidation("orderAmount");
cy.tableColumnDataValidation("customColumn1"); cy.tableColumnDataValidation("customColumn1");
// Hide the columns in the table from property pane
cy.hideColumn("id"); cy.hideColumn("id");
cy.hideColumn("email"); cy.hideColumn("email");
cy.hideColumn("userName"); cy.hideColumn("userName");
cy.hideColumn("productName"); cy.hideColumn("productName");
// Verify CustomColumn is visible
cy.get(".draggable-header:contains('CustomColumn')").should("be.visible"); cy.get(".draggable-header:contains('CustomColumn')").should("be.visible");
// close property pane
cy.closePropertyPane(); cy.closePropertyPane();
// Validate the empty values
cy.readTabledataPublish("0", "0").then((tabData) => { cy.readTabledataPublish("0", "0").then((tabData) => {
const tabValue = tabData; const tabValue = tabData;
expect(tabValue).to.be.equal(""); expect(tabValue).to.be.equal("");
@ -53,14 +69,18 @@ describe("Test Create Api and Bind to Table widget", function() {
}); });
it("Check Selected Row(s) Resets When Table Data Changes", function() { it("Check Selected Row(s) Resets When Table Data Changes", function() {
// Select 1st row
cy.isSelectRow(1); cy.isSelectRow(1);
// Empty first row
cy.testJsontext("tabledata", "[]"); cy.testJsontext("tabledata", "[]");
cy.wait("@updateLayout"); cy.wait("@updateLayout");
const newTableData = [...this.data.TableInput]; const newTableData = [...this.data.TableInput];
newTableData[0].userName = ""; newTableData[0].userName = "";
// Change table data from empty to some
cy.testJsontext("tabledata", JSON.stringify(newTableData)); cy.testJsontext("tabledata", JSON.stringify(newTableData));
cy.wait("@updateLayout"); cy.wait("@updateLayout");
const selectedRowsSelector = `.t--widget-tablewidget .tbody .tr.selected-row`; const selectedRowsSelector = `.t--widget-tablewidget .tbody .tr.selected-row`;
// Verify selected row resets on table data changes
cy.get(selectedRowsSelector).should(($p) => { cy.get(selectedRowsSelector).should(($p) => {
// should found 0 rows // should found 0 rows
expect($p).to.have.length(0); expect($p).to.have.length(0);

View File

@ -12,22 +12,30 @@ describe("Table Widget property pane feature validation", function() {
it("Table widget with Add button test and validation", function() { it("Table widget with Add button test and validation", function() {
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
// Open column details of "id".
cy.editColumn("id"); cy.editColumn("id");
cy.get(widgetsPage.tableBtn).should("not.exist"); cy.get(widgetsPage.tableBtn).should("not.exist");
// Changing column data type to "Button"
cy.changeColumnType("Button"); cy.changeColumnType("Button");
// Changing the computed value (data) to "orderAmount"
cy.updateComputedValue(testdata.currentRowOrderAmt); cy.updateComputedValue(testdata.currentRowOrderAmt);
// Selecting button action to show message
cy.get(widgetsPage.actionSelect).click(); cy.get(widgetsPage.actionSelect).click();
cy.get(commonlocators.chooseAction) cy.get(commonlocators.chooseAction)
.children() .children()
.contains("Show Message") .contains("Show Message")
.click(); .click();
cy.addSuccessMessage("Successful ".concat(testdata.currentRowEmail)); cy.addSuccessMessage("Successful ".concat(testdata.currentRowEmail));
// Close Property pane
cy.get(commonlocators.editPropCrossButton).click({ force: true }); cy.get(commonlocators.editPropCrossButton).click({ force: true });
// Validating the button action by clicking
cy.get(widgetsPage.tableBtn) cy.get(widgetsPage.tableBtn)
.last() .last()
.click({ force: true }); .click({ force: true });
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000); cy.wait(3000);
// Validating the toast message
cy.get(widgetsPage.toastAction).should("be.visible"); cy.get(widgetsPage.toastAction).should("be.visible");
cy.get(widgetsPage.toastActionText) cy.get(widgetsPage.toastActionText)
.last() .last()

View File

@ -1,13 +1,8 @@
const testdata = require("../../../../fixtures/testdata.json");
const apiwidget = require("../../../../locators/apiWidgetslocator.json"); const apiwidget = require("../../../../locators/apiWidgetslocator.json");
const explorer = require("../../../../locators/explorerlocators.json");
const commonlocators = require("../../../../locators/commonlocators.json"); const commonlocators = require("../../../../locators/commonlocators.json");
const formWidgetsPage = require("../../../../locators/FormWidgets.json");
const publish = require("../../../../locators/publishWidgetspage.json");
const widgetsPage = require("../../../../locators/Widgets.json"); const widgetsPage = require("../../../../locators/Widgets.json");
const dsl = require("../../../../fixtures/tableNewDsl.json"); const dsl = require("../../../../fixtures/tableNewDsl.json");
const pageid = "MyPage";
before(() => { before(() => {
cy.addDsl(dsl); cy.addDsl(dsl);
}); });

View File

@ -12,19 +12,26 @@ describe("Table Widget property pane feature validation", function() {
it("Test to add column", function() { it("Test to add column", function() {
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
// Adding new column
cy.addColumn("CustomColumn"); cy.addColumn("CustomColumn");
cy.tableColumnDataValidation("customColumn1"); //To be updated later cy.tableColumnDataValidation("customColumn1"); //To be updated later
// Hiding all other columns in the table from property pane
cy.hideColumn("email"); cy.hideColumn("email");
cy.hideColumn("userName"); cy.hideColumn("userName");
cy.hideColumn("productName"); cy.hideColumn("productName");
cy.hideColumn("orderAmount"); cy.hideColumn("orderAmount");
// Validating the newly added column
cy.get(".draggable-header:contains('CustomColumn')").should("be.visible"); cy.get(".draggable-header:contains('CustomColumn')").should("be.visible");
}); });
it("Edit column name and validate test for computed value", function() { it("Edit column name and validate test for computed value", function() {
// Open column detail by draggable id of the column
cy.editColumn("customColumn1"); cy.editColumn("customColumn1");
// Validating single cell value
cy.readTabledataPublish("1", "2").then(() => { cy.readTabledataPublish("1", "2").then(() => {
// Chaging the computed value to "Emails"
cy.updateComputedValue(testdata.currentRowWithIdOutside); cy.updateComputedValue(testdata.currentRowWithIdOutside);
// Validating single cell value
cy.readTabledataPublish("1", "1").then((tabData) => { cy.readTabledataPublish("1", "1").then((tabData) => {
expect(tabData).to.be.equal("#lindsay.ferguson@reqres.in"); expect(tabData).to.be.equal("#lindsay.ferguson@reqres.in");
cy.log("computed value of plain text " + tabData); cy.log("computed value of plain text " + tabData);

View File

@ -36,11 +36,9 @@ describe("Table Widget Functionality", function() {
// .find("> .bp3-button-text") // .find("> .bp3-button-text")
// .should("have.text", "{{navigateTo()}}"); // .should("have.text", "{{navigateTo()}}");
cy.get(commonlocators.editPropCrossButton).click({ force: true }); cy.get(commonlocators.editPropCrossButton).click({ force: true });
cy.PublishtheApp();
}); });
it("Table Widget Functionality To Verify The Data", function() { it("Table Widget Functionality To Verify The Data", function() {
cy.isSelectRow(1);
cy.readTabledataPublish("1", "3").then((tabData) => { cy.readTabledataPublish("1", "3").then((tabData) => {
const tabValue = tabData; const tabValue = tabData;
expect(tabValue).to.be.equal("Lindsay Ferguson"); expect(tabValue).to.be.equal("Lindsay Ferguson");
@ -49,7 +47,6 @@ describe("Table Widget Functionality", function() {
}); });
it("Table Widget Functionality To Show a Base64 Image", function() { it("Table Widget Functionality To Show a Base64 Image", function() {
cy.get(publish.backToEditor).click();
cy.openPropertyPane("tablewidget"); cy.openPropertyPane("tablewidget");
cy.editColumn("image"); cy.editColumn("image");
cy.changeColumnType("Image"); cy.changeColumnType("Image");
@ -57,8 +54,8 @@ describe("Table Widget Functionality", function() {
const index = 1; const index = 1;
const imageVal = this.data.TableInput[index].image; const imageVal = this.data.TableInput[index].image;
cy.readTableLinkPublish(index, "1").then((bgUrl) => { cy.readTableLinkPublish(index, "1").then((hrefVal) => {
expect(bgUrl).to.be.equal(`url("${imageVal}")`); expect(hrefVal).to.contain(imageVal);
}); });
}); });
@ -118,19 +115,18 @@ describe("Table Widget Functionality", function() {
.contains("is exactly") .contains("is exactly")
.click(); .click();
cy.get(publish.inputValue).type(tabValue); cy.get(publish.inputValue).type(tabValue);
cy.wait(500);
cy.get(publish.applyFiltersBtn).click();
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
cy.get(publish.canvas) cy.get(widgetsPage.filterApplyBtn).click({ force: true });
.first() cy.wait(500);
.click(); // cy.get(widgetsPage.filterCloseBtn).click({force:true});
cy.readTabledataPublish("0", "3").then((tabData) => { cy.readTabledataPublish("0", "3").then((tabData) => {
const tabValue = tabData; const tabValue = tabData;
expect(tabValue).to.be.equal("Lindsay Ferguson"); expect(tabValue).to.be.equal("Lindsay Ferguson");
}); });
cy.get(widgetsPage.filterCloseBtn).click({ force: true });
cy.get(publish.filterBtn).click();
cy.get(publish.removeFilter).click(); cy.get(publish.removeFilter).click();
cy.get("body").type("{esc}");
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
cy.readTabledataPublish("0", "3").then((tabData) => { cy.readTabledataPublish("0", "3").then((tabData) => {
@ -139,7 +135,8 @@ describe("Table Widget Functionality", function() {
}); });
cy.get(publish.canvas) cy.get(publish.canvas)
.first() .first()
.click(); .click({ force: true });
cy.wait(500);
}); });
}); });
@ -159,19 +156,17 @@ describe("Table Widget Functionality", function() {
.contains("contains") .contains("contains")
.click(); .click();
cy.get(publish.inputValue).type("Lindsay"); cy.get(publish.inputValue).type("Lindsay");
cy.wait(500);
cy.get(publish.applyFiltersBtn).click();
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
cy.get(publish.canvas) cy.get(widgetsPage.filterApplyBtn).click({ force: true });
.first() cy.wait(500);
.click();
cy.readTabledataPublish("0", "3").then((tabData) => { cy.readTabledataPublish("0", "3").then((tabData) => {
const tabValue = tabData; const tabValue = tabData;
expect(tabValue).to.be.equal("Lindsay Ferguson"); expect(tabValue).to.be.equal("Lindsay Ferguson");
}); });
cy.get(widgetsPage.filterCloseBtn).click({ force: true });
cy.get(publish.filterBtn).click();
cy.get(publish.removeFilter).click(); cy.get(publish.removeFilter).click();
cy.get("body").type("{esc}");
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
cy.readTabledataPublish("0", "3").then((tabData) => { cy.readTabledataPublish("0", "3").then((tabData) => {
@ -180,7 +175,7 @@ describe("Table Widget Functionality", function() {
}); });
cy.get(publish.canvas) cy.get(publish.canvas)
.first() .first()
.click(); .click({ force: true });
}); });
}); });
@ -200,19 +195,17 @@ describe("Table Widget Functionality", function() {
.contains("starts with") .contains("starts with")
.click(); .click();
cy.get(publish.inputValue).type("Lindsay"); cy.get(publish.inputValue).type("Lindsay");
cy.wait(500);
cy.get(publish.applyFiltersBtn).click();
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
cy.get(publish.canvas) cy.get(widgetsPage.filterApplyBtn).click({ force: true });
.first() cy.wait(500);
.click();
cy.readTabledataPublish("0", "3").then((tabData) => { cy.readTabledataPublish("0", "3").then((tabData) => {
const tabValue = tabData; const tabValue = tabData;
expect(tabValue).to.be.equal("Lindsay Ferguson"); expect(tabValue).to.be.equal("Lindsay Ferguson");
}); });
cy.get(widgetsPage.filterCloseBtn).click({ force: true });
cy.get(publish.filterBtn).click();
cy.get(publish.removeFilter).click(); cy.get(publish.removeFilter).click();
cy.get("body").type("{esc}");
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
cy.readTabledataPublish("0", "3").then((tabData) => { cy.readTabledataPublish("0", "3").then((tabData) => {
@ -221,7 +214,7 @@ describe("Table Widget Functionality", function() {
}); });
cy.get(publish.canvas) cy.get(publish.canvas)
.first() .first()
.click(); .click({ force: true });
}); });
}); });
@ -241,19 +234,17 @@ describe("Table Widget Functionality", function() {
.contains("ends with") .contains("ends with")
.click(); .click();
cy.get(publish.inputValue).type("Ferguson"); cy.get(publish.inputValue).type("Ferguson");
cy.wait(500);
cy.get(publish.applyFiltersBtn).click();
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
cy.get(publish.canvas) cy.get(widgetsPage.filterApplyBtn).click({ force: true });
.first() cy.wait(500);
.click();
cy.readTabledataPublish("0", "3").then((tabData) => { cy.readTabledataPublish("0", "3").then((tabData) => {
const tabValue = tabData; const tabValue = tabData;
expect(tabValue).to.be.equal("Lindsay Ferguson"); expect(tabValue).to.be.equal("Lindsay Ferguson");
}); });
cy.get(widgetsPage.filterCloseBtn).click({ force: true });
cy.get(publish.filterBtn).click();
cy.get(publish.removeFilter).click(); cy.get(publish.removeFilter).click();
cy.get("body").type("{esc}");
// eslint-disable-next-line cypress/no-unnecessary-waiting // eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500); cy.wait(500);
cy.readTabledataPublish("0", "3").then((tabData) => { cy.readTabledataPublish("0", "3").then((tabData) => {
@ -262,7 +253,7 @@ describe("Table Widget Functionality", function() {
}); });
cy.get(publish.canvas) cy.get(publish.canvas)
.first() .first()
.click(); .click({ force: true });
}); });
}); });

View File

@ -150,7 +150,6 @@ describe("Button Widget Functionality", function() {
}); });
it("Button-Copy Verification", function() { it("Button-Copy Verification", function() {
const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl";
//Copy button and verify all properties //Copy button and verify all properties
cy.copyWidget("buttonwidget", widgetsPage.buttonWidget); cy.copyWidget("buttonwidget", widgetsPage.buttonWidget);

View File

@ -110,5 +110,21 @@
"switchWidgetInactive": ".t--switch-widget-inactive", "switchWidgetInactive": ".t--switch-widget-inactive",
"switchWidgetLoading": ".t--switch-widget-loading", "switchWidgetLoading": ".t--switch-widget-loading",
"chartPlotGroup": "g.raphael-group-63-plot-group", "chartPlotGroup": "g.raphael-group-63-plot-group",
"toggleEnableMultirowselection": ".t--property-control-enablemultirowselection .bp3-control-indicator" "toggleEnableMultirowselection": ".t--property-control-enablemultirowselection .bp3-control-indicator",
"searchField": "[type=search]",
"defaultSelectedRowField":".t--property-control-defaultselectedrow .CodeMirror-line",
"selectedRow":".selected-row",
"removeTableWidget": ".t--delete-widget",
"nextPageButton": ".t--table-widget-next-page",
"addWidget": ".t--entity.group.widgets > div:nth-child(1) >div:nth-child(5)",
"closeWidgetBar": ".t--close-widgets-sidebar",
"tabedataField": ".t--property-control-tabledata",
"exploreWidget": "[class$=bp3-panel-stack-view] > div:nth-child(1) > div:nth-child(1) > span:nth-child(4)",
"widgetRelatedDocument": "div.main > div:nth-child(1) > div:nth-child(1)",
"rowHeight":".t--table-compact-mode-toggle-btn",
"rowHeightShortOpt":".bp3-popover-content > div > div:nth-child(1)",
"tbIndex0": "[class=td][data-colindex='0'][data-rowindex='0']",
"filterApplyBtn":".t--apply-filter-btn",
"filterCloseBtn":".t--close-filter-btn",
"header":"#header-root"
} }

View File

@ -1471,6 +1471,13 @@ Cypress.Commands.add("showColumn", (colId) => {
.should("be.visible"); .should("be.visible");
}); });
Cypress.Commands.add("makeColumnVisible", (colId) => {
cy.get("[data-rbd-draggable-id='" + colId + "'] .t--show-column-btn").click({
force: true,
});
cy.wait(1000);
});
Cypress.Commands.add("addColumn", (colId) => { Cypress.Commands.add("addColumn", (colId) => {
cy.get(widgetsPage.addColumn).scrollIntoView(); cy.get(widgetsPage.addColumn).scrollIntoView();
cy.get(widgetsPage.addColumn) cy.get(widgetsPage.addColumn)
@ -1528,7 +1535,18 @@ Cypress.Commands.add("addAction", (value) => {
cy.enterActionValue(value); cy.enterActionValue(value);
}); });
Cypress.Commands.add("selectShowMsg", (value) => { Cypress.Commands.add("onTableAction", (value, value1, value2) => {
cy.get(commonlocators.dropdownSelectButton)
.eq(value)
.click();
cy.get(commonlocators.chooseAction)
.children()
.contains("Show Message")
.click();
cy.testJsontext(value1, value2);
});
Cypress.Commands.add("selectShowMsg", () => {
cy.get(commonlocators.chooseAction) cy.get(commonlocators.chooseAction)
.children() .children()
.contains("Show Message") .contains("Show Message")

0
list Normal file
View File