Skip to content
Unofficial Cypress utilities for tracking network state
Branch: master
Clone or download
Latest commit 6f92628 Jun 4, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Retagged Jun 4, 2019
cypress Added basic cypress tests Jun 3, 2019
.eslintrc Initial Commit Feb 8, 2019
.gitignore Base CCI setup Jun 3, 2019
LICENSE Initial Commit Feb 8, 2019
README.md Fixed namespaces and package Feb 8, 2019
await.d.ts Fixed namespaces and package Feb 8, 2019
await.js Fixed namespaces and package Feb 8, 2019
cypress.json Added basic cypress tests Jun 3, 2019
index.js Updated to be self-configuring Feb 8, 2019
package-lock.json Base CCI setup Jun 3, 2019
package.json v1.0.1 Jun 4, 2019

README.md

@rckeller/cypress-react

Unofficial Cypress utilities for tracking network state

npm i -D @rckeller/cypress-unfetch

Configuration

These utilities automatically configure your cypress instance upon import.

// support/index.js
import '@rckeller/cypress-unfetch'

We recommmend setting up the optional cy.await command, which tracks in-flight requests in the background. You can use this to wait for network state to resolve before progressing to a new test run.

// support/index.js
import '@rckeller/cypress-unfetch/await'

// You can add an afterEach to this file, which becomes "global"
afterEach(() => {
  cy.await()
})

Registering cy.await starts a server in the background, which can be used to track and block specific routes like so.

// in support/index.js OR a test
beforeEach(() => {
  cy.route('/api/**').as('API')
})

test('something', () => {
  cy.log('before...')
    .wait('@API')
    .log('...after')
})
You can’t perform that action at this time.