TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published



Deprecation notice

Users have reported that in recent Cypress versions (v12+) requests are not being tracked.
I can confirm that is happening due to internal changes in Cypress behavior and some functionality that this plugin relies on was removed.
Thus I see no reason in re-developing it.
In case you consider migrating to Cypress v12+ please replace this plugin with cypress-network-idle which utilizes intercept functionality instead of internals and should work fine and cover your use case.


Plugin that adds cy.waitForNetwork command that ensures background network requests are finished You can also enable automatic waiting before every cy.get by setting env var waitForRequestsBeforeCyGet

Build Downloads semantic-release
version License


  • download package:

    • using yarn:
    yarn add -D @shelex/cypress-wait-network
    • using npm:
    npm i -D @shelex/cypress-wait-network
  • register command in cypress/support/index.js file:

    • with import:
    import '@shelex/cypress-wait-network';
    • or with require:
  • for IntelliSense (autocompletion) support in your IDE

    • add to your files:
    /// <reference types="@shelex/cypress-wait-network" />
    • or update your tsconfig.json include section:
    "include": [


Command cy.waitForNetwork accepts an options object with such properties:

property description default
timeout timeout for requests loading (ms) Cypress.config().responseTimeout (30s)
idle time to wait till network is recognized as idle (ms)* 1000 ms

* idle could be used to apply waiting strategy to your specific needs, as requests may be triggered after default idle is finished, usually caused by debouncing on front-end. By default command uses 1 second idle check which means in case there are no requests loading - it will wait minimum ~ 1s before finishing command, in case there are requests - it will reset timer until there would be at least 1 second when all responses are received, no other requests loading so we can treat network as idle.


Plugin is customizable via Cypress environment variables:

env variable name description default
waitForRequestsBeforeCyGet run waitForNetwork command before every cy.get false

This options could be passed:

  • via cypress.json

        "env": {
            "waitForRequestsBeforeCyGet": true
  • via command line: as Cypress environment variables are used please take into account that cli should have only one argument --env or -e, otherwise values will not be passed

    yarn cypress run --env waitForRequestsBeforeCyGet=true
    # for windows:
    yarn cypress run --env  "waitForRequestsBeforeCyGet=true","otherEnvVar=value"


Inspired by Gleb Bahmutov gleb.bahmutov@gmail.com who made cypress-network-idle plugin that has same purpose. Moreover command cy.waitForNetworkIdle(2000) from cypress-network-idle is quite same as cy.waitForNetwork({ idle: 2000 }) from this package, first is based on interception and counters, this package just checks requests and responses from cy.state


Copyright 2021-2023 Oleksandr Shevtsov ovr.shevtsov@gmail.com.
This project is licensed under the MIT License.



Package Sidebar


npm i @shelex/cypress-wait-network

Weekly Downloads






Unpacked Size

9.78 kB

Total Files


Last publish


  • shelex