forked from tsai/budibase
Browse Source
createTable -Pagination is now Test Env only oracle -Test Env only -Removed smoke test tag commands -Fix for createApp command -Increase wait for createRestQuery commandmaster
3 changed files with 212 additions and 215 deletions
@ -1,195 +1,196 @@ |
|||||
import filterTests from "../../support/filterTests" |
import filterTests from "../../support/filterTests" |
||||
|
|
||||
filterTests(['all', 'smoke'], () => { |
filterTests(['all'], () => { |
||||
context("Oracle Datasource Testing", () => { |
context("Oracle Datasource Testing", () => { |
||||
before(() => { |
if (Cypress.env("TEST_ENV")) { |
||||
cy.login() |
|
||||
cy.createTestApp() |
before(() => { |
||||
}) |
cy.login() |
||||
const datasource = "Oracle" |
cy.createTestApp() |
||||
const queryName = "Cypress Test Query" |
}) |
||||
const queryRename = "CT Query Rename" |
const datasource = "Oracle" |
||||
|
const queryName = "Cypress Test Query" |
||||
it("Should add Oracle data source and skip table fetch", () => { |
const queryRename = "CT Query Rename" |
||||
// Select Oracle data source
|
|
||||
cy.selectExternalDatasource(datasource) |
it("Should add Oracle data source and skip table fetch", () => { |
||||
// Skip table fetch - no config added
|
// Select Oracle data source
|
||||
cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true }) |
cy.selectExternalDatasource(datasource) |
||||
cy.wait(500) |
// Skip table fetch - no config added
|
||||
// Confirm config contains localhost
|
cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true }) |
||||
cy.get(".spectrum-Textfield-input").eq(1).should('have.value', 'localhost') |
cy.wait(500) |
||||
// Add another Oracle data source, configure & skip table fetch
|
// Confirm config contains localhost
|
||||
cy.selectExternalDatasource(datasource) |
cy.get(".spectrum-Textfield-input").eq(1).should('have.value', 'localhost') |
||||
cy.addDatasourceConfig(datasource, true) |
// Add another Oracle data source, configure & skip table fetch
|
||||
// Confirm config and no tables
|
cy.selectExternalDatasource(datasource) |
||||
cy.get(".spectrum-Textfield-input").eq(1).should('have.value', Cypress.env("oracle").HOST) |
cy.addDatasourceConfig(datasource, true) |
||||
cy.get(".spectrum-Body").eq(2).should('contain', 'No tables found.') |
// Confirm config and no tables
|
||||
}) |
cy.get(".spectrum-Textfield-input").eq(1).should('have.value', Cypress.env("oracle").HOST) |
||||
|
cy.get(".spectrum-Body").eq(2).should('contain', 'No tables found.') |
||||
it("Should add Oracle data source and fetch tables without configuration", () => { |
|
||||
// Select Oracle data source
|
|
||||
cy.selectExternalDatasource(datasource) |
|
||||
// Attempt to fetch tables without applying configuration
|
|
||||
cy.intercept('**/datasources').as('datasource') |
|
||||
cy.get(".spectrum-Button") |
|
||||
.contains("Save and fetch tables") |
|
||||
.click({ force: true }) |
|
||||
// Intercept Request after button click & apply assertions
|
|
||||
cy.wait("@datasource") |
|
||||
cy.get("@datasource").its('response.body') |
|
||||
.should('have.property', 'message', 'NJS-007: invalid value for "user" in parameter 1') |
|
||||
cy.get("@datasource").its('response.body') |
|
||||
.should('have.property', 'status', 500) |
|
||||
}) |
|
||||
|
|
||||
it("should add Oracle data source and fetch tables", () => { |
|
||||
// Add & configure Oracle data source
|
|
||||
cy.selectExternalDatasource(datasource) |
|
||||
cy.intercept('**/datasources').as('datasource') |
|
||||
cy.addDatasourceConfig(datasource) |
|
||||
// Check response from datasource after adding configuration
|
|
||||
cy.wait("@datasource") |
|
||||
cy.get("@datasource").its('response.statusCode') |
|
||||
.should('eq', 200) |
|
||||
// Confirm fetch tables was successful
|
|
||||
cy.get(".spectrum-Table-body").eq(0) |
|
||||
.find('tr') |
|
||||
.its('length') |
|
||||
.should('be.gt', 0) |
|
||||
}) |
|
||||
|
|
||||
it("should define a One relationship type", () => { |
|
||||
// Select relationship type & configure
|
|
||||
cy.get(".spectrum-Button").contains("Define relationship").click({ force: true }) |
|
||||
cy.get(".spectrum-Dialog-grid").within(() => { |
|
||||
cy.get(".spectrum-Picker").eq(0).click() |
|
||||
cy.get(".spectrum-Popover").contains("One").click() |
|
||||
cy.get(".spectrum-Picker").eq(1).click() |
|
||||
cy.get(".spectrum-Popover").contains("REGIONS").click() |
|
||||
cy.get(".spectrum-Picker").eq(2).click() |
|
||||
cy.get(".spectrum-Popover").contains("REGION_ID").click() |
|
||||
cy.get(".spectrum-Picker").eq(3).click() |
|
||||
cy.get(".spectrum-Popover").contains("COUNTRIES").click() |
|
||||
cy.get(".spectrum-Picker").eq(4).click() |
|
||||
cy.get(".spectrum-Popover").contains("REGION_ID").click() |
|
||||
// Save relationship & reload page
|
|
||||
cy.get(".spectrum-Button").contains("Save").click({ force: true }) |
|
||||
cy.reload() |
|
||||
}) |
}) |
||||
// Confirm table length & column name
|
|
||||
cy.get(".spectrum-Table-body").eq(1) |
it("Should add Oracle data source and fetch tables without configuration", () => { |
||||
.find('tr') |
// Select Oracle data source
|
||||
.its('length') |
cy.selectExternalDatasource(datasource) |
||||
.should('eq', 1) |
// Attempt to fetch tables without applying configuration
|
||||
cy.get(".spectrum-Table-cell").should('contain', "COUNTRIES to REGIONS") |
cy.intercept('**/datasources').as('datasource') |
||||
}) |
cy.get(".spectrum-Button") |
||||
|
.contains("Save and fetch tables") |
||||
it("should define a Many relationship type", () => { |
.click({ force: true }) |
||||
// Select relationship type & configure
|
// Intercept Request after button click & apply assertions
|
||||
cy.get(".spectrum-Button").contains("Define relationship").click({ force: true }) |
cy.wait("@datasource") |
||||
cy.get(".spectrum-Dialog-grid").within(() => { |
cy.get("@datasource").its('response.body') |
||||
cy.get(".spectrum-Picker").eq(0).click() |
.should('have.property', 'status', 500) |
||||
cy.get(".spectrum-Popover").contains("Many").click() |
|
||||
cy.get(".spectrum-Picker").eq(1).click() |
|
||||
cy.get(".spectrum-Popover").contains("LOCATIONS").click() |
|
||||
cy.get(".spectrum-Picker").eq(2).click() |
|
||||
cy.get(".spectrum-Popover").contains("REGIONS").click() |
|
||||
cy.get(".spectrum-Picker").eq(3).click() |
|
||||
cy.get(".spectrum-Popover").contains("COUNTRIES").click() |
|
||||
cy.get(".spectrum-Picker").eq(4).click() |
|
||||
cy.get(".spectrum-Popover").contains("COUNTRY_ID").click() |
|
||||
cy.get(".spectrum-Picker").eq(5).click() |
|
||||
cy.get(".spectrum-Popover").contains("REGION_ID").click() |
|
||||
// Save relationship & reload page
|
|
||||
cy.get(".spectrum-Button").contains("Save").click({ force: true }) |
|
||||
cy.reload() |
|
||||
}) |
}) |
||||
// Confirm table length & relationship name
|
|
||||
cy.get(".spectrum-Table-body").eq(1) |
it("should add Oracle data source and fetch tables", () => { |
||||
.find('tr') |
// Add & configure Oracle data source
|
||||
.its('length') |
cy.selectExternalDatasource(datasource) |
||||
.should('eq', 2) |
cy.intercept('**/datasources').as('datasource') |
||||
cy.get(".spectrum-Table-cell") |
cy.addDatasourceConfig(datasource) |
||||
.should('contain', "LOCATIONS through COUNTRIES → REGIONS") |
// Check response from datasource after adding configuration
|
||||
}) |
cy.wait("@datasource") |
||||
|
cy.get("@datasource").its('response.statusCode') |
||||
it("should delete relationships", () => { |
.should('eq', 200) |
||||
// Delete both relationships
|
// Confirm fetch tables was successful
|
||||
cy.get(".spectrum-Table-body") |
cy.get(".spectrum-Table-body").eq(0) |
||||
.eq(1).find('tr').its('length') |
.find('tr') |
||||
.then((len) => { |
.its('length') |
||||
for (let i = 0; i < len; i++) { |
.should('be.gt', 0) |
||||
cy.get(".spectrum-Table-body").eq(1).within(() => { |
}) |
||||
cy.get(".spectrum-Table-row").eq(0).click() |
|
||||
cy.wait(500) |
it("should define a One relationship type", () => { |
||||
}) |
// Select relationship type & configure
|
||||
cy.get(".spectrum-Dialog-grid").within(() => { |
cy.get(".spectrum-Button").contains("Define relationship").click({ force: true }) |
||||
cy.get(".spectrum-Button").contains("Delete").click({ force: true }) |
cy.get(".spectrum-Dialog-grid").within(() => { |
||||
}) |
cy.get(".spectrum-Picker").eq(0).click() |
||||
|
cy.get(".spectrum-Popover").contains("One").click() |
||||
|
cy.get(".spectrum-Picker").eq(1).click() |
||||
|
cy.get(".spectrum-Popover").contains("REGIONS").click() |
||||
|
cy.get(".spectrum-Picker").eq(2).click() |
||||
|
cy.get(".spectrum-Popover").contains("REGION_ID").click() |
||||
|
cy.get(".spectrum-Picker").eq(3).click() |
||||
|
cy.get(".spectrum-Popover").contains("COUNTRIES").click() |
||||
|
cy.get(".spectrum-Picker").eq(4).click() |
||||
|
cy.get(".spectrum-Popover").contains("REGION_ID").click() |
||||
|
// Save relationship & reload page
|
||||
|
cy.get(".spectrum-Button").contains("Save").click({ force: true }) |
||||
cy.reload() |
cy.reload() |
||||
} |
}) |
||||
// Confirm relationships no longer exist
|
// Confirm table length & column name
|
||||
cy.get(".spectrum-Body").should('contain', 'No relationships configured') |
cy.get(".spectrum-Table-body").eq(1) |
||||
|
.find('tr') |
||||
|
.its('length') |
||||
|
.should('eq', 1) |
||||
|
cy.get(".spectrum-Table-cell").should('contain', "COUNTRIES to REGIONS") |
||||
}) |
}) |
||||
}) |
|
||||
|
it("should define a Many relationship type", () => { |
||||
it("should add a query", () => { |
// Select relationship type & configure
|
||||
// Add query
|
cy.get(".spectrum-Button").contains("Define relationship").click({ force: true }) |
||||
cy.get(".spectrum-Button").contains("Add query").click({ force: true }) |
cy.get(".spectrum-Dialog-grid").within(() => { |
||||
cy.get(".spectrum-Form-item").eq(0).within(() => { |
cy.get(".spectrum-Picker").eq(0).click() |
||||
cy.get("input").type(queryName) |
cy.get(".spectrum-Popover").contains("Many").click() |
||||
|
cy.get(".spectrum-Picker").eq(1).click() |
||||
|
cy.get(".spectrum-Popover").contains("LOCATIONS").click() |
||||
|
cy.get(".spectrum-Picker").eq(2).click() |
||||
|
cy.get(".spectrum-Popover").contains("REGIONS").click() |
||||
|
cy.get(".spectrum-Picker").eq(3).click() |
||||
|
cy.get(".spectrum-Popover").contains("COUNTRIES").click() |
||||
|
cy.get(".spectrum-Picker").eq(4).click() |
||||
|
cy.get(".spectrum-Popover").contains("COUNTRY_ID").click() |
||||
|
cy.get(".spectrum-Picker").eq(5).click() |
||||
|
cy.get(".spectrum-Popover").contains("REGION_ID").click() |
||||
|
// Save relationship & reload page
|
||||
|
cy.get(".spectrum-Button").contains("Save").click({ force: true }) |
||||
|
cy.reload() |
||||
|
}) |
||||
|
// Confirm table length & relationship name
|
||||
|
cy.get(".spectrum-Table-body").eq(1) |
||||
|
.find('tr') |
||||
|
.its('length') |
||||
|
.should('eq', 2) |
||||
|
cy.get(".spectrum-Table-cell") |
||||
|
.should('contain', "LOCATIONS through COUNTRIES → REGIONS") |
||||
}) |
}) |
||||
// Insert Query within Fields section
|
|
||||
cy.get(".CodeMirror textarea").eq(0) |
it("should delete relationships", () => { |
||||
.type("SELECT * FROM JOBS", { force: true }) |
// Delete both relationships
|
||||
// Intercept query execution
|
cy.get(".spectrum-Table-body") |
||||
cy.intercept('**/queries/preview').as('query') |
.eq(1).find('tr').its('length') |
||||
cy.get(".spectrum-Button").contains("Run Query").click({ force: true }) |
.then((len) => { |
||||
cy.wait(500) |
for (let i = 0; i < len; i++) { |
||||
cy.wait("@query") |
cy.get(".spectrum-Table-body").eq(1).within(() => { |
||||
// Assert against Status Code & Body
|
cy.get(".spectrum-Table-row").eq(0).click() |
||||
cy.get("@query").its('response.statusCode') |
cy.wait(500) |
||||
.should('eq', 200) |
}) |
||||
cy.get("@query").its('response.body') |
cy.get(".spectrum-Dialog-grid").within(() => { |
||||
.should('not.be.empty') |
cy.get(".spectrum-Button").contains("Delete").click({ force: true }) |
||||
// Save query
|
}) |
||||
cy.get(".spectrum-Button").contains("Save Query").click({ force: true }) |
cy.reload() |
||||
cy.get(".nav-item").should('contain', queryName) |
} |
||||
}) |
// Confirm relationships no longer exist
|
||||
|
cy.get(".spectrum-Body").should('contain', 'No relationships configured') |
||||
it("should duplicate a query", () => { |
}) |
||||
// Get query nav item
|
|
||||
cy.get(".nav-item").contains(queryName).parent().within(() => { |
|
||||
cy.get(".spectrum-Icon").eq(1).click({ force: true }) |
|
||||
}) |
}) |
||||
// Select and confirm duplication
|
|
||||
cy.get(".spectrum-Menu").contains("Duplicate").click() |
it("should add a query", () => { |
||||
cy.get(".nav-item").should('contain', queryName + ' (1)') |
// Add query
|
||||
}) |
cy.get(".spectrum-Button").contains("Add query").click({ force: true }) |
||||
|
cy.get(".spectrum-Form-item").eq(0).within(() => { |
||||
it("should edit a query name", () => { |
cy.get("input").type(queryName) |
||||
// Rename query
|
}) |
||||
cy.get(".spectrum-Form-item").eq(0).within(() => { |
// Insert Query within Fields section
|
||||
cy.get("input").clear().type(queryRename) |
cy.get(".CodeMirror textarea").eq(0) |
||||
|
.type("SELECT * FROM JOBS", { force: true }) |
||||
|
// Intercept query execution
|
||||
|
cy.intercept('**/queries/preview').as('query') |
||||
|
cy.get(".spectrum-Button").contains("Run Query").click({ force: true }) |
||||
|
cy.wait(500) |
||||
|
cy.wait("@query") |
||||
|
// Assert against Status Code & Body
|
||||
|
cy.get("@query").its('response.statusCode') |
||||
|
.should('eq', 200) |
||||
|
cy.get("@query").its('response.body') |
||||
|
.should('not.be.empty') |
||||
|
// Save query
|
||||
|
cy.get(".spectrum-Button").contains("Save Query").click({ force: true }) |
||||
|
cy.get(".nav-item").should('contain', queryName) |
||||
}) |
}) |
||||
// Save query
|
|
||||
cy.get(".spectrum-Button").contains("Save Query").click({ force: true }) |
it("should duplicate a query", () => { |
||||
cy.get(".nav-item").should('contain', queryRename) |
// Get query nav item
|
||||
}) |
cy.get(".nav-item").contains(queryName).parent().within(() => { |
||||
|
cy.get(".spectrum-Icon").eq(1).click({ force: true }) |
||||
it("should delete a query", () => { |
}) |
||||
// Get query nav item - QueryName
|
// Select and confirm duplication
|
||||
cy.get(".nav-item").contains(queryName).parent().within(() => { |
cy.get(".spectrum-Menu").contains("Duplicate").click() |
||||
cy.get(".spectrum-Icon").eq(1).click({ force: true }) |
cy.get(".nav-item").should('contain', queryName + ' (1)') |
||||
}) |
}) |
||||
|
|
||||
// Select Delete
|
it("should edit a query name", () => { |
||||
cy.get(".spectrum-Menu").contains("Delete").click() |
// Rename query
|
||||
cy.get(".spectrum-Button").contains("Delete Query").click({ force: true }) |
cy.get(".spectrum-Form-item").eq(0).within(() => { |
||||
cy.wait(1000) |
cy.get("input").clear().type(queryRename) |
||||
|
}) |
||||
|
// Save query
|
||||
|
cy.get(".spectrum-Button").contains("Save Query").click({ force: true }) |
||||
|
cy.get(".nav-item").should('contain', queryRename) |
||||
|
}) |
||||
|
|
||||
// Confirm deletion
|
it("should delete a query", () => { |
||||
cy.get(".nav-item").should('not.contain', queryName) |
// Get query nav item - QueryName
|
||||
}) |
cy.get(".nav-item").contains(queryName).parent().within(() => { |
||||
|
cy.get(".spectrum-Icon").eq(1).click({ force: true }) |
||||
|
}) |
||||
|
|
||||
|
// Select Delete
|
||||
|
cy.get(".spectrum-Menu").contains("Delete").click() |
||||
|
cy.get(".spectrum-Button").contains("Delete Query").click({ force: true }) |
||||
|
cy.wait(1000) |
||||
|
|
||||
|
// Confirm deletion
|
||||
|
cy.get(".nav-item").should('not.contain', queryName) |
||||
|
}) |
||||
|
} |
||||
}) |
}) |
||||
}) |
}) |
||||
|
|||||
Loading…
Reference in new issue