cypress-network-idle
Advanced tools
Comparing version 1.7.0 to 1.8.0
{ | ||
"name": "cypress-network-idle", | ||
"version": "1.7.0", | ||
"version": "1.8.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": "9.6.1", | ||
"cypress": "9.7.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-9.6.1-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-9.7.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) | ||
@@ -3,0 +3,0 @@ > A little Cypress.io plugin for waiting for network to be idle before continuing with the test |
/// <reference types="cypress" /> | ||
const logPrefix = '**network-idle**' | ||
function waitForIdle(counters, timeLimitMs, timeout, interval) { | ||
@@ -7,4 +9,4 @@ counters.started = +new Date() | ||
cy.log(`network idle for ${timeLimitMs} ms (timeout: ${timeout} ms)`) | ||
cy.wrap('waiting...', { timeout }).should(check) | ||
cy.log(`${logPrefix} for ${timeLimitMs} ms (timeout: ${timeout} ms)`) | ||
cy.wrap(`${logPrefix} waiting...`, { timeout }).should(check) | ||
@@ -18,3 +20,3 @@ function check() { | ||
if (elapsed > timeLimitMs && !counters.currentCallCount) { | ||
cy.log(`finished after ${waited} ms`) | ||
cy.log(`${logPrefix} finished after ${waited} ms`) | ||
cy.wrap( | ||
@@ -29,7 +31,7 @@ { | ||
) | ||
return; | ||
return | ||
} | ||
if (waited > timeout) { | ||
throw new Error(`Network is busy. Failed after ${waited} ms`) | ||
throw new Error(`Network is busy. Failed after ${waited} ms`) | ||
} | ||
@@ -41,3 +43,9 @@ | ||
function waitForNetworkIdleImpl({ method, pattern, timeLimitMs, timeout, interval }) { | ||
function waitForNetworkIdleImpl({ | ||
method, | ||
pattern, | ||
timeLimitMs, | ||
timeout, | ||
interval, | ||
}) { | ||
const counters = { | ||
@@ -44,0 +52,0 @@ callCount: 0, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12573
197