Skip to content

Cancelled network requests fail to resolve with cy.wait #19326

@jeremydorne

Description

@jeremydorne

Current behavior

If a network request is aliased and the network request is cancelled by the browser, cy.wait will timeout waiting for the network request.

Desired behavior

cy.wait should complete with a failed network request and should convey that the request was cancelled.

Test code to reproduce

// Intercept an outbound request with `cy.intercept` and set it to an alias
cy.intercept("route-to-request", req => {
     req.id = "cancelled-request-id"
     req.reply()
}

// Redirect to a new page before the request resolves
cy.visit('http://localhost:3000/path-to-new-url')

// Wait for the cancelled request to resolve
cy.wait("@cancelled-request-id")

Cypress Version

9.1.1

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions