budibase/packages/builder/cypress/integration/createTable.spec.js

69 lines
2.0 KiB
JavaScript
Raw Normal View History

2020-09-25 14:12:16 +02:00
context("Create a Table", () => {
before(() => {
cy.visit("localhost:4001/_builder")
cy.createApp("Table App", "Table App Description")
})
it("should create a new Table", () => {
cy.createTable("dog")
// Check if Table exists
2020-10-27 16:26:07 +01:00
cy.get(".table-title h1").should("have.text", "dog")
2020-09-25 14:12:16 +02:00
})
it("adds a new column to the table", () => {
cy.addColumn("dog", "name", "Text")
2020-09-25 14:12:16 +02:00
cy.contains("name").should("be.visible")
})
it("creates a row in the table", () => {
cy.addRow(["Rover"])
2020-09-25 14:12:16 +02:00
cy.contains("Rover").should("be.visible")
})
it("updates a column on the table", () => {
cy.contains("header", "name")
.trigger("mouseover")
.find(".ri-pencil-line")
.click({ force: true })
2020-10-27 16:26:07 +01:00
cy.get(".actions input").first().type("updated")
2020-10-15 09:17:26 +02:00
// Unset table display column
cy.contains("display column").click()
2020-09-25 14:12:16 +02:00
cy.contains("Save Column").click()
cy.contains("nameupdated").should("have.text", "nameupdated")
2020-09-25 14:12:16 +02:00
})
it("edits a row", () => {
cy.contains("button", "Edit").click({ force: true })
cy.wait(1000)
cy.get(".modal input").type("Updated")
2020-09-25 14:12:16 +02:00
cy.contains("Save").click()
cy.contains("RoverUpdated").should("have.text", "RoverUpdated")
})
it("deletes a row", () => {
2020-10-27 17:01:27 +01:00
cy.get(".ag-checkbox-input").check({ force: true })
cy.contains("Delete 1 row(s)").click()
cy.get(".modal").contains("Delete").click()
2020-09-25 14:12:16 +02:00
cy.contains("RoverUpdated").should("not.exist")
})
it("deletes a column", () => {
cy.contains("header", "name")
.trigger("mouseover")
.find(".ri-pencil-line")
.click({ force: true })
cy.contains("Delete").click()
2020-10-27 17:01:27 +01:00
cy.wait(50)
cy.get(".buttons").contains("Delete").click()
2020-09-25 14:12:16 +02:00
cy.contains("nameupdated").should("not.exist")
})
it("deletes a table", () => {
2021-02-06 22:32:17 +01:00
cy.get(".actions").first().invoke("show").click({ force: true })
2020-09-25 14:12:16 +02:00
cy.get("[data-cy=delete-table]").click()
cy.contains("Delete Table").click()
cy.contains("dog").should("not.exist")
})
2020-08-07 19:31:40 +02:00
})