2021-03-05 14:52:26 +01:00
|
|
|
context("Create Components", () => {
|
|
|
|
let headlineId
|
|
|
|
|
2020-10-27 16:26:07 +01:00
|
|
|
before(() => {
|
2021-04-15 19:29:11 +02:00
|
|
|
cy.login()
|
2021-03-05 15:36:38 +01:00
|
|
|
cy.createTestApp()
|
2021-03-05 14:52:26 +01:00
|
|
|
cy.createTable("dog")
|
2021-05-25 19:06:56 +02:00
|
|
|
cy.addColumn("dog", "name", "Text")
|
|
|
|
cy.addColumn("dog", "age", "Number")
|
|
|
|
cy.addColumn("dog", "type", "Options")
|
2021-03-05 14:52:26 +01:00
|
|
|
cy.navigateToFrontend()
|
2020-10-27 16:26:07 +01:00
|
|
|
})
|
2020-06-11 12:56:16 +02:00
|
|
|
|
2020-10-27 16:26:07 +01:00
|
|
|
it("should add a container", () => {
|
2021-03-05 14:52:26 +01:00
|
|
|
cy.addComponent(null, "Container").then(componentId => {
|
|
|
|
cy.getComponent(componentId).should("exist")
|
|
|
|
})
|
2020-10-27 16:26:07 +01:00
|
|
|
})
|
2021-03-05 14:52:26 +01:00
|
|
|
|
2020-10-27 16:26:07 +01:00
|
|
|
it("should add a headline", () => {
|
2021-03-05 14:52:26 +01:00
|
|
|
cy.addComponent("Elements", "Headline").then(componentId => {
|
|
|
|
headlineId = componentId
|
|
|
|
cy.getComponent(headlineId).should("exist")
|
|
|
|
})
|
|
|
|
})
|
2020-06-11 12:56:16 +02:00
|
|
|
|
2021-03-05 14:52:26 +01:00
|
|
|
it("should change the text of the headline", () => {
|
|
|
|
const text = "Lorem ipsum dolor sit amet."
|
|
|
|
cy.get("[data-cy=Settings]").click()
|
|
|
|
cy.get("[data-cy=setting-text] input")
|
|
|
|
.type(text)
|
|
|
|
.blur()
|
|
|
|
cy.getComponent(headlineId).should("have.text", text)
|
2020-10-27 16:26:07 +01:00
|
|
|
})
|
2021-03-05 14:52:26 +01:00
|
|
|
|
|
|
|
it("should change the size of the headline", () => {
|
|
|
|
cy.get("[data-cy=Design]").click()
|
2020-10-27 16:26:07 +01:00
|
|
|
cy.contains("Typography").click()
|
|
|
|
cy.get("[data-cy=font-size-prop-control]").click()
|
|
|
|
cy.contains("60px").click()
|
2021-03-05 14:52:26 +01:00
|
|
|
cy.getComponent(headlineId).should("have.css", "font-size", "60px")
|
|
|
|
})
|
2020-06-11 12:56:16 +02:00
|
|
|
|
2021-03-05 14:52:26 +01:00
|
|
|
it("should create a form and reset to match schema", () => {
|
|
|
|
cy.addComponent("Form", "Form").then(() => {
|
|
|
|
cy.get("[data-cy=Settings]").click()
|
2021-03-23 14:31:56 +01:00
|
|
|
cy.get("[data-cy=setting-dataSource]")
|
2021-03-05 14:52:26 +01:00
|
|
|
.contains("Choose option")
|
|
|
|
.click()
|
|
|
|
cy.get(".dropdown")
|
|
|
|
.contains("dog")
|
|
|
|
.click()
|
|
|
|
cy.addComponent("Form", "Field Group").then(fieldGroupId => {
|
|
|
|
cy.get("[data-cy=Settings]").click()
|
|
|
|
cy.contains("Update Form Fields").click()
|
|
|
|
cy.get(".modal")
|
|
|
|
.get("button.primary")
|
|
|
|
.click()
|
|
|
|
cy.getComponent(fieldGroupId).within(() => {
|
|
|
|
cy.contains("name").should("exist")
|
|
|
|
cy.contains("age").should("exist")
|
|
|
|
cy.contains("type").should("exist")
|
|
|
|
})
|
|
|
|
cy.getComponent(fieldGroupId)
|
|
|
|
.find("input")
|
|
|
|
.should("have.length", 2)
|
|
|
|
cy.getComponent(fieldGroupId)
|
|
|
|
.find(".spectrum-Picker")
|
|
|
|
.should("have.length", 1)
|
|
|
|
})
|
|
|
|
})
|
2020-10-27 16:26:07 +01:00
|
|
|
})
|
2021-03-08 12:57:56 +01:00
|
|
|
|
|
|
|
it("deletes a component", () => {
|
|
|
|
cy.addComponent("Elements", "Paragraph").then(componentId => {
|
|
|
|
cy.get("[data-cy=setting-_instanceName] input")
|
|
|
|
.type(componentId)
|
|
|
|
.blur()
|
|
|
|
cy.get(".ui-nav ul .nav-item.selected .ri-more-line").click({
|
|
|
|
force: true,
|
|
|
|
})
|
|
|
|
cy.get(".dropdown-container")
|
|
|
|
.contains("Delete")
|
|
|
|
.click()
|
|
|
|
cy.get(".modal")
|
|
|
|
.contains("Delete Component")
|
|
|
|
.click()
|
|
|
|
cy.getComponent(componentId).should("not.exist")
|
|
|
|
})
|
|
|
|
})
|
2020-06-11 12:56:16 +02:00
|
|
|
})
|