2020-02-01 21:36:51 +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=')
|
2020-02-24 18:44:50 +00:00
|
|
|
.get('#url')
|
|
|
|
|
.then(el => expect(el.val() === 'https://api.thecatapi.com').to.equal(true))
|
|
|
|
|
.get('#path')
|
|
|
|
|
.then(el => expect(el.val() === '').to.equal(true))
|
|
|
|
|
.get('#response-details-wrapper')
|
|
|
|
|
.should($wrapper => {
|
2020-02-01 21:36:51 +00:00
|
|
|
expect($wrapper).to.contain('FAKE Cat API')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
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=')
|
2020-02-24 18:44:50 +00:00
|
|
|
.get('#send')
|
|
|
|
|
.click()
|
|
|
|
|
.get('#response-details-wrapper')
|
|
|
|
|
.should($wrapper => {
|
2020-02-01 21:36:51 +00:00
|
|
|
expect($wrapper).to.contain('Cat API')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|