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.10.2 to 1.11.0

4

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

@@ -34,3 +34,3 @@ "main": "src/index.js",

"devDependencies": {
"cypress": "10.10.0",
"cypress": "10.11.0",
"micro": "^9.3.4",

@@ -37,0 +37,0 @@ "micro-dev": "^3.0.0",

@@ -1,2 +0,2 @@

# cypress-network-idle ![cypress version](https://img.shields.io/badge/cypress-10.10.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)
# cypress-network-idle ![cypress version](https://img.shields.io/badge/cypress-10.11.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)

@@ -109,2 +109,26 @@ > A little Cypress.io plugin for waiting for network to be idle before continuing with the test

## Multiple registrations
If you try to register the same intercept method, pattern, and alias multiple times, only a single first registration will be made.
```js
cy.waitForNetworkIdlePrepare({
method: 'GET',
pattern: '/user',
alias: 'user',
})
// this registration will be ignored
cy.waitForNetworkIdlePrepare({
method: 'GET',
pattern: '/user',
alias: 'user',
})
// this registration will be ignored
cy.waitForNetworkIdlePrepare({
method: 'GET',
pattern: '/user',
alias: 'user',
})
```
## Pending calls

@@ -111,0 +135,0 @@

@@ -179,2 +179,13 @@ /// <reference types="cypress" />

const key = `networkIdleCounters_${alias}`
// check if the intercept has already been set
if (Cypress.env(key)) {
const registered = Cypress.env(key)
if (registered.method === method && registered.pattern === pattern) {
// the same intercept has already been registered
// so we should not register the same intercept again
return
}
}
const counters = {

@@ -187,6 +198,8 @@ // all network calls started after we start waiting

log,
method,
pattern,
}
Cypress.env(`networkIdleCounters_${alias}`, counters)
Cypress.env(key, counters)
cy.intercept({ method: method, url: pattern }, (req) => {
cy.intercept({ method, url: pattern }, (req) => {
counters.callCount += 1

@@ -193,0 +206,0 @@ counters.currentCallCount += 1

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