Updating binding tests.

This commit is contained in:
mike12345567 2021-05-25 16:52:35 +01:00
parent 1564724dc3
commit 1631aa698b
2 changed files with 9 additions and 9 deletions

View File

@ -36,7 +36,9 @@ context("Create Bindings", () => {
it("should add a binding with a handlebars helper", () => { it("should add a binding with a handlebars helper", () => {
cy.addComponent("Elements", "Paragraph").then(componentId => { cy.addComponent("Elements", "Paragraph").then(componentId => {
// Cypress needs to escape curly brackets // Cypress needs to escape curly brackets
addSettingBinding("text", "{{}{{} add 1 2 {}}{}}", false) cy.get("[data-cy=setting-text] input")
.type("{{}{{} add 1 2 {}}{}}")
.blur()
cy.getComponent(componentId).should("have.text", "3") cy.getComponent(componentId).should("have.text", "3")
}) })
}) })
@ -51,6 +53,6 @@ const addSettingBinding = (setting, bindingText, clickOption = true) => {
} else { } else {
cy.get("textarea").type(bindingText) cy.get("textarea").type(bindingText)
} }
cy.get("button").click() cy.contains("Save").click()
}) })
} }

View File

@ -150,17 +150,15 @@ Cypress.Commands.add("getComponent", componentId => {
}) })
Cypress.Commands.add("navigateToFrontend", () => { Cypress.Commands.add("navigateToFrontend", () => {
cy.contains("design").click() cy.contains("Design").click()
}) })
Cypress.Commands.add("createScreen", (screenName, route) => { Cypress.Commands.add("createScreen", (screenName, route) => {
cy.get("[data-cy=new-screen]").click() cy.get("[aria-label=AddCircle]").click()
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal").within(() => {
cy.get("input").eq(0).type(screenName).blur() cy.get("input").first().type(screenName)
if (route) { cy.get("input").eq(1).type(route)
cy.get("input").eq(1).type(route).blur() cy.get(".spectrum-Button--cta").click()
}
cy.contains("Create Screen").click()
}) })
cy.get(".nav-items-container").within(() => { cy.get(".nav-items-container").within(() => {
cy.contains(route).should("exist") cy.contains(route).should("exist")