Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancelled XHR Stubbed Request still has loading indicator next to it #4130

Closed
nartc opened this issue May 5, 2019 · 5 comments

Comments

2 participants
@nartc
Copy link

commented May 5, 2019

Current behavior:

image

Desired behavior:

Cancelled request (by navigating away) should not have the loading indicator next to it,

Steps to reproduce: (app code and test code)

Versions

Cypress 3.2.0
Chrome on MacOS X

@jennifer-shehane

This comment has been minimized.

Copy link
Member

commented May 6, 2019

Hey @nartc, can you see the cancelled state of the XHR within the network panel of the devTools?

Can you provide any test code we can run to reproduce this state exactly?

@nartc

This comment has been minimized.

Copy link
Author

commented May 6, 2019

hi @jennifer-shehane , I can see the cancelled state of the XHR in the Network tab.

I noticed this behavior in a very specific OAuth Redirect environment but I'll see if I could come up with a reproducible repository :)

Thanks for checking in.

@nartc

This comment has been minimized.

Copy link
Author

commented May 6, 2019

https://github.com/nartc/cypress-cancelled-xhr

Above is the reproducible repo (it is Angular). Steps are as follow:

  1. Start server npm start
  2. Start Cypress npm run cypress-open
  3. Run the test.

Synopsis: On start, the app will redirect from / to /posts which will then render PostsComponent and will call JSON Placeholder's posts endpoint. To simulate some delay, I add 1s delay to the Http request. In the test, I visit the home route / then wait for 999ms then navigate to /todos route (which then renders TodosComponent and will call JSON Placeholder todos endpoint).

After the test has been finished, you can see the XHR Request for /posts still has a loading indicator next to it. Network tab shows the request has been cancelled due to navigating away.

Thanks

@jennifer-shehane

This comment has been minimized.

Copy link
Member

commented May 7, 2019

Thanks so much for providing this example. I do see the issue - that the loading indicator remains after the XHR request has been cancelled.

I thought this may be related to this change made in Chrome 71 - which we have already fixed and is pending release in version 3.3.0, since I tracked down this 'cancel' display to the 'window:onload' event - #3973

So I ran your repo through develop, which is our pre-3.3.0 release branch and it is indeed fixed already 🎉

The code for this is done in #3974, but this has yet to be released. We'll update this issue and reference the changelog when it's released.

@cypress-bot

This comment has been minimized.

Copy link

commented May 17, 2019

Released in 3.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.