cypress-network-idle VS Cypress

Compare cypress-network-idle vs Cypress and see what are their differences.

cypress-network-idle

A little Cypress.io plugin for waiting for network to be idle before continuing with the test (by bahmutov)
SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
cypress-network-idle Cypress
1 174
60 46,167
- 0.4%
8.5 9.8
9 days ago 2 days ago
JavaScript JavaScript
- MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

cypress-network-idle

Posts with mentions or reviews of cypress-network-idle. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-02-08.
  • Hasura E2E tests chronicles, February 2023
    2 projects | dev.to | 8 Feb 2023
    /** * Wait for a bunch of requests to be settled before proceeding with the test. * * Alternatively, https://github.com/bahmutov/cypress-network-idle could be used * * This is a workaround for "element is 'detached' from the DOM" Cypress' error (see the issue * linked below). Since the UI gets re-rendered because of the requests, this utility ensures that * all the requests parallelly made by the UI are settled before proceeding with the test. Hence, it * ensure the UI won't re-render during the next interaction. * * What are the requests that must be awaited? By looking at the Cypress Test Runner, they are the * following, made parallelly or in a rapid series. * 1. export_metadata * 2. export_metadata * 3. export_metadata * 4. test_webhook_transform * 5. test_webhook_transform * 6. test_webhook_transform * 7. test_webhook_transform * At the moment of writing, I'm not sure the number of requests are fixed or not. If they are fixed, * using the cy.intercept `times` options would result in a more expressive and less convoluted code. * * To give you an overall idea, this is a timeline of the requests * * all requests start all requests end * | | | | * |--πŸš¦πŸ”΄--1--2--3--4--5--6--7----------------------------1--2--3--4--5--6-7--🚦🟒--| * * * ATTENTION: Despite the defensive approach and the flakiness-removal purpose, this function could * introduced even more flakiness because of its empiric approach. In case of failures, it must be * carefully evaluated when/if keeping it or thinking about a better approach. * In general, this solution does not scale, it should not be spread among the tests. * * @see https://github.com/cypress-io/cypress/issues/7306 * @see https://glebbahmutov.com/blog/detached/ * @see https://github.com/bahmutov/cypress-network-idle */ import 'cypress-wait-until'; export function waitForPostCreationRequests() { let waitCompleted = false; cy.log('*--- All requests must be settled*'); const pendingRequests = new Map(); cy.intercept('POST', 'http://localhost:8080/v1/metadata', req => { if (waitCompleted) return; Cypress.log({ message: '*--- Request pending*' }); pendingRequests.set(req, true); req.continue(() => { Cypress.log({ message: '*--- Request settled*' }); pendingRequests.delete(req); }); }); Cypress.log({ message: '*--- Waiting for the first request to start*' }); // Check if at least one request has been caught. This check must protect from the following case // // check requests start test failure, the requests got the UI re-rendered // | | | // |--πŸš¦πŸ”΄----⚠️---🚦🟒-------1-2-3-4-5-6-7-1----------πŸ’₯ // // where checking that "there are no pending requests" falls in the false positive case where // there are no pending requests because no one started at all. // // The check runs every millisecond to be 100% sure that no request can escape (ex. because of a // super fast server). A false-negative case represented here // // requests start requests end check check test failure, no first request caught // | | | | | | | // |--πŸš¦πŸ”΄--1-2-3-4-5-6-7-1-2-3-4-5-6-7--⚠️------------------⚠️------------------πŸ’₯ cy.waitUntil(() => pendingRequests.size > 0, { timeout: 5000, // 5 seconds is the default Cypress wait for a request to start interval: 1, errorMsg: 'No first request caught', }); Cypress.log({ message: '*--- Waiting for all the requests to start*' }); // Let pass some time to collect all the requests. Otherwise, it could detect that the first // request complete and go on with the test, even if another one will be performed in a while. // // This fixed wait protects from the following timeline // // 1st request start first request end other requests start test failure, the requests got the UI re-rendered // | | | | // |--πŸš¦πŸ”΄---1---------------------1----🚦🟒----------------2-3-4-5-6-7-1----------πŸ’₯ // // Obviously, it is an empiric waiting, that also slows down the test. cy.wait(500); Cypress.log({ message: '*--- Waiting for all the requests to be settled*' }); cy.waitUntil(() => pendingRequests.size === 0, { timeout: 30000, // 30 seconds is the default Cypress wait for the request to complete errorMsg: 'Some requests are not settled yet', }).then(() => { waitCompleted = true; }); }

Cypress

Posts with mentions or reviews of Cypress. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-01-25.

What are some alternatives?

When comparing cypress-network-idle and Cypress you can also consider the following projects:

Playwright - Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

Detox - Gray box end-to-end testing and automation framework for mobile apps

jest - Delightful JavaScript Testing.

kafka-test-helper - Utility library that simplify testing of Node.js components that interacts with Kafka broker.

supertest - πŸ•· Super-agent driven library for testing node.js HTTP servers using a fluent API. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.

Sentry - Developer-first error tracking and performance monitoring

WebdriverIO - Next-gen browser and mobile automation test framework for Node.js

TestCafe - A Node.js tool to automate end-to-end web testing.

jasmine - Simple JavaScript testing framework for browsers and node.js

pactum - REST API Testing Tool for all levels in a Test Pyramid

Tailwind CSS - A utility-first CSS framework for rapid UI development.

puppeteer - Node.js API for Chrome