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

Problem cancelling XHRs from previous test (bis) #19141

Closed
devfservant opened this issue Nov 29, 2021 · 12 comments
Closed

Problem cancelling XHRs from previous test (bis) #19141

devfservant opened this issue Nov 29, 2021 · 12 comments

Comments

@devfservant
Copy link

devfservant commented Nov 29, 2021

Current behavior

I have a file containing two tests:

describe('My page', () => {
  beforeEach(() => {
    cy.login();
    cy.visit('/#/new-receipt');
  });
  it('should display elements', () => {
    // some stuff
  });
  it('should complete some form', () => {
    // some other stuff
  });
});

But when my second test starts, some requests from the first test are not cancelled and are still running:

image

In my case, those are cross-origin requests and so it failed my test suite.

My workaround is:

  • either to add a cy.wait(1000) in a afterEach
  • or to use { chromeWebSecurity: false } in my cypress.json config

The fact that my tests pass with the cy.wait(1000) at the end of the first test highlights the problem.

Desired behavior

In this situation, I expect Cypress to start each test from a clean state.
Therefore, there should be no on-going request when launching a new test.

Test code to reproduce

see above

Cypress Version

9.3.1

Other

@JohnnyTheBoy
Copy link

just to confirm, it's the same on 9.1.1 version

@devfservant
Copy link
Author

just to confirm, it's the same on 9.1.1 version

Yes, I tested it too with the 9.1.1 version and the behaviour is the same. I'll update the description accordingly

@RiZKiT
Copy link

RiZKiT commented Jan 6, 2022

Might me related to #19039

@mjhenkes
Copy link
Member

@devfservant / @JohnnyTheBoy , could you try on version 9.2.0, we introduced some changes to our proxy server that may affect this issue. #19043

@devfservant
Copy link
Author

devfservant commented Jan 14, 2022

I'll test with the latest version of Cypress ASAP and will keep you up-to-date

@devfservant
Copy link
Author

I can confirm that the issue is still here. I did the test with the latest version of Cypress (9.3.1)

@jpaas
Copy link

jpaas commented May 7, 2022

Having the same issue on 9.6.0

@bluepioupiou
Copy link

bluepioupiou commented Feb 17, 2023

Exact same behavior here with version 9.7 and still in 12.6.0. Only the systematic cy.Wait() is working here and I think it's not a good practice. Does someone ca look at that or offer us some perspectives ?

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Aug 17, 2023
@devfservant
Copy link
Author

I am going to test with the latest Cypress version this week and will keep you inform quickly

@cypress-app-bot cypress-app-bot removed the stale no activity on this issue for a long period label Aug 30, 2023
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Dec 19, 2023

@devfservant Was this issue resolved? I would it would be in v12 since we clear the state between tests.

@jennifer-shehane jennifer-shehane added the stage: awaiting response Potential fix was proposed; awaiting response label Dec 19, 2023
@devfservant
Copy link
Author

After testing, I no longer observe the issue. It seems to have been fixed, thank you :)

@jennifer-shehane jennifer-shehane removed the stage: awaiting response Potential fix was proposed; awaiting response label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants