Fix for component binding tests
This commit is contained in:
parent
5e63adb42b
commit
03e92211f2
|
@ -10,7 +10,7 @@ filterTests(['smoke', 'all'], () => {
|
||||||
|
|
||||||
it("should add a current user binding", () => {
|
it("should add a current user binding", () => {
|
||||||
cy.searchAndAddComponent("Paragraph").then(() => {
|
cy.searchAndAddComponent("Paragraph").then(() => {
|
||||||
addSettingBinding("text", "Current User._id")
|
addSettingBinding("text", ["Current User", "_id"], "Current User._id")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ filterTests(['smoke', 'all'], () => {
|
||||||
const paramName = "foo"
|
const paramName = "foo"
|
||||||
cy.createScreen(`/test/:${paramName}`)
|
cy.createScreen(`/test/:${paramName}`)
|
||||||
cy.searchAndAddComponent("Paragraph").then(componentId => {
|
cy.searchAndAddComponent("Paragraph").then(componentId => {
|
||||||
addSettingBinding("text", `URL.${paramName}`)
|
addSettingBinding("text", ["URL", paramName], `URL.${paramName}`)
|
||||||
// The builder preview pages don't have a real URL, so all we can do
|
// The builder preview pages don't have a real URL, so all we can do
|
||||||
// is check that we were able to bind to the property, and that the
|
// is check that we were able to bind to the property, and that the
|
||||||
// component exists on the page
|
// component exists on the page
|
||||||
|
@ -47,11 +47,13 @@ filterTests(['smoke', 'all'], () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const addSettingBinding = (setting, bindingText, clickOption = true) => {
|
const addSettingBinding = (setting, bindingCategories, bindingText, clickOption = true) => {
|
||||||
cy.get(`[data-cy="setting-${setting}"] [data-cy=text-binding-button]`).click()
|
cy.get(`[data-cy="setting-${setting}"] [data-cy=text-binding-button]`).click()
|
||||||
|
cy.get(".category-list li").contains(bindingCategories[0])
|
||||||
cy.get(".drawer").within(() => {
|
cy.get(".drawer").within(() => {
|
||||||
if (clickOption) {
|
if (clickOption) {
|
||||||
cy.contains(bindingText).click()
|
cy.get(".category-list li").contains(bindingCategories[0]).click()
|
||||||
|
cy.get("li.binding").contains(bindingCategories[1]).click()
|
||||||
cy.get("textarea").should("have.value", `{{ ${bindingText} }}`)
|
cy.get("textarea").should("have.value", `{{ ${bindingText} }}`)
|
||||||
} else {
|
} else {
|
||||||
cy.get("textarea").type(bindingText)
|
cy.get("textarea").type(bindingText)
|
||||||
|
|
Loading…
Reference in New Issue