Adding interact locators for createComponent cypress test

This commit is contained in:
MihailHadzhiev2022 2022-05-30 15:45:04 +03:00
parent 4b69f5ec9c
commit 5bd19b9e42
2 changed files with 18 additions and 9 deletions

View File

@ -1,6 +1,7 @@
// TODO for now components are skipped, might not be good to keep doing this // TODO for now components are skipped, might not be good to keep doing this
import filterTests from "../support/filterTests" import filterTests from "../support/filterTests"
const interact = require('../support/interact')
filterTests(['all'], () => { filterTests(['all'], () => {
xcontext("Create Components", () => { xcontext("Create Components", () => {
@ -31,32 +32,32 @@ filterTests(['all'], () => {
it("should change the text of the headline", () => { it("should change the text of the headline", () => {
const text = "Lorem ipsum dolor sit amet." const text = "Lorem ipsum dolor sit amet."
cy.get("[data-cy=Settings]").click() cy.get(interact.DATA_CY_SETTINGS).click()
cy.get("[data-cy=setting-text] input") cy.get(interact.SETTINGS_INPUT)
.type(text) .type(text)
.blur() .blur()
cy.getComponent(headlineId).should("have.text", text) cy.getComponent(headlineId).should("have.text", text)
}) })
it("should change the size of the headline", () => { it("should change the size of the headline", () => {
cy.get("[data-cy=Design]").click() cy.get(interact.DATA_CY_DESIGN).click()
cy.contains("Typography").click() cy.contains("Typography").click()
cy.get("[data-cy=font-size-prop-control]").click() cy.get(interact.DATA_CY_FSPCONTROL).click()
cy.contains("60px").click() cy.contains("60px").click()
cy.getComponent(headlineId).should("have.css", "font-size", "60px") cy.getComponent(headlineId).should("have.css", "font-size", "60px")
}) })
it("should create a form and reset to match schema", () => { it("should create a form and reset to match schema", () => {
cy.addComponent("Form", "Form").then(() => { cy.addComponent("Form", "Form").then(() => {
cy.get("[data-cy=Settings]").click() cy.get(interact.DATA_CY_SETTINGS).click()
cy.get("[data-cy=setting-dataSource]") cy.get(interact.DATA_CY_DATASOURCE)
.contains("Choose option") .contains("Choose option")
.click() .click()
cy.get(".dropdown") cy.get(interact.DROPDOWN)
.contains("dog") .contains("dog")
.click() .click()
cy.addComponent("Form", "Field Group").then(fieldGroupId => { cy.addComponent("Form", "Field Group").then(fieldGroupId => {
cy.get("[data-cy=Settings]").click() cy.get(interact.DATA_CY_SETTINGS).click()
cy.contains("Update Form Fields").click() cy.contains("Update Form Fields").click()
cy.get(".modal") cy.get(".modal")
.get("button.primary") .get("button.primary")
@ -84,7 +85,7 @@ filterTests(['all'], () => {
cy.get(".ui-nav ul .nav-item.selected .ri-more-line").click({ cy.get(".ui-nav ul .nav-item.selected .ri-more-line").click({
force: true, force: true,
}) })
cy.get(".dropdown-container") cy.get(interact.DROPDOWN_CONTAINER)
.contains("Delete") .contains("Delete")
.click() .click()
cy.get(".modal") cy.get(".modal")

View File

@ -34,3 +34,11 @@ export const PUBLISH_POPOVER_ACTION = '[data-cy="publish-popover-action"]'
export const PUBLISH_POPOVER_MESSAGE = ".publish-popover-message" export const PUBLISH_POPOVER_MESSAGE = ".publish-popover-message"
export const SPECTRUM_BUTTON = ".spectrum-Button" export const SPECTRUM_BUTTON = ".spectrum-Button"
export const TOPRIGHTNAV_BUTTON_SPECTRUM = ".toprightnav button.spectrum-Button" export const TOPRIGHTNAV_BUTTON_SPECTRUM = ".toprightnav button.spectrum-Button"
//createComponents
export const DATA_CY_SETTINGS = "[data-cy=Settings]"
export const SETTINGS_INPUT = "[data-cy=setting-text] input"
export const DATA_CY_DESIGN = "[data-cy=Design]"
export const DATA_CY_FSPCONTROL = "[data-cy=font-size-prop-control]"
export const DATA_CY_DATASOURCE = "[data-cy=setting-dataSource]"
export const DROPDOWN_CONTAINER = ".dropdown-container"