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, |
|||
"projectId": "bmbemn", |
|||
"env": { |
|||
"PORT": "4005" |
|||
"PORT": "4001" |
|||
} |
|||
} |
|||
|
|||
@ -1,18 +1,12 @@ |
|||
context('Create an Application', () => { |
|||
|
|||
beforeEach(() => { |
|||
cy.server() |
|||
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) |
|||
}) |
|||
|
|||
// https://on.cypress.io/interacting-with-elements
|
|||
|
|||
it('should create a new application', () => { |
|||
// 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') |
|||
}) |
|||
context("Create an Application", () => { |
|||
beforeEach(() => { |
|||
cy.server() |
|||
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) |
|||
}) |
|||
|
|||
it("should create a new application", () => { |
|||
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', () => { |
|||
before(() => { |
|||
cy.visit(`localhost:${Cypress.env("PORT")}/_builder`) |
|||
cy.createApp('Binding App', 'Binding App Description') |
|||
cy.navigateToFrontend() |
|||
context("Create Bindings", () => { |
|||
before(() => { |
|||
cy.createApp("Cypress Tests", "Cypress test app") |
|||
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', () => { |
|||
cy.get(".nav-items-container").contains('Home').click() |
|||
cy.contains("Add").click() |
|||
cy.get("[data-cy=Input]").click() |
|||
cy.get("[data-cy=Textfield]").click() |
|||
cy.contains("Heading").click() |
|||
cy.get("[data-cy=text-binding-button]").click() |
|||
cy.get("[data-cy=binding-dropdown-modal]").contains('Input 1').click() |
|||
cy.get("[data-cy=binding-dropdown-modal] textarea").should('have.value', 'Home{{ Input 1 }}') |
|||
it("should add a URL param binding", () => { |
|||
const paramName = "foo" |
|||
cy.createScreen("Test Param", `/test/:${paramName}`) |
|||
cy.addComponent("Elements", "Paragraph").then(componentId => { |
|||
addSettingBinding("text", `URL.${paramName}`) |
|||
// 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
|
|||
// component exists on the page
|
|||
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