1
0
Fork 0
mirror of synced 2024-07-03 13:30:46 +12:00
budibase/packages/builder/cypress/integration/createTable.spec.js

72 lines
2 KiB
JavaScript
Raw Normal View History

2020-09-26 00:12:16 +12:00
context("Create a Table", () => {
before(() => {
2021-04-16 05:29:11 +12:00
cy.login()
cy.createTestApp()
2020-09-26 00:12:16 +12:00
})
it("should create a new Table", () => {
cy.createTable("dog")
cy.wait(1000)
2020-09-26 00:12:16 +12:00
// Check if Table exists
2020-10-28 04:26:07 +13:00
cy.get(".table-title h1").should("have.text", "dog")
2020-09-26 00:12:16 +12:00
})
it("adds a new column to the table", () => {
cy.addColumn("dog", "name", "Text")
2020-09-26 00:12:16 +12:00
cy.contains("name").should("be.visible")
})
it("creates a row in the table", () => {
cy.addRow(["Rover"])
2020-09-26 00:12:16 +12:00
cy.contains("Rover").should("be.visible")
})
it("updates a column on the table", () => {
cy.get(".title").click()
cy.get(".spectrum-Table-editIcon > use").click()
cy.get("input")
.eq(1)
.type("updated", { force: true })
2020-10-15 20:17:26 +13:00
// Unset table display column
cy.get(".spectrum-Switch-input").eq(1).click()
2020-09-26 00:12:16 +12:00
cy.contains("Save Column").click()
cy.contains("nameupdated ").should("contain", "nameupdated")
2020-09-26 00:12:16 +12:00
})
it("edits a row", () => {
cy.contains("button", "Edit").click({ force: true })
cy.wait(1000)
cy.get(".spectrum-Modal input").type("RoverUpdated")
2020-09-26 00:12:16 +12:00
cy.contains("Save").click()
cy.contains("RoverUpdated").should("have.text", "RoverUpdated")
})
it("deletes a row", () => {
cy.get(".spectrum-Checkbox-input").check({ force: true })
2020-10-28 05:01:27 +13:00
cy.contains("Delete 1 row(s)").click()
cy.get(".spectrum-Modal")
.contains("Delete")
.click()
2020-09-26 00:12:16 +12:00
cy.contains("RoverUpdated").should("not.exist")
})
it("deletes a column", () => {
cy.get(".title").click()
cy.get(".spectrum-Table-editIcon > use").click()
cy.contains("Delete").click()
2020-10-28 05:01:27 +13:00
cy.wait(50)
cy.contains("Delete Column")
.click()
2020-09-26 00:12:16 +12:00
cy.contains("nameupdated").should("not.exist")
})
it("deletes a table", () => {
cy.get(".actions > :nth-child(1) > .icon > .spectrum-Icon > use")
.eq(1)
.click({ force: true })
cy.get(".spectrum-Menu > :nth-child(2)").click()
2020-09-26 00:12:16 +12:00
cy.contains("Delete Table").click()
cy.contains("dog").should("not.exist")
})
2020-08-08 05:31:40 +12:00
})