cypress-network-idle
Advanced tools
Comparing version 1.4.1 to 1.4.2
{ | ||
"name": "cypress-network-idle", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "A little Cypress.io plugin for waiting for network to be idle before continuing with the test", | ||
@@ -32,3 +32,3 @@ "main": "src/index.js", | ||
"devDependencies": { | ||
"cypress": "9.6.0", | ||
"cypress": "9.6.1", | ||
"micro": "^9.3.4", | ||
@@ -35,0 +35,0 @@ "micro-dev": "^3.0.0", |
@@ -1,2 +0,2 @@ | ||
# cypress-network-idle ![cypress version](https://img.shields.io/badge/cypress-9.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) | ||
# 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) | ||
> A little Cypress.io plugin for waiting for network to be idle before continuing with the test | ||
@@ -3,0 +3,0 @@ |
@@ -7,7 +7,9 @@ /// <reference types="cypress" /> | ||
cy.log(`network idle for ${timeLimitMs} ms`) | ||
cy.log(`network idle for ${timeLimitMs} ms (timeout: ${timeout} ms)`) | ||
cy.wrap('waiting...', { timeout }) | ||
.should(() => { | ||
const d = +new Date() | ||
const t = counters.lastNetworkAt || counters.started | ||
const elapsed = +new Date() - t | ||
const waited = d - counters.started | ||
const elapsed = d - t | ||
if (elapsed < timeLimitMs) { | ||
@@ -17,5 +19,5 @@ // console.log('t =', t) | ||
// console.log('timeLimitMs', timeLimitMs) | ||
throw new Error('Network is busy') | ||
throw new Error(`Network is busy. Failed after ${waited} ms`) | ||
} | ||
counters.finished = +new Date() | ||
counters.finished = d | ||
}) | ||
@@ -22,0 +24,0 @@ .then(() => { |
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
11206
171