Initial prettier formatted files
This commit is contained in:
@@ -1 +1 @@
|
||||
{ "message": "FAKE Cat API" }
|
||||
{ "message": "FAKE Cat API" }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
describe('Visit home', () => {
|
||||
it('Have a page title with "Postwoman"', () => {
|
||||
cy.visit('/', { retryOnStatusCodeFailure: true })
|
||||
.get('title')
|
||||
.should('contain','Postwoman')
|
||||
.get('title')
|
||||
.should('contain', 'Postwoman')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,13 +3,13 @@ describe('Authentication', () => {
|
||||
cy.visit(`?&auth=Basic Auth&httpUser=foo&httpPassword=bar`, { retryOnStatusCodeFailure: true })
|
||||
.get('input[name="http_basic_user"]', { timeout: 500 })
|
||||
.invoke('val')
|
||||
.then((user) => {
|
||||
.then(user => {
|
||||
expect(user === 'foo').to.equal(true)
|
||||
})
|
||||
|
||||
.get('input[name="http_basic_passwd"]')
|
||||
.invoke('val')
|
||||
.then((pass) => {
|
||||
.then(pass => {
|
||||
expect(pass === 'bar').to.equal(true)
|
||||
})
|
||||
})
|
||||
@@ -30,5 +30,5 @@ describe('Authentication', () => {
|
||||
.url()
|
||||
.should('contain', 'foo')
|
||||
.should('contain', 'bar')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
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("#path").then((el) => expect(el.val() === '').to.equal(true))
|
||||
.get('#response-details-wrapper').should($wrapper => {
|
||||
.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 => {
|
||||
expect($wrapper).to.contain('FAKE Cat API')
|
||||
})
|
||||
})
|
||||
@@ -12,8 +15,10 @@ 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').should($wrapper => {
|
||||
.get('#send')
|
||||
.click()
|
||||
.get('#response-details-wrapper')
|
||||
.should($wrapper => {
|
||||
expect($wrapper).to.contain('Cat API')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,29 +1,31 @@
|
||||
/**
|
||||
* Creates cy.seedAndVisit() function
|
||||
* This function will go to some path and wait for some fake response from 'src/tests/fixtures/*.json'
|
||||
* @param { String } seedData The name of json at 'src/tests/fixtures/
|
||||
* @param { String } path The path or query parameters to go -ex. '/?path=/api/users'
|
||||
* @param { String } method The fake request method
|
||||
*/
|
||||
* Creates cy.seedAndVisit() function
|
||||
* This function will go to some path and wait for some fake response from 'src/tests/fixtures/*.json'
|
||||
* @param { String } seedData The name of json at 'src/tests/fixtures/
|
||||
* @param { String } path The path or query parameters to go -ex. '/?path=/api/users'
|
||||
* @param { String } method The fake request method
|
||||
*/
|
||||
Cypress.Commands.add('seedAndVisit', (seedData, path = '/', method = 'GET') => {
|
||||
cy.server()
|
||||
.route(method, 'https://api.thecatapi.com/', `fixture:${seedData}`).as('load')
|
||||
.route(method, 'https://api.thecatapi.com/', `fixture:${seedData}`)
|
||||
.as('load')
|
||||
|
||||
cy.visit(path)
|
||||
.get('#send').click()
|
||||
.wait('@load')
|
||||
.get('#send')
|
||||
.click()
|
||||
.wait('@load')
|
||||
})
|
||||
|
||||
/**
|
||||
* Creates cy.enableProxy() function
|
||||
* This function will enable the proxy and navigate back to a given path
|
||||
* @param { String } goBackPath The page go back
|
||||
*/
|
||||
Cypress.Commands.add('enableProxy', (goBackPath) => {
|
||||
* Creates cy.enableProxy() function
|
||||
* This function will enable the proxy and navigate back to a given path
|
||||
* @param { String } goBackPath The page go back
|
||||
*/
|
||||
Cypress.Commands.add('enableProxy', goBackPath => {
|
||||
cy.visit('/settings')
|
||||
.get('#proxy')
|
||||
.find('.toggle')
|
||||
.click( { force: true } )
|
||||
.click({ force: true })
|
||||
.should('have.class', 'on')
|
||||
.visit(goBackPath)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1 +1 @@
|
||||
import './commands'
|
||||
import './commands'
|
||||
|
||||
Reference in New Issue
Block a user