ToolJet/cypress-tests/cypress/support/utils/button.js
Ajith KV 21e7162665
Cypress test for button widget happy path (#3776)
* Add and modify data-cy attribute for elements

* Modify faker file for random rgba hex code

* Add methods specific for button widget

* Add and modify common selector and text file

* Add and modify common widget methods

* Modify button text file

* Modify button widget happy path file

* Remove button selector file

* Modify multiselect widget happy with new methods

* Modify verify box shadow css method

* Add and modify common selector file

* Modify button text file

* add and modify specific methods for button widget

* Add and modify custom commands

* Add and modify common widget methods

* Add app preview and modify button widget happy path

* Add and modify data-cy attribute for elements

* Modify multiselect widget happy with new methods

* Modify data-cy attributes

* Add review changes

* Add data-cy attribute

* Add review changes

Co-authored-by: arpitnath <[email protected]>
2022-09-05 14:06:45 +05:30

28 lines
1.1 KiB
JavaScript

import { commonWidgetSelector } from "Selectors/common";
import { openAccordion, openEditorSidebar } from "Support/utils/commonWidget";
import { commonWidgetText } from "Texts/common";
export const verifyControlComponentAction = (widgetName, value) => {
cy.forceClickOnCanvas();
cy.dragAndDropWidget("Text input", 280, 90);
openEditorSidebar(widgetName);
openAccordion(commonWidgetText.accordionEvents);
cy.get(commonWidgetSelector.addMoreEventHandlerLink).click();
cy.get(commonWidgetSelector.eventHandlerCard).eq(1).click();
cy.get(commonWidgetSelector.actionSelection).type("Control component{Enter}");
cy.get(commonWidgetSelector.eventComponentSelection).type(
"textinput1{Enter}"
);
cy.get(commonWidgetSelector.eventComponentActionSelection).type(
"Set text{Enter}"
);
cy.get(commonWidgetSelector.componentTextInput)
.find('[data-cy*="-input-field"]')
.clearAndTypeOnCodeMirror(value);
cy.get(commonWidgetSelector.draggableWidget(widgetName)).click();
cy.get(commonWidgetSelector.draggableWidget('textinput1')).should("have.value", value);
};