Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cypress-network-idle

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-network-idle - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "cypress-network-idle",
"version": "1.1.0",
"version": "1.1.1",
"description": "A little Cypress.io plugin for waiting for network to be idle before continuing with the test",

@@ -5,0 +5,0 @@ "main": "src/index.js",

# cypress-network-idle ![cypress version](https://img.shields.io/badge/cypress-8.6.0-brightgreen) [![renovate-app badge][renovate-badge]][renovate-app] [![ci](https://github.com/bahmutov/cypress-network-idle/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bahmutov/cypress-network-idle/actions/workflows/ci.yml)
> A little Cypress.io plugin for waiting for network to be idle before continuing with the test
## Videos
- [Cypress-network-idle plugin](https://youtu.be/adHjTf5j6uE)
## Install
```
# install using NPM
npm i -D cypress-network-idle
# install using Yarn
yarn add -D cypress-network-idle
```
Import or require this plugin from the support file or from the spec file
```js
import 'cypress-network-idle'
```
## Use
Wait for two seconds to pass without any network calls (Ajax, static resources)
```js
cy.waitForNetworkIdle(2000)
```
Wait one second without any calls to `/v1/api` endpoint
```js
cy.waitForNetworkIdle('/v1/api', 1000)
```
Wait for 5 seconds without any `POST` calls to `/graphql` endpoint
```js
cy.waitForNetworkIdle('POST', '/graphql', 5000)
```
## Yields
The command yields an object with a few timestamps and the number of network calls. See the [src/index.d.ts](./src/index.d.ts) for precise fields
```js
cy.waitForNetworkIdle(2000)
// check how long the command waited
.its('waited')
// it should have waited for at least 2 seconds
// but could be up to 3 seconds if the app
// made a call one second after the start
.should('be.within', 2000, 3000)
```
## Types
This plugin includes the TypeScript types, import them from your JavaScript files using the reference types comment or via TS config.
```js
/// <reference types="cypress-network-idle" />
```
## Small print

@@ -5,0 +66,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc