Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,49 @@ const publish = require("../../../../locators/publishWidgetspage.json");
const dsl = require("../../../../fixtures/formdsl.json");
const pages = require("../../../../locators/Pages.json");
const widgetsPage = require("../../../../locators/Widgets.json");
const explorer = require("../../../../locators/explorerlocators.json");

describe("Form Widget Functionality", function() {
before(() => {
cy.addDsl(dsl);
});
it("Defult Form text, Reset and Close button Validation", function() {
cy.get(widgetsPage.textWidget).should("be.visible");
cy.get(widgetsPage.formButtonWidget)
.contains("Submit")
.scrollIntoView()
.should("be.visible");
cy.get(widgetsPage.formButtonWidget)
.contains("Reset")
.scrollIntoView()
.should("be.visible");
});
it("Add Multiple widgets in Form", function() {
cy.get(explorer.addWidget).click();
cy.get(commonlocators.entityExplorersearch).should("be.visible");
cy.dragAndDropToWidget("multiselectwidget", "formwidget", {
x: 100,
y: 100,
});
cy.dragAndDropToWidget("inputwidget", "formwidget", { x: 50, y: 200 });
cy.get(formWidgetsPage.multiselectWidget).should("be.visible");
cy.get(widgetsPage.inputWidget).should("be.visible");
cy.PublishtheApp();
});
it("Form_Widget Minimize and maximize General Validation", function() {
cy.openPropertyPane("formwidget");
cy.get(commonlocators.generalChevran).click({ force: true });
cy.get(commonlocators.generalSection).should("not.be.visible");
cy.get(commonlocators.generalChevran).click({ force: true });
cy.get(commonlocators.generalSection).should("be.visible");
cy.PublishtheApp();
});
it("Rename Form widget from Entity Explorer", function() {
cy.GlobalSearchEntity("Form1");
cy.RenameEntity("Form");
cy.wait(1000);
cy.get(".t--entity").should("contain", "Form");
});
it("Form Widget Functionality", function() {
cy.openPropertyPane("formwidget");
/**
Expand Down Expand Up @@ -39,15 +77,14 @@ describe("Form Widget Functionality", function() {
.scrollTo("bottom")
.should("be.visible");
cy.get(commonlocators.editPropCrossButton).click({ force: true });
cy.PublishtheApp();
});
it("Form Widget Functionality To Verify The Colour", function() {
cy.PublishtheApp();
cy.get(formWidgetsPage.formD)
.should("have.css", "background-color")
.and("eq", "rgb(3, 179, 101)");
});
it("Form Widget Functionality To Unchecked Visible Widget", function() {
cy.get(publish.backToEditor).click();
cy.openPropertyPane("formwidget");
cy.togglebarDisable(commonlocators.visibleCheckbox);
cy.PublishtheApp();
Expand All @@ -61,7 +98,51 @@ describe("Form Widget Functionality", function() {
cy.get(publish.formWidget).should("be.visible");
cy.get(publish.backToEditor).click();
});
it("Toggle JS - Form-Unckeck Visible field Validation", function() {
cy.openPropertyPane("formwidget");
//Uncheck the disabled checkbox using JS and validate
cy.get(widgetsPage.toggleVisible).click({ force: true });
cy.testJsontext("visible", "false");
cy.PublishtheApp();
cy.get(publish.formWidget).should("not.exist");
});

it("Toggle JS - Form-Check Visible field Validation", function() {
cy.openPropertyPane("formwidget");
//Check the disabled checkbox using JS and Validate
cy.testJsontext("visible", "true");
cy.PublishtheApp();
cy.get(publish.formWidget).should("be.visible");
});
it("Explore Widget related documents Verification", function() {
// Open property pane
cy.openPropertyPane("formwidget");
// Click on "Explore widget related docs" button
cy.get(widgetsPage.exploreWidget).click();
// Verify the widget related document
cy.get(widgetsPage.widgetRelatedDocument).should("contain", "Form");
cy.wait(500);
cy.get(widgetsPage.header).click();
cy.PublishtheApp();
});
it("Form-Copy Verification", function() {
cy.openPropertyPane("formwidget");
const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl";
//Copy Form and verify all properties
cy.copyWidget("formwidget", widgetsPage.formWidget);

cy.PublishtheApp();
});

it("Form-Delete Verification", function() {
cy.openPropertyPane("formwidget");
// Delete the Form widget
cy.deleteWidget(widgetsPage.formWidget);
cy.PublishtheApp();
cy.get(widgetsPage.formWidget).should("not.exist");
});
});
afterEach(() => {
// put your clean up code if any
cy.goToEditFromPublish();
});
1 change: 1 addition & 0 deletions app/client/cypress/locators/Widgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"switchWidgetLoading": ".t--switch-widget-loading",
"chartPlotGroup": "g.raphael-group-63-plot-group",
"toggleEnableMultirowselection": ".t--property-control-enablemultirowselection .bp3-control-indicator",
"formWidget": ".t--draggable-formwidget",
"searchField": "[type=search]",
"defaultSelectedRowField":".t--property-control-defaultselectedrow .CodeMirror-line",
"selectedRow":".selected-row",
Expand Down
4 changes: 3 additions & 1 deletion app/client/cypress/locators/commonlocators.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,7 @@
"allowCurrencyChange": ".t--property-control-allowcurrencychange input[type='checkbox']",
"inputCurrencyChangeType": ".t--input-currency-change",
"viewerPage": ".t--app-viewer-page",
"dropDownOptSelected": "//span[@type='p1']"
"dropDownOptSelected": "//span[@type='p1']",
"generalChevran":".t--property-pane-section-collapse-general [icon=chevron-right]",
"generalSection":".t--property-pane-section-general"
}
15 changes: 15 additions & 0 deletions app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,21 @@ Cypress.Commands.add("dragAndDropToCanvas", (widgetType, { x, y }) => {
.trigger("mouseup", x, y, { eventConstructor: "MouseEvent" });
});

Cypress.Commands.add(
"dragAndDropToWidget",
(widgetType, destinationWidget, { x, y }) => {
const selector = `.t--widget-card-draggable-${widgetType}`;
cy.get(selector)
.trigger("dragstart", { force: true })
.trigger("mousemove", x, y, { force: true });
const selector2 = `.t--draggable-${destinationWidget}`;
cy.get(selector2)
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" })
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" })
.trigger("mouseup", x, y, { eventConstructor: "MouseEvent" });
},
);

Cypress.Commands.add("executeDbQuery", (queryName) => {
cy.get(widgetsPage.buttonOnClick)
.get(commonlocators.dropdownSelectButton)
Expand Down