-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4304205
commit 02c6885
Showing
3 changed files
with
132 additions
and
106 deletions.
There are no files selected for viewing
80 changes: 41 additions & 39 deletions
80
packages/builder/cypress/integration/datasources/rest.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,45 @@ | ||
import filterTests from "../../support/filterTests" | ||
|
||
filterTests(['smoke', 'all'], () => { | ||
context("REST Datasource Testing", () => { | ||
before(() => { | ||
cy.login() | ||
cy.createTestApp() | ||
}) | ||
|
||
const datasource = "REST" | ||
const restUrl = "https://api.openbrewerydb.org/breweries" | ||
|
||
it("Should add REST data source with incorrect API", () => { | ||
// Select REST data source | ||
cy.selectExternalDatasource(datasource) | ||
// Enter incorrect api & attempt to send query | ||
cy.wait(500) | ||
cy.get(".spectrum-Button").contains("Add query").click({ force: true }) | ||
cy.intercept('**/preview').as('queryError') | ||
cy.get("input").clear().type("random text") | ||
cy.get(".spectrum-Button").contains("Send").click({ force: true }) | ||
// Intercept Request after button click & apply assertions | ||
cy.wait("@queryError") | ||
cy.get("@queryError").its('response.body') | ||
.should('have.property', 'message', 'Invalid URL: http://random text?') | ||
cy.get("@queryError").its('response.body') | ||
.should('have.property', 'status', 400) | ||
}) | ||
|
||
it("should add and configure a REST datasource", () => { | ||
// Select REST datasource and create query | ||
cy.selectExternalDatasource(datasource) | ||
cy.wait(500) | ||
// createRestQuery confirms query creation | ||
cy.createRestQuery("GET", restUrl) | ||
// Confirm status code response within REST datasource | ||
cy.get(".spectrum-FieldLabel") | ||
.contains("Status") | ||
.children() | ||
.should('contain', 200) | ||
}) | ||
filterTests(["smoke", "all"], () => { | ||
context("REST Datasource Testing", () => { | ||
before(() => { | ||
cy.login() | ||
cy.createTestApp() | ||
}) | ||
|
||
const datasource = "REST" | ||
const restUrl = "https://api.openbrewerydb.org/breweries" | ||
|
||
it("Should add REST data source with incorrect API", () => { | ||
// Select REST data source | ||
cy.selectExternalDatasource(datasource) | ||
// Enter incorrect api & attempt to send query | ||
cy.wait(500) | ||
cy.get(".spectrum-Button").contains("Add query").click({ force: true }) | ||
cy.intercept("**/preview").as("queryError") | ||
cy.get("input").clear().type("random text") | ||
cy.get(".spectrum-Button").contains("Send").click({ force: true }) | ||
// Intercept Request after button click & apply assertions | ||
cy.wait("@queryError") | ||
cy.get("@queryError") | ||
.its("response.body") | ||
.should("have.property", "message", "Invalid URL: http://random text?") | ||
cy.get("@queryError") | ||
.its("response.body") | ||
.should("have.property", "status", 400) | ||
}) | ||
|
||
it("should add and configure a REST datasource", () => { | ||
// Select REST datasource and create query | ||
cy.selectExternalDatasource(datasource) | ||
cy.wait(500) | ||
// createRestQuery confirms query creation | ||
cy.createRestQuery("GET", restUrl, "/breweries") | ||
// Confirm status code response within REST datasource | ||
cy.get(".spectrum-FieldLabel") | ||
.contains("Status") | ||
.children() | ||
.should("contain", 200) | ||
}) | ||
}) | ||
}) |
154 changes: 89 additions & 65 deletions
154
packages/builder/cypress/integration/queryLevelTransformers.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters