forked from tsai/budibase
9 changed files with 150 additions and 102 deletions
@ -1,8 +1,8 @@ |
|||||
{ |
{ |
||||
"baseUrl": "http://localhost:4005/_builder/", |
"baseUrl": "http://localhost:4001/_builder/", |
||||
"video": true, |
"video": true, |
||||
"projectId": "bmbemn", |
"projectId": "bmbemn", |
||||
"env": { |
"env": { |
||||
"PORT": "4005" |
"PORT": "4001" |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,18 +1,12 @@ |
|||||
context('Create an Application', () => { |
context("Create an Application", () => { |
||||
|
beforeEach(() => { |
||||
beforeEach(() => { |
cy.server() |
||||
cy.server() |
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) |
||||
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) |
}) |
||||
}) |
|
||||
|
it("should create a new application", () => { |
||||
// https://on.cypress.io/interacting-with-elements
|
cy.createApp("My Cool App", "This is a description") |
||||
|
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) |
||||
it('should create a new application', () => { |
cy.contains("My Cool App").should("exist") |
||||
// https://on.cypress.io/type
|
}) |
||||
cy.createApp('My Cool App', 'This is a description') |
|
||||
|
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) |
|
||||
|
|
||||
cy.contains('My Cool App').should('exist') |
|
||||
}) |
|
||||
}) |
}) |
||||
|
|||||
@ -1,18 +1,37 @@ |
|||||
xcontext('Create a Binding', () => { |
context("Create Bindings", () => { |
||||
before(() => { |
before(() => { |
||||
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) |
cy.createApp("Cypress Tests", "Cypress test app") |
||||
cy.createApp('Binding App', 'Binding App Description') |
cy.navigateToFrontend() |
||||
cy.navigateToFrontend() |
}) |
||||
|
|
||||
|
it("should add a current user binding", () => { |
||||
|
cy.addComponent("Elements", "Paragraph").then(componentId => { |
||||
|
addSettingBinding("text", "Current User._id") |
||||
|
cy.getComponent(componentId).should( |
||||
|
"have.text", |
||||
|
`ro_ta_users_us_test@test.com` |
||||
|
) |
||||
}) |
}) |
||||
|
}) |
||||
|
|
||||
it('add an input binding', () => { |
it("should add a URL param binding", () => { |
||||
cy.get(".nav-items-container").contains('Home').click() |
const paramName = "foo" |
||||
cy.contains("Add").click() |
cy.createScreen("Test Param", `/test/:${paramName}`) |
||||
cy.get("[data-cy=Input]").click() |
cy.addComponent("Elements", "Paragraph").then(componentId => { |
||||
cy.get("[data-cy=Textfield]").click() |
addSettingBinding("text", `URL.${paramName}`) |
||||
cy.contains("Heading").click() |
// The builder preview pages don't have a real URL, so all we can do
|
||||
cy.get("[data-cy=text-binding-button]").click() |
// is check that we were able to bind to the property, and that the
|
||||
cy.get("[data-cy=binding-dropdown-modal]").contains('Input 1').click() |
// component exists on the page
|
||||
cy.get("[data-cy=binding-dropdown-modal] textarea").should('have.value', 'Home{{ Input 1 }}') |
cy.getComponent(componentId).should("have.text", "") |
||||
}) |
}) |
||||
|
}) |
||||
}) |
}) |
||||
|
|
||||
|
const addSettingBinding = (setting, bindingText) => { |
||||
|
cy.get(`[data-cy="setting-${setting}"] [data-cy=text-binding-button]`).click() |
||||
|
cy.get(".drawer").within(() => { |
||||
|
cy.contains(bindingText).click() |
||||
|
cy.get("textarea").should("have.value", `{{ ${bindingText} }}`) |
||||
|
cy.get("button").click() |
||||
|
}) |
||||
|
} |
||||
|
|||||
Loading…
Reference in new issue