diff --git a/packages/builder/cypress.json b/packages/builder/cypress.json index 0908f2c839..669ee5af34 100644 --- a/packages/builder/cypress.json +++ b/packages/builder/cypress.json @@ -1,9 +1,9 @@ { - "baseUrl": "http://localhost:10001/builder/", + "baseUrl": "http://localhost:10000/builder/", "video": true, "projectId": "bmbemn", "env": { - "PORT": "10001", + "PORT": "10000", "JWT_SECRET": "test" } } diff --git a/packages/builder/cypress/integration/createTable.spec.js b/packages/builder/cypress/integration/createTable.spec.js index eda72ba36d..a0d741910c 100644 --- a/packages/builder/cypress/integration/createTable.spec.js +++ b/packages/builder/cypress/integration/createTable.spec.js @@ -6,7 +6,7 @@ context("Create a Table", () => { it("should create a new Table", () => { cy.createTable("dog") - + cy.wait(1000) // Check if Table exists cy.get(".table-title h1").should("have.text", "dog") }) @@ -36,7 +36,7 @@ context("Create a Table", () => { it("edits a row", () => { cy.contains("button", "Edit").click({ force: true }) cy.wait(1000) - cy.get(".spectrum-Modal input").type("Updated") + cy.get(".spectrum-Modal input").type("RoverUpdated") cy.contains("Save").click() cy.contains("RoverUpdated").should("have.text", "RoverUpdated") }) @@ -62,7 +62,7 @@ context("Create a Table", () => { it("deletes a table", () => { cy.get(".actions > :nth-child(1) > .icon > .spectrum-Icon > use") - .first() + .eq(1) .click({ force: true }) cy.get(".spectrum-Menu > :nth-child(2)").click() cy.contains("Delete Table").click() diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index ea6ca81e66..d681fda8ad 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -35,8 +35,11 @@ Cypress.Commands.add("createApp", name => { .within(() => { cy.get("input").eq(0).type(name).should("have.value", name).blur() cy.get(".spectrum-ButtonGroup").contains("Create app").click() + cy.wait(7000) }) .then(() => { + // Because we show the datasource modal on entry, we need to create a table to get rid of the modal in the future + cy.createInitialDatasource("initialTable") cy.expandBudibaseConnection() cy.get(".nav-item.selected > .content").should("be.visible") }) @@ -69,11 +72,28 @@ Cypress.Commands.add("createTestTableWithData", () => { cy.addColumn("dog", "age", "Number") }) -Cypress.Commands.add("createTable", tableName => { +Cypress.Commands.add("createInitialDatasource", tableName => { // Enter table name + cy.get(".spectrum-Modal").within(() => { + cy.contains("Budibase DB").trigger("mouseover").click().click() + cy.wait(1000) + cy.contains("Continue").click() + }) + + cy.get(".spectrum-Modal").within(() => { + cy.wait(1000) + cy.get("input").first().type(tableName).blur() + cy.get(".spectrum-ButtonGroup").contains("Create").click() + }) + cy.contains(tableName).should("be.visible") +}) + +Cypress.Commands.add("createTable", tableName => { cy.contains("Budibase DB").click() cy.contains("Create new table").click() + cy.get(".spectrum-Modal").within(() => { + cy.wait(1000) cy.get("input").first().type(tableName).blur() cy.get(".spectrum-ButtonGroup").contains("Create").click() })