fix: Added Test case for icon alignment

This commit is contained in:
Arsalan 2022-03-15 13:41:45 +05:30
parent 1f45c67edf
commit becd005c6a

View File

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