1
0
Fork 0
mirror of synced 2024-07-06 23:10:57 +12:00
budibase/packages/builder/cypress/integration/createTable.spec.js

71 lines
1.9 KiB
JavaScript
Raw Normal View History

2020-08-11 02:34:37 +12:00
context('Create a Table', () => {
2020-08-08 05:31:40 +12:00
before(() => {
cy.visit('localhost:4001/_builder')
cy.createApp('Table App', 'Table App Description')
})
it('should create a new Table', () => {
2020-08-11 02:34:37 +12:00
cy.createTable('dog')
2020-08-08 05:31:40 +12:00
// Check if Table exists
cy.get('.title').should('have.text', 'dog')
})
2020-08-11 04:51:30 +12:00
it('adds a new column to the table', () => {
cy.addColumn('dog', 'name', 'Plain Text')
2020-08-08 05:31:40 +12:00
2020-08-11 04:51:30 +12:00
cy.contains('name').should("be.visible")
})
2020-08-08 05:31:40 +12:00
2020-08-11 04:51:30 +12:00
it('creates a record in the table', () => {
cy.addRecord(["Rover"])
cy.contains('Rover').should("be.visible")
})
2020-08-08 05:31:40 +12:00
2020-08-11 04:51:30 +12:00
it('updates a column on the table', () => {
cy.contains("name").click()
cy.get("[data-cy='edit-column-header']").click()
2020-08-08 05:31:40 +12:00
2020-08-11 04:51:30 +12:00
cy.get("[placeholder=Name]").type("updated")
cy.get("select").select("Plain Text")
2020-08-08 05:31:40 +12:00
2020-08-11 04:51:30 +12:00
cy.contains("Save Column").click()
2020-08-08 05:31:40 +12:00
2020-08-11 04:51:30 +12: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 21:11:17 +12:00
cy.get(".actions input").type("Updated")
2020-08-11 04:51:30 +12:00
cy.contains("Save").click()
2020-08-21 21:11:17 +12:00
cy.contains('RoverUpdated').should('have.text', 'RoverUpdated')
2020-08-11 04:51:30 +12:00
})
2020-08-08 05:31:40 +12:00
2020-08-11 04:51:30 +12: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 21:11:17 +12:00
cy.contains('RoverUpdated').should('not.exist')
2020-08-11 04:51:30 +12: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-08 05:31:40 +12:00
})