2022-01-21 13:43:27 +01:00
|
|
|
import filterTests from "../support/filterTests"
|
|
|
|
|
|
|
|
filterTests(['smoke', 'all'], () => {
|
2022-04-07 13:22:16 +02:00
|
|
|
context("Auto Screens UI", () => {
|
|
|
|
before(() => {
|
|
|
|
cy.login()
|
2022-01-21 13:43:27 +01:00
|
|
|
})
|
2022-04-07 13:22:16 +02:00
|
|
|
|
2022-04-08 10:56:20 +02:00
|
|
|
it("should disable the autogenerated screen options if no sources are available", () => {
|
|
|
|
cy.createApp("First Test App", false)
|
|
|
|
|
|
|
|
cy.closeModal();
|
|
|
|
|
|
|
|
cy.contains("Design").click()
|
|
|
|
cy.get("[aria-label=AddCircle]").click()
|
|
|
|
cy.get(".spectrum-Modal").within(() => {
|
2022-04-22 19:23:16 +02:00
|
|
|
cy.get(".item.disabled").contains("Autogenerated screens")
|
2022-04-08 10:56:20 +02:00
|
|
|
cy.get(".confirm-wrap .spectrum-Button").should('be.disabled')
|
|
|
|
})
|
|
|
|
|
|
|
|
cy.deleteAllApps()
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should not display incompatible sources", () => {
|
|
|
|
cy.createApp("Test App")
|
|
|
|
|
|
|
|
cy.selectExternalDatasource("REST")
|
|
|
|
cy.selectExternalDatasource("S3")
|
|
|
|
cy.get(".spectrum-Modal").within(() => {
|
|
|
|
cy.get(".spectrum-Button").contains("Save and continue to query").click({ force : true })
|
|
|
|
})
|
|
|
|
|
|
|
|
cy.navigateToAutogeneratedModal()
|
|
|
|
|
|
|
|
cy.get('.data-source-entry').should('have.length', 1)
|
|
|
|
cy.get('.data-source-entry')
|
|
|
|
|
|
|
|
cy.deleteAllApps()
|
|
|
|
});
|
|
|
|
|
2022-04-07 13:22:16 +02:00
|
|
|
it("should generate internal table screens", () => {
|
2022-04-08 10:56:20 +02:00
|
|
|
cy.createTestApp()
|
2022-04-22 19:23:16 +02:00
|
|
|
// Create Autogenerated screens from the internal table
|
|
|
|
cy.createDatasourceScreen(["Cypress Tests"])
|
2022-04-07 13:22:16 +02:00
|
|
|
// Confirm screens have been auto generated
|
|
|
|
cy.get(".nav-items-container").contains("cypress-tests").click({ force: true })
|
|
|
|
cy.get(".nav-items-container").should('contain', 'cypress-tests/:id')
|
|
|
|
.and('contain', 'cypress-tests/new/row')
|
|
|
|
})
|
|
|
|
|
|
|
|
it("should generate multiple internal table screens at once", () => {
|
|
|
|
// Create a second internal table
|
|
|
|
const initialTable = "Cypress Tests"
|
|
|
|
const secondTable = "Table Two"
|
|
|
|
cy.createTable(secondTable)
|
2022-04-22 19:23:16 +02:00
|
|
|
// Create Autogenerated screens from the internal tables
|
|
|
|
cy.createDatasourceScreen([initialTable, secondTable])
|
2022-04-07 13:22:16 +02:00
|
|
|
// Confirm screens have been auto generated
|
|
|
|
cy.get(".nav-items-container").contains("cypress-tests").click({ force: true })
|
|
|
|
// Previously generated tables are suffixed with numbers - as expected
|
|
|
|
cy.get(".nav-items-container").should('contain', 'cypress-tests-2/:id')
|
|
|
|
.and('contain', 'cypress-tests-2/new/row')
|
|
|
|
cy.get(".nav-items-container").contains("table-two").click()
|
|
|
|
cy.get(".nav-items-container").should('contain', 'table-two/:id')
|
|
|
|
.and('contain', 'table-two/new/row')
|
|
|
|
})
|
|
|
|
|
2022-04-08 10:56:20 +02:00
|
|
|
it("should generate multiple internal table screens with the same screen access level", () => {
|
|
|
|
//The tables created in the previous step still exist
|
|
|
|
cy.createTable("Table Three")
|
|
|
|
cy.createTable("Table Four")
|
2022-04-22 19:23:16 +02:00
|
|
|
cy.createDatasourceScreen(["Table Three", "Table Four"], "Admin")
|
2022-04-08 10:56:20 +02:00
|
|
|
|
2022-04-22 19:23:16 +02:00
|
|
|
cy.get(".nav-items-container").contains("table-three").click()
|
|
|
|
cy.get(".nav-items-container").should('contain', 'table-three/:id')
|
|
|
|
.and('contain', 'table-three/new/row')
|
2022-04-08 11:29:19 +02:00
|
|
|
|
2022-04-22 19:23:16 +02:00
|
|
|
cy.get(".nav-items-container").contains("table-four").click()
|
|
|
|
cy.get(".nav-items-container").should('contain', 'table-four/:id')
|
|
|
|
.and('contain', 'table-four/new/row')
|
|
|
|
|
|
|
|
//The access level should now be set to admin. Previous screens should be filtered.
|
|
|
|
cy.get(".nav-items-container").contains("table-two").should('not.exist')
|
|
|
|
cy.get(".nav-items-container").contains("cypress-tests").should('not.exist')
|
2022-04-08 10:56:20 +02:00
|
|
|
})
|
|
|
|
|
2022-04-07 13:22:16 +02:00
|
|
|
if (Cypress.env("TEST_ENV")) {
|
|
|
|
it("should generate data source screens", () => {
|
|
|
|
// Using MySQL data source for testing this
|
|
|
|
const datasource = "MySQL"
|
|
|
|
// Select & configure MySQL data source
|
|
|
|
cy.selectExternalDatasource(datasource)
|
|
|
|
cy.addDatasourceConfig(datasource)
|
2022-04-22 19:23:16 +02:00
|
|
|
// Create Autogenerated screens from a MySQL table - MySQL contains books table
|
|
|
|
cy.createDatasourceScreen(["books"])
|
|
|
|
|
2022-04-07 13:22:16 +02:00
|
|
|
cy.get(".nav-items-container").contains("books").click()
|
|
|
|
cy.get(".nav-items-container").should('contain', 'books/:id')
|
|
|
|
.and('contain', 'books/new/row')
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
2021-12-24 11:49:47 +01:00
|
|
|
})
|