Skip to content

Commit c90d844

Browse files
test: Form widget UI test (#6884)
* Form widget test cases * Form widget Test Cases - Form widget fixes * Form widget Test Cases Defult Form text, Reset and Close button Validation Add Multiple widgets in Form Form_Widget Minimize and maximize General Validation Rename Form widget from Entity Explorer Toggle JS - Form-Unckeck Visible field Validationpassed
Toggle JS - Form-Check Visible field Validationpassed
Copy Paste Validation Form Delete Validation * Form_test_cases_Fix * Form test cases fix
1 parent 2f45db2 commit c90d844

File tree

4 files changed

+102
-3
lines changed

4 files changed

+102
-3
lines changed

app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/FormWidget_spec.js

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,49 @@ const publish = require("../../../../locators/publishWidgetspage.json");
44
const dsl = require("../../../../fixtures/formdsl.json");
55
const pages = require("../../../../locators/Pages.json");
66
const widgetsPage = require("../../../../locators/Widgets.json");
7+
const explorer = require("../../../../locators/explorerlocators.json");
78

89
describe("Form Widget Functionality", function() {
910
before(() => {
1011
cy.addDsl(dsl);
1112
});
13+
it("Defult Form text, Reset and Close button Validation", function() {
14+
cy.get(widgetsPage.textWidget).should("be.visible");
15+
cy.get(widgetsPage.formButtonWidget)
16+
.contains("Submit")
17+
.scrollIntoView()
18+
.should("be.visible");
19+
cy.get(widgetsPage.formButtonWidget)
20+
.contains("Reset")
21+
.scrollIntoView()
22+
.should("be.visible");
23+
});
24+
it("Add Multiple widgets in Form", function() {
25+
cy.get(explorer.addWidget).click();
26+
cy.get(commonlocators.entityExplorersearch).should("be.visible");
27+
cy.dragAndDropToWidget("multiselectwidget", "formwidget", {
28+
x: 100,
29+
y: 100,
30+
});
31+
cy.dragAndDropToWidget("inputwidget", "formwidget", { x: 50, y: 200 });
32+
cy.get(formWidgetsPage.multiselectWidget).should("be.visible");
33+
cy.get(widgetsPage.inputWidget).should("be.visible");
34+
cy.PublishtheApp();
35+
});
36+
it("Form_Widget Minimize and maximize General Validation", function() {
37+
cy.openPropertyPane("formwidget");
38+
cy.get(commonlocators.generalChevran).click({ force: true });
39+
cy.get(commonlocators.generalSection).should("not.be.visible");
40+
cy.get(commonlocators.generalChevran).click({ force: true });
41+
cy.get(commonlocators.generalSection).should("be.visible");
42+
cy.PublishtheApp();
43+
});
44+
it("Rename Form widget from Entity Explorer", function() {
45+
cy.GlobalSearchEntity("Form1");
46+
cy.RenameEntity("Form");
47+
cy.wait(1000);
48+
cy.get(".t--entity").should("contain", "Form");
49+
});
1250
it("Form Widget Functionality", function() {
1351
cy.openPropertyPane("formwidget");
1452
/**
@@ -39,15 +77,14 @@ describe("Form Widget Functionality", function() {
3977
.scrollTo("bottom")
4078
.should("be.visible");
4179
cy.get(commonlocators.editPropCrossButton).click({ force: true });
42-
cy.PublishtheApp();
4380
});
4481
it("Form Widget Functionality To Verify The Colour", function() {
82+
cy.PublishtheApp();
4583
cy.get(formWidgetsPage.formD)
4684
.should("have.css", "background-color")
4785
.and("eq", "rgb(3, 179, 101)");
4886
});
4987
it("Form Widget Functionality To Unchecked Visible Widget", function() {
50-
cy.get(publish.backToEditor).click();
5188
cy.openPropertyPane("formwidget");
5289
cy.togglebarDisable(commonlocators.visibleCheckbox);
5390
cy.PublishtheApp();
@@ -61,7 +98,51 @@ describe("Form Widget Functionality", function() {
6198
cy.get(publish.formWidget).should("be.visible");
6299
cy.get(publish.backToEditor).click();
63100
});
101+
it("Toggle JS - Form-Unckeck Visible field Validation", function() {
102+
cy.openPropertyPane("formwidget");
103+
//Uncheck the disabled checkbox using JS and validate
104+
cy.get(widgetsPage.toggleVisible).click({ force: true });
105+
cy.testJsontext("visible", "false");
106+
cy.PublishtheApp();
107+
cy.get(publish.formWidget).should("not.exist");
108+
});
109+
110+
it("Toggle JS - Form-Check Visible field Validation", function() {
111+
cy.openPropertyPane("formwidget");
112+
//Check the disabled checkbox using JS and Validate
113+
cy.testJsontext("visible", "true");
114+
cy.PublishtheApp();
115+
cy.get(publish.formWidget).should("be.visible");
116+
});
117+
it("Explore Widget related documents Verification", function() {
118+
// Open property pane
119+
cy.openPropertyPane("formwidget");
120+
// Click on "Explore widget related docs" button
121+
cy.get(widgetsPage.exploreWidget).click();
122+
// Verify the widget related document
123+
cy.get(widgetsPage.widgetRelatedDocument).should("contain", "Form");
124+
cy.wait(500);
125+
cy.get(widgetsPage.header).click();
126+
cy.PublishtheApp();
127+
});
128+
it("Form-Copy Verification", function() {
129+
cy.openPropertyPane("formwidget");
130+
const modifierKey = Cypress.platform === "darwin" ? "meta" : "ctrl";
131+
//Copy Form and verify all properties
132+
cy.copyWidget("formwidget", widgetsPage.formWidget);
133+
134+
cy.PublishtheApp();
135+
});
136+
137+
it("Form-Delete Verification", function() {
138+
cy.openPropertyPane("formwidget");
139+
// Delete the Form widget
140+
cy.deleteWidget(widgetsPage.formWidget);
141+
cy.PublishtheApp();
142+
cy.get(widgetsPage.formWidget).should("not.exist");
143+
});
64144
});
65145
afterEach(() => {
66146
// put your clean up code if any
147+
cy.goToEditFromPublish();
67148
});

app/client/cypress/locators/Widgets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"switchWidgetLoading": ".t--switch-widget-loading",
112112
"chartPlotGroup": "g.raphael-group-63-plot-group",
113113
"toggleEnableMultirowselection": ".t--property-control-enablemultirowselection .bp3-control-indicator",
114+
"formWidget": ".t--draggable-formwidget",
114115
"searchField": "[type=search]",
115116
"defaultSelectedRowField":".t--property-control-defaultselectedrow .CodeMirror-line",
116117
"selectedRow":".selected-row",

app/client/cypress/locators/commonlocators.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,7 @@
118118
"inputCurrencyChangeType": ".t--input-currency-change",
119119
"inputCountryCodeChangeType": ".t--input-country-code-change",
120120
"viewerPage": ".t--app-viewer-page",
121-
"dropDownOptSelected": "//span[@type='p1']"
121+
"dropDownOptSelected": "//span[@type='p1']",
122+
"generalChevran":".t--property-pane-section-collapse-general [icon=chevron-right]",
123+
"generalSection":".t--property-pane-section-general"
122124
}

app/client/cypress/support/commands.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,21 @@ Cypress.Commands.add("dragAndDropToCanvas", (widgetType, { x, y }) => {
22062206
.trigger("mouseup", x, y, { eventConstructor: "MouseEvent" });
22072207
});
22082208

2209+
Cypress.Commands.add(
2210+
"dragAndDropToWidget",
2211+
(widgetType, destinationWidget, { x, y }) => {
2212+
const selector = `.t--widget-card-draggable-${widgetType}`;
2213+
cy.get(selector)
2214+
.trigger("dragstart", { force: true })
2215+
.trigger("mousemove", x, y, { force: true });
2216+
const selector2 = `.t--draggable-${destinationWidget}`;
2217+
cy.get(selector2)
2218+
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" })
2219+
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" })
2220+
.trigger("mouseup", x, y, { eventConstructor: "MouseEvent" });
2221+
},
2222+
);
2223+
22092224
Cypress.Commands.add("executeDbQuery", (queryName) => {
22102225
cy.get(widgetsPage.buttonOnClick)
22112226
.get(commonlocators.dropdownSelectButton)

0 commit comments

Comments
 (0)