Skip to content

Problem cancelling XHRs from previous test #761

@AshMcConnell

Description

@AshMcConnell

Current behavior:

Yep, there is an issue if you don't wait for all XHRs to finish after a test. When it tries to cancel the XHR it fails with the error: -

UnsubscriptionError: 1 errors occurred during unsubscription:
  1) TypeError: Cannot set property 'aborted' of undefined

if I do an explicit cy.wait(2000) or cy.wait('@myxhr') it works
note it's the following test that fails, not the one with the XHR

Desired behavior:

The XHR should be cancelled correctly before the next test starts

How to reproduce:

Have a longish running XHR fire at the end of one test and have a subsequent test.

Additional Info (images, stack traces, etc)

It seems to happen when I am faking a route failure (status 500) and then make another (non-faked) XHR (to report the error to a server). e.g.: -

cy.route({
  method: 'PUT',
  url: '/Endpoint/Id',
  status: 500,
  response: ''
}).as('saveStuff');
  • Operating System: Ubuntu 16.04
  • Cypress Version: 1.0.2
  • Browser Version: Electron 53

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions