Skip to content

cy.route2 cannot wait on the stubbed request with forceNetworkError: true #9062

Closed
@bahmutov

Description

@bahmutov

I am trying to confirm that the application handles failed network Ajax calls

cy.visit('/')
cy.route2(url, { forceNetworkError: true }).as('users')
cy.get('#load-users').click()
cy.contains('#users', 'Problem fetching users Failed to fetch')

cy.wait('@users', { timeout: 1000 }) // the network call happens

The wait never resolves

forceNetworkError

Screenshot

Cypress v5.5.0 and develop at d12676c561fbd24a47ecd846a54cfe9042402dbe (which is AFTER fix: improve route2 logs commit)

Reproducible example in cypress-io/cypress-example-recipes#581

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