Skip to content

cy.intercept delay is not always respected when >= 2^31 #33183

@tetslee

Description

@tetslee

Current behavior

When running something like:

cy.intercept('GET', '...url...', { fixture: 'response.json', delay: Number.MAX_SAFE_INTEGER }).as('request1');
// ...make request
cy.wait('@request1');
// ...if delay was respected this should take a million years to reach

the request will be resolved immediately. From testing the behaviour for delay >= 2^31 is the same as when delay = 0.

It seems to be an environment thing - the same test will always respect the delay on my pipeline (linux headless chrome), but never on my laptop (osx headless chrome).

Desired behavior

I doubt anyone needs delays that large, maybe it should throw an error instead of the chance that it will silently not respect the delay depending on your environment. Or just clamp the delay to within [0, 2^31) and show a warning in case of some weird usage that was relying on a bigger number.

Cypress Version

14.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions