Merge pull request #5400 from Budibase/cypress-testing

Updated Datasource Testing
This commit is contained in:
Mitch-Budibase 2022-04-14 10:05:02 +01:00 committed by GitHub
commit 4dcb320561
4 changed files with 23 additions and 16 deletions

View File

@ -19,6 +19,7 @@ filterTests(["all"], () => {
cy.get(".spectrum-Button")
.contains("Save and fetch tables")
.click({ force: true })
cy.wait(500)
// Intercept Request after button click & apply assertions
cy.wait("@datasource")
cy.get("@datasource")
@ -31,6 +32,7 @@ filterTests(["all"], () => {
cy.get("@datasource")
.its("response.body")
.should("have.property", "status", 500)
cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true })
})
it("should add MySQL data source and fetch tables", () => {
@ -131,7 +133,7 @@ filterTests(["all"], () => {
cy.get(".spectrum-Table")
.eq(1)
.within(() => {
cy.get(".spectrum-Table-row").eq(0).click()
cy.get(".spectrum-Table-row").eq(0).click({ force: true })
cy.wait(500)
})
cy.get(".spectrum-Dialog-grid").within(() => {

View File

@ -46,9 +46,10 @@ filterTests(["all"], () => {
cy.get("@datasource")
.its("response.body")
.should("have.property", "status", 500)
cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true })
})
it("should add Oracle data source and fetch tables", () => {
xit("should add Oracle data source and fetch tables", () => {
// Add & configure Oracle data source
cy.selectExternalDatasource(datasource)
cy.intercept("**/datasources").as("datasource")
@ -64,7 +65,7 @@ filterTests(["all"], () => {
.should("be.gt", 0)
})
it("should define a One relationship type", () => {
xit("should define a One relationship type", () => {
// Select relationship type & configure
cy.get(".spectrum-Button")
.contains("Define relationship")
@ -93,7 +94,7 @@ filterTests(["all"], () => {
cy.get(".spectrum-Table-cell").should("contain", "COUNTRIES to REGIONS")
})
it("should define a Many relationship type", () => {
xit("should define a Many relationship type", () => {
// Select relationship type & configure
cy.get(".spectrum-Button")
.contains("Define relationship")
@ -127,7 +128,7 @@ filterTests(["all"], () => {
)
})
it("should delete relationships", () => {
xit("should delete relationships", () => {
// Delete both relationships
cy.get(".spectrum-Table")
.eq(1)
@ -156,7 +157,7 @@ filterTests(["all"], () => {
})
})
it("should add a query", () => {
xit("should add a query", () => {
// Add query
cy.get(".spectrum-Button").contains("Add query").click({ force: true })
cy.get(".spectrum-Form-item")
@ -181,7 +182,7 @@ filterTests(["all"], () => {
cy.get(".nav-item").should("contain", queryName)
})
it("should duplicate a query", () => {
xit("should duplicate a query", () => {
// Get query nav item
cy.get(".nav-item")
.contains(queryName)
@ -194,7 +195,7 @@ filterTests(["all"], () => {
cy.get(".nav-item").should("contain", queryName + " (1)")
})
it("should edit a query name", () => {
xit("should edit a query name", () => {
// Rename query
cy.get(".spectrum-Form-item")
.eq(0)
@ -206,7 +207,7 @@ filterTests(["all"], () => {
cy.get(".nav-item").should("contain", queryRename)
})
it("should delete a query", () => {
xit("should delete a query", () => {
// Get query nav item - QueryName
cy.get(".nav-item")
.contains(queryName)

View File

@ -31,6 +31,7 @@ filterTests(["all"], () => {
cy.get("@datasource")
.its("response.body")
.should("have.property", "status", 500)
cy.get(".spectrum-Button").contains("Skip table fetch").click({ force: true })
})
it("should add PostgreSQL data source and fetch tables", () => {
@ -113,13 +114,13 @@ filterTests(["all"], () => {
})
it("should delete a relationship", () => {
cy.get(".hierarchy-items-container").contains(datasource).click()
cy.get(".hierarchy-items-container").contains("PostgreSQL-2").click()
cy.reload()
// Delete one relationship
cy.get(".spectrum-Table")
.eq(1)
.within(() => {
cy.get(".spectrum-Table-row").eq(0).click()
cy.get(".spectrum-Table-row").eq(0).click({ force: true })
cy.wait(500)
})
cy.get(".spectrum-Dialog-grid").within(() => {
@ -161,7 +162,7 @@ filterTests(["all"], () => {
it("should switch to schema with no tables", () => {
// Switch Schema - To one without any tables
cy.get(".hierarchy-items-container").contains(datasource).click()
cy.get(".hierarchy-items-container").contains("PostgreSQL-2").click()
switchSchema("randomText")
// No tables displayed
@ -208,11 +209,12 @@ filterTests(["all"], () => {
})
it("should duplicate a query", () => {
// Get last nav item - The query
// Locate previously created query
cy.get(".nav-item")
.last()
.contains(queryName)
.siblings(".actions")
.within(() => {
cy.get(".icon").eq(1).click({ force: true })
cy.get(".icon").click({ force: true })
})
// Select and confirm duplication
cy.get(".spectrum-Menu").contains("Duplicate").click()

View File

@ -415,7 +415,9 @@ Cypress.Commands.add("addDatasourceConfig", (datasource, skipFetch) => {
if (datasource == "Oracle") {
cy.get("input").clear().type(Cypress.env("oracle").HOST)
} else {
cy.get("input").clear().type(Cypress.env("HOST_IP"))
cy.get("input")
.clear({ force: true })
.type(Cypress.env("HOST_IP"), { force: true })
}
})
})