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

71 lines
1.9 KiB
JavaScript
Raw Normal View History

2020-08-10 16:34:37 +02:00
context('Create a Table', () => {
2020-08-07 19:31:40 +02:00
before(() => {
cy.visit('localhost:4001/_builder')
cy.createApp('Table App', 'Table App Description')
})
it('should create a new Table', () => {
2020-08-10 16:34:37 +02:00
cy.createTable('dog')
2020-08-07 19:31:40 +02:00
// Check if Table exists
cy.get('.title').should('have.text', 'dog')
})
2020-08-10 18:51:30 +02:00
it('adds a new column to the table', () => {
cy.addColumn('dog', 'name', 'Plain Text')
2020-08-07 19:31:40 +02:00
2020-08-10 18:51:30 +02:00
cy.contains('name').should("be.visible")
})
2020-08-07 19:31:40 +02:00
2020-08-10 18:51:30 +02:00
it('creates a record in the table', () => {
cy.addRecord(["Rover"])
cy.contains('Rover').should("be.visible")
})
2020-08-07 19:31:40 +02:00
2020-08-10 18:51:30 +02:00
it('updates a column on the table', () => {
cy.contains("name").click()
cy.get("[data-cy='edit-column-header']").click()
2020-08-07 19:31:40 +02:00
2020-08-10 18:51:30 +02:00
cy.get("[placeholder=Name]").type("updated")
cy.get("select").select("Plain Text")
2020-08-07 19:31:40 +02:00
2020-08-10 18:51:30 +02:00
cy.contains("Save Column").click()
2020-08-07 19:31:40 +02:00
2020-08-10 18:51:30 +02:00
cy.contains('nameupdated').should('have.text', 'nameupdated ')
})
it('edits a record', () => {
cy.get("tbody .ri-more-line").click()
cy.get("[data-cy=edit-row]").click()
2020-08-21 11:11:17 +02:00
cy.get(".actions input").type("Updated")
2020-08-10 18:51:30 +02:00
cy.contains("Save").click()
2020-08-21 11:11:17 +02:00
cy.contains('RoverUpdated').should('have.text', 'RoverUpdated')
2020-08-10 18:51:30 +02:00
})
2020-08-07 19:31:40 +02:00
2020-08-10 18:51:30 +02:00
it('deletes a record', () => {
cy.get("tbody .ri-more-line").click()
cy.get("[data-cy=delete-row]").click()
cy.get(".modal-actions").contains("Delete").click()
2020-08-21 11:11:17 +02:00
cy.contains('RoverUpdated').should('not.exist')
2020-08-10 18:51:30 +02:00
})
it('deletes a column', () => {
cy.contains("name").click()
cy.get("[data-cy='delete-column-header']").click()
cy.contains('nameupdated').should('not.exist')
})
it('deletes a table', () => {
cy.contains("div", "dog").get(".ri-more-line").click()
cy.get("[data-cy=delete-table]").click()
cy.get(".modal-actions").contains("Delete").click()
cy.contains('dog').should('not.exist')
})
2020-08-07 19:31:40 +02:00
})