2022-01-21 13:43:27 +01:00
|
|
|
import filterTests from "../support/filterTests"
|
2022-06-06 13:01:14 +02:00
|
|
|
const interact = require('../support/interact')
|
2020-09-25 14:12:16 +02:00
|
|
|
|
2022-02-23 14:14:28 +01:00
|
|
|
filterTests(["smoke", "all"], () => {
|
2022-11-15 13:38:48 +01:00
|
|
|
xcontext("Create a Table", () => {
|
2022-01-21 13:43:27 +01:00
|
|
|
before(() => {
|
|
|
|
cy.login()
|
|
|
|
cy.createTestApp()
|
|
|
|
})
|
2020-09-25 14:12:16 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("should create a new Table", () => {
|
|
|
|
cy.createTable("dog")
|
|
|
|
// Check if Table exists
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.TABLE_TITLE_H1, { timeout: 1000 }).should("have.text", "dog")
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2020-09-25 14:12:16 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("adds a new column to the table", () => {
|
|
|
|
cy.addColumn("dog", "name", "Text")
|
|
|
|
cy.contains("name").should("be.visible")
|
|
|
|
})
|
2020-09-25 14:12:16 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("creates a row in the table", () => {
|
|
|
|
cy.addRow(["Rover"])
|
|
|
|
cy.contains("Rover").should("be.visible")
|
2021-11-15 16:25:58 +01:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
|
|
|
|
it("updates a column on the table", () => {
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.TABLE_TITLE).click()
|
|
|
|
cy.get(interact.SPECTRUM_TABLE_EDIT).click()
|
|
|
|
cy.get(interact.MODAL_INNER_WRAPPER).within(() => {
|
2022-03-01 12:39:48 +01:00
|
|
|
|
|
|
|
cy.get("input").eq(0).type("updated", { force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
// Unset table display column
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.SPECTRUM_SWITCH_INPUT).eq(1).click()
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.contains("Save Column").click()
|
2022-03-01 12:39:48 +01:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.contains("nameupdated ").should("contain", "nameupdated")
|
2021-11-15 16:25:58 +01:00
|
|
|
})
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("edits a row", () => {
|
|
|
|
cy.contains("button", "Edit").click({ force: true })
|
2022-06-29 19:28:32 +02:00
|
|
|
cy.wait(500)
|
|
|
|
cy.get(interact.SPECTRUM_MODAL_INPUT).clear()
|
|
|
|
cy.get(interact.SPECTRUM_MODAL_INPUT).type("Updated")
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.contains("Save").click()
|
|
|
|
cy.contains("Updated").should("have.text", "Updated")
|
|
|
|
})
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("deletes a row", () => {
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.SPECTRUM_CHECKBOX_INPUT).check({ force: true })
|
2022-08-11 14:26:27 +02:00
|
|
|
cy.contains("Delete 1 row").click()
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.SPECTRUM_MODAL).contains("Delete").click()
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.contains("RoverUpdated").should("not.exist")
|
|
|
|
})
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-01-21 18:28:33 +01:00
|
|
|
if (Cypress.env("TEST_ENV")) {
|
|
|
|
// No Pagination in CI - Test env only for the next two tests
|
2022-04-14 18:15:34 +02:00
|
|
|
xit("Adds 15 rows and checks pagination", () => {
|
2022-01-21 18:28:33 +01:00
|
|
|
// 10 rows per page, 15 rows should create 2 pages within table
|
|
|
|
const totalRows = 16
|
2022-02-23 14:14:28 +01:00
|
|
|
for (let i = 1; i < totalRows; i++) {
|
2022-01-21 18:28:33 +01:00
|
|
|
cy.addRow([i])
|
|
|
|
}
|
2022-04-12 17:20:15 +02:00
|
|
|
cy.reload()
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.SPECTRUM_PAGINATION, { timeout: 2000 }).within(() => {
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.SPECTRUM_ACTION_BUTTON).eq(1).click()
|
2022-01-21 18:28:33 +01:00
|
|
|
})
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.SPECTRUM_PAGINATION).within(() => {
|
|
|
|
cy.get(interact.SPECTRUM_BODY_SECOND).contains("Page 2")
|
2022-01-21 18:28:33 +01:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-04-14 18:15:34 +02:00
|
|
|
xit("Deletes rows and checks pagination", () => {
|
2022-04-12 17:20:15 +02:00
|
|
|
// Delete rows, removing second page from table
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.SPECTRUM_CHECKBOX_INPUT).check({ force: true })
|
|
|
|
cy.get(interact.POPOVERS).within(() => {
|
|
|
|
cy.get(interact.SPECTRUM_BUTTON).click({ force: true })
|
2022-04-12 17:20:15 +02:00
|
|
|
})
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.SPECTRUM_DIALOG_GRID).contains("Delete").click({ force: true })
|
2022-02-23 14:14:28 +01:00
|
|
|
|
2022-01-21 18:28:33 +01:00
|
|
|
// Confirm table only has one page
|
2022-06-17 18:41:07 +02:00
|
|
|
cy.get(interact.SPECTRUM_PAGINATION, { timeout: 1000 }).within(() => {
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.SPECTRUM_ACTION_BUTTON).eq(1).should("not.be.enabled")
|
2022-01-21 18:28:33 +01:00
|
|
|
})
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-01-21 18:28:33 +01:00
|
|
|
}
|
2020-09-25 14:12:16 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("deletes a column", () => {
|
|
|
|
const columnName = "nameupdated"
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.TABLE_TITLE).click()
|
|
|
|
cy.get(interact.SPECTRUM_TABLE_EDIT).click()
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.contains("Delete").click()
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.DELETE_COLUMN_CONFIRM).type(columnName)
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.contains("Delete Column").click()
|
|
|
|
cy.contains("nameupdated").should("not.exist")
|
|
|
|
})
|
2020-09-25 14:12:16 +02:00
|
|
|
|
2022-01-21 13:43:27 +01:00
|
|
|
it("deletes a table", () => {
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.NAV_ITEM)
|
2022-01-21 13:43:27 +01:00
|
|
|
.contains("dog")
|
2022-06-06 13:01:14 +02:00
|
|
|
.parents(interact.NAV_ITEM)
|
2022-01-21 13:43:27 +01:00
|
|
|
.first()
|
|
|
|
.within(() => {
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.ACTION_SPECTRUM_ICON).click({ force: true })
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-06-06 13:01:14 +02:00
|
|
|
cy.get(interact.SPECTRUM_MENU_CHILD2).click()
|
|
|
|
cy.get(interact.DELETE_TABLE_CONFIRM).type("dog")
|
2022-01-21 13:43:27 +01:00
|
|
|
cy.contains("Delete Table").click()
|
|
|
|
cy.contains("dog").should("not.exist")
|
|
|
|
})
|
2020-09-25 14:12:16 +02:00
|
|
|
})
|
2020-08-07 19:31:40 +02:00
|
|
|
})
|