Skip to content

Latest commit

 

History

History
35 lines (29 loc) · 1.12 KB

README.md

File metadata and controls

35 lines (29 loc) · 1.12 KB

cy-intercept-example

Cypress v6 network examples using cy.intercept

npm install
npx cypress open

See more information at:

Watch the video of the introduction at https://youtu.be/_wfKbYQlP_Y

See cypress/integration/spec.js, here is a fragment that stubs Ajax call to external domain to fetch three users:

// https://on.cypress.io/intercept
cy.intercept({
  pathname: '/users',
  query: {
    _limit: '3'
  }
}, {
    fixture: 'users.json',
    headers: {
      'Access-Control-Allow-Origin': '*'
    }
}).as('users')

cy.get('#load-users').click()
cy.wait('@users')