Commit code with double quotes instead of single quotes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
describe('Visit home', () => {
|
||||
describe("Visit home", () => {
|
||||
it('Have a page title with "Postwoman"', () => {
|
||||
cy.visit('/', { retryOnStatusCodeFailure: true })
|
||||
.get('title')
|
||||
.should('contain', 'Postwoman')
|
||||
cy.visit("/", { retryOnStatusCodeFailure: true })
|
||||
.get("title")
|
||||
.should("contain", "Postwoman")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
describe('Authentication', () => {
|
||||
describe("Authentication", () => {
|
||||
it(`Change default auth user and pass with url`, () => {
|
||||
cy.visit(`?&auth=Basic Auth&httpUser=foo&httpPassword=bar`, { retryOnStatusCodeFailure: true })
|
||||
.get('input[name="http_basic_user"]', { timeout: 500 })
|
||||
.invoke('val')
|
||||
.invoke("val")
|
||||
.then(user => {
|
||||
expect(user === 'foo').to.equal(true)
|
||||
expect(user === "foo").to.equal(true)
|
||||
})
|
||||
|
||||
.get('input[name="http_basic_passwd"]')
|
||||
.invoke('val')
|
||||
.invoke("val")
|
||||
.then(pass => {
|
||||
expect(pass === 'bar').to.equal(true)
|
||||
expect(pass === "bar").to.equal(true)
|
||||
})
|
||||
})
|
||||
|
||||
it('Enable user and pass at url with toggler', () => {
|
||||
cy.visit('/', { retryOnStatusCodeFailure: true })
|
||||
.get('#auth')
|
||||
.select('Basic Auth')
|
||||
it("Enable user and pass at url with toggler", () => {
|
||||
cy.visit("/", { retryOnStatusCodeFailure: true })
|
||||
.get("#auth")
|
||||
.select("Basic Auth")
|
||||
.get('input[name="http_basic_user"]', { timeout: 500 })
|
||||
.type('foo')
|
||||
.type("foo")
|
||||
.get('input[name="http_basic_passwd"]', { timeout: 500 })
|
||||
.type('bar')
|
||||
.type("bar")
|
||||
.url()
|
||||
.should('not.contain', 'foo')
|
||||
.should('not.contain', 'bar')
|
||||
.get('.toggle')
|
||||
.should("not.contain", "foo")
|
||||
.should("not.contain", "bar")
|
||||
.get(".toggle")
|
||||
.click()
|
||||
.url()
|
||||
.should('contain', 'foo')
|
||||
.should('contain', 'bar')
|
||||
.should("contain", "foo")
|
||||
.should("contain", "bar")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
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')
|
||||
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 => {
|
||||
expect($wrapper).to.contain('FAKE Cat API')
|
||||
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=')
|
||||
.get('#send')
|
||||
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')
|
||||
.get("#response-details-wrapper")
|
||||
.should($wrapper => {
|
||||
expect($wrapper).to.contain('Cat API')
|
||||
expect($wrapper).to.contain("Cat API")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
* @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') => {
|
||||
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')
|
||||
.get("#send")
|
||||
.click()
|
||||
.wait('@load')
|
||||
.wait("@load")
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -21,11 +21,11 @@ Cypress.Commands.add('seedAndVisit', (seedData, path = '/', method = 'GET') => {
|
||||
* 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')
|
||||
Cypress.Commands.add("enableProxy", goBackPath => {
|
||||
cy.visit("/settings")
|
||||
.get("#proxy")
|
||||
.find(".toggle")
|
||||
.click({ force: true })
|
||||
.should('have.class', 'on')
|
||||
.should("have.class", "on")
|
||||
.visit(goBackPath)
|
||||
})
|
||||
|
||||
@@ -1 +1 @@
|
||||
import './commands'
|
||||
import "./commands"
|
||||
|
||||
Reference in New Issue
Block a user