2022-09-23 12:33:05 +00:00
|
|
|
import { commonWidgetSelector } from "Selectors/common";
|
|
|
|
|
import { openAccordion, openEditorSidebar } from "Support/utils/commonWidget";
|
|
|
|
|
import { buttonText } from "Texts/button";
|
|
|
|
|
import { commonWidgetText } from "Texts/common";
|
|
|
|
|
import { faker } from "@faker-js/faker";
|
|
|
|
|
|
2022-10-04 07:36:59 +00:00
|
|
|
export const verifyControlComponentAction = (widgetName, value) => {
|
2022-09-23 12:33:05 +00:00
|
|
|
cy.forceClickOnCanvas();
|
|
|
|
|
cy.dragAndDropWidget("button", 340, 90);
|
|
|
|
|
|
|
|
|
|
openEditorSidebar(widgetName);
|
2022-10-04 07:36:59 +00:00
|
|
|
openAccordion(commonWidgetText.accordionEvents, ["Validation", "Layout"]);
|
2022-09-23 12:33:05 +00:00
|
|
|
|
|
|
|
|
cy.get(commonWidgetSelector.addMoreEventHandlerLink).click();
|
2022-10-04 07:36:59 +00:00
|
|
|
cy.get(commonWidgetSelector.eventHandlerCard).eq(1).click();
|
|
|
|
|
|
2022-09-23 12:33:05 +00:00
|
|
|
cy.get(commonWidgetSelector.actionSelection).type("Control component{Enter}");
|
|
|
|
|
cy.get(commonWidgetSelector.eventComponentSelection).type("button1{Enter}");
|
2022-10-04 07:36:59 +00:00
|
|
|
cy.get(commonWidgetSelector.eventComponentActionSelection).type(
|
|
|
|
|
"Set text{Enter}"
|
|
|
|
|
);
|
2022-09-23 12:33:05 +00:00
|
|
|
cy.get(commonWidgetSelector.componentTextInput)
|
2022-10-04 07:36:59 +00:00
|
|
|
.find('[data-cy*="-input-field"]')
|
|
|
|
|
.clearAndTypeOnCodeMirror(["{{", `components.${widgetName}.value}}`]);
|
2022-09-23 12:33:05 +00:00
|
|
|
|
|
|
|
|
cy.clearAndType(commonWidgetSelector.draggableWidget(widgetName), value);
|
2022-10-04 07:36:59 +00:00
|
|
|
cy.get(
|
|
|
|
|
commonWidgetSelector.draggableWidget(buttonText.defaultWidgetName)
|
|
|
|
|
).should("have.text", value);
|
|
|
|
|
};
|
2022-09-23 12:33:05 +00:00
|
|
|
|
|
|
|
|
export const randomString = (length) => {
|
2022-10-04 07:36:59 +00:00
|
|
|
let str = faker.lorem.words();
|
|
|
|
|
return str.replace(/\s/g, "").substr(0, length);
|
|
|
|
|
};
|