@@ -1,4 +1,4 @@
|
|||||||
describe("Visit home", () => {
|
describe("Visit Home", () => {
|
||||||
it('Have a page title with "Postwoman"', () => {
|
it('Have a page title with "Postwoman"', () => {
|
||||||
cy.visit("/", { retryOnStatusCodeFailure: true })
|
cy.visit("/", { retryOnStatusCodeFailure: true })
|
||||||
.get("title")
|
.get("title")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
describe("Authentication", () => {
|
describe("Authentication", () => {
|
||||||
it(`Change default auth user and pass with url`, () => {
|
it(`Change default Auth username and password with URL`, () => {
|
||||||
cy.visit(`?&auth=Basic Auth&httpUser=foo&httpPassword=bar`, { retryOnStatusCodeFailure: true })
|
cy.visit(`?&auth=Basic Auth&httpUser=foo&httpPassword=bar`, { retryOnStatusCodeFailure: true })
|
||||||
.get('input[name="http_basic_user"]', { timeout: 500 })
|
.get('input[name="http_basic_user"]', { timeout: 500 })
|
||||||
.invoke("val")
|
.invoke("val")
|
||||||
@@ -14,7 +14,7 @@ describe("Authentication", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it("Enable user and pass at url with toggler", () => {
|
it("Enable username and password in URL with toggler", () => {
|
||||||
cy.visit("/", { retryOnStatusCodeFailure: true })
|
cy.visit("/", { retryOnStatusCodeFailure: true })
|
||||||
.get("#auth")
|
.get("#auth")
|
||||||
.select("Basic Auth")
|
.select("Basic Auth")
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
|
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()
|
||||||
|
.get("#response-details-wrapper", { timeout: 24000 })
|
||||||
|
.should("be.visible")
|
||||||
|
.should($wrapper => {
|
||||||
|
expect($wrapper).to.contain("Hello World")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe("Proxy disabled - local request", () => {
|
describe("Proxy disabled - local request", () => {
|
||||||
it("Change default url with query and make a request to local cat api", () => {
|
it("Change default URL with query and make a request to local Cat API", () => {
|
||||||
cy.seedAndVisit("catapi", "/?url=https://api.thecatapi.com&path=")
|
cy.seedAndVisit("catapi", "/?url=https://api.thecatapi.com&path=")
|
||||||
.get("#url")
|
.get("#url")
|
||||||
.then(el => expect(el.val() === "https://api.thecatapi.com").to.equal(true))
|
.then(el => expect(el.val() === "https://api.thecatapi.com").to.equal(true))
|
||||||
@@ -10,16 +23,3 @@ describe("Proxy disabled - local request", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("Proxy enabled - external request", () => {
|
|
||||||
it("Enable the proxy and make a request to the real cat api", () => {
|
|
||||||
cy.enableProxy("/?url=https://api.thecatapi.com&path=")
|
|
||||||
.get("#send")
|
|
||||||
.click()
|
|
||||||
.get("#response-details-wrapper", { timeout: 24000 })
|
|
||||||
.should("be.visible")
|
|
||||||
.should($wrapper => {
|
|
||||||
expect($wrapper).to.contain("The Cat API")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|||||||
Reference in New Issue
Block a user