diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Button_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Button_spec.js index 2451cab9d3..83d7f4f526 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Button_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Button_spec.js @@ -8,6 +8,8 @@ const modalWidgetPage = require("../../../../locators/ModalWidget.json"); const datasource = require("../../../../locators/DatasourcesEditor.json"); const queryLocators = require("../../../../locators/QueryEditor.json"); +const iconAlignmentProperty = ".t--property-control-iconalignment"; + describe("Button Widget Functionality", function() { before(() => { cy.addDsl(dsl); @@ -17,6 +19,52 @@ describe("Button Widget Functionality", function() { cy.openPropertyPane("buttonwidget"); }); + it("Icon alignment should not change when changing the icon", () => { + // Add an icon + cy.get(".t--property-control-icon .bp3-icon-caret-down").click({ + force: true, + }); + + cy.get(".bp3-icon-add") + .first() + .click({ + force: true, + }); + + // Assert if the icon exists + cy.get(`${widgetsPage.buttonWidget} .bp3-icon-add`).should("exist"); + // Change icon alignment to right + cy.get(`${iconAlignmentProperty} .t--button-tab-right`) + .last() + .click({ + force: true, + }); + cy.wait(200); + // Assert if the icon appears on the right hand side of the button text + cy.get(widgetsPage.buttonWidget) + .contains("Submit") + .children("span") + .should("have.length", 2); + cy.get(`${widgetsPage.buttonWidget} span.bp3-button-text`) + .next() + .should("have.class", "bp3-icon-add"); + // Change the existing icon + cy.get(".t--property-control-icon .bp3-icon-caret-down").click({ + force: true, + }); + cy.get(".bp3-icon-airplane") + .first() + .click({ + force: true, + }); + // Assert if the icon changes + // Assert if the icon still exists on the right side of the text + cy.get(`${widgetsPage.buttonWidget} .bp3-icon-airplane`) + .should("exist") + .prev() + .should("have.text", "Submit"); + }); + it("Button-Color Validation", function() { // Change button color cy.changeButtonColor("rgb(255, 0, 0)");