update cypress tests to account for new modal

This commit is contained in:
Peter Clement 2021-09-28 12:26:38 +01:00
parent 5ca4da1146
commit fa4f0b07f4
3 changed files with 26 additions and 6 deletions

View File

@ -1,9 +1,9 @@
{ {
"baseUrl": "http://localhost:10001/builder/", "baseUrl": "http://localhost:10000/builder/",
"video": true, "video": true,
"projectId": "bmbemn", "projectId": "bmbemn",
"env": { "env": {
"PORT": "10001", "PORT": "10000",
"JWT_SECRET": "test" "JWT_SECRET": "test"
} }
} }

View File

@ -6,7 +6,7 @@ context("Create a Table", () => {
it("should create a new Table", () => { it("should create a new Table", () => {
cy.createTable("dog") cy.createTable("dog")
cy.wait(1000)
// Check if Table exists // Check if Table exists
cy.get(".table-title h1").should("have.text", "dog") cy.get(".table-title h1").should("have.text", "dog")
}) })
@ -36,7 +36,7 @@ context("Create a Table", () => {
it("edits a row", () => { it("edits a row", () => {
cy.contains("button", "Edit").click({ force: true }) cy.contains("button", "Edit").click({ force: true })
cy.wait(1000) cy.wait(1000)
cy.get(".spectrum-Modal input").type("Updated") cy.get(".spectrum-Modal input").type("RoverUpdated")
cy.contains("Save").click() cy.contains("Save").click()
cy.contains("RoverUpdated").should("have.text", "RoverUpdated") cy.contains("RoverUpdated").should("have.text", "RoverUpdated")
}) })
@ -62,7 +62,7 @@ context("Create a Table", () => {
it("deletes a table", () => { it("deletes a table", () => {
cy.get(".actions > :nth-child(1) > .icon > .spectrum-Icon > use") cy.get(".actions > :nth-child(1) > .icon > .spectrum-Icon > use")
.first() .eq(1)
.click({ force: true }) .click({ force: true })
cy.get(".spectrum-Menu > :nth-child(2)").click() cy.get(".spectrum-Menu > :nth-child(2)").click()
cy.contains("Delete Table").click() cy.contains("Delete Table").click()

View File

@ -35,8 +35,11 @@ Cypress.Commands.add("createApp", name => {
.within(() => { .within(() => {
cy.get("input").eq(0).type(name).should("have.value", name).blur() cy.get("input").eq(0).type(name).should("have.value", name).blur()
cy.get(".spectrum-ButtonGroup").contains("Create app").click() cy.get(".spectrum-ButtonGroup").contains("Create app").click()
cy.wait(7000)
}) })
.then(() => { .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.expandBudibaseConnection()
cy.get(".nav-item.selected > .content").should("be.visible") cy.get(".nav-item.selected > .content").should("be.visible")
}) })
@ -69,11 +72,28 @@ Cypress.Commands.add("createTestTableWithData", () => {
cy.addColumn("dog", "age", "Number") cy.addColumn("dog", "age", "Number")
}) })
Cypress.Commands.add("createTable", tableName => { Cypress.Commands.add("createInitialDatasource", tableName => {
// Enter table name // 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("Budibase DB").click()
cy.contains("Create new table").click() cy.contains("Create new table").click()
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal").within(() => {
cy.wait(1000)
cy.get("input").first().type(tableName).blur() cy.get("input").first().type(tableName).blur()
cy.get(".spectrum-ButtonGroup").contains("Create").click() cy.get(".spectrum-ButtonGroup").contains("Create").click()
}) })