api-client/tests/e2e/integration/proxy.spec.js

26 lines
891 B
JavaScript
Raw Normal View History

2020-03-12 17:19:43 +00:00
describe("Proxy enabled - external request", () => {
it("Enable proxy and make a GET request to Postwoman API", () => {
cy.enableProxy("/?url=https://postwoman.io&path=/.netlify/functions/api")
.get("#send")
.click()
2020-03-12 16:58:25 +00:00
.get("#response-details-wrapper", { timeout: 24000 })
2020-02-28 05:07:54 +00:00
.should("be.visible")
.should($wrapper => {
2020-03-12 17:19:43 +00:00
expect($wrapper).to.contain("Hello World")
})
})
})
2020-03-12 17:19:43 +00:00
describe("Proxy disabled - local request", () => {
it("Change default URL with query and make a request to local Cat API", () => {
cy.seedAndVisit("catapi", "/?url=https://api.thecatapi.com&path=")
.get("#url")
.then(el => expect(el.val() === "https://api.thecatapi.com").to.equal(true))
.get("#response-details-wrapper")
2020-02-28 05:07:54 +00:00
.should("be.visible")
2020-02-25 13:33:07 +00:00
.should($wrapper => {
2020-03-12 17:19:43 +00:00
expect($wrapper).to.contain("FAKE Cat API")
})
})
})