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

Cypress test errors after upgraing to 9.0.0 and using testIsolation: false #248

Closed
jazpearson opened this issue Dec 14, 2022 · 10 comments
Closed

Comments

@jazpearson
Copy link

jazpearson commented Dec 14, 2022

I'm not entirely sure how to report this will enough since i'm under NDA, but i was on the latest v8 and just upgraded to the latest (9.0.0). Cypress version is 12.1.0. Everything working as expected with v8, but i noticed v9 was out and supported Cypress v12, so thought i'd give it a go and i just wanted to report the issues in case it helps. I'm sorry that i can't give anything reproducible just yet, but if i get chance, i will.

This is a FANTASTIC library by the way.

Possibly an important point is that we are using { testIsolation: false } in our tests?

  • cypress-testing-library version: 9.0.0
  • node version: 16.17.0
  • npm (or yarn) version: 8.15.0

Relevant code or config

Examples that seem to be an issue have included these two commands. That doesn't mean that each time we call the commands they fail. It looks like they work ok in one test, but then in a following test (part of the same test suite) and not in isolation, the same call errors, as shown in the screenshot.

cy.findByRole('navigation', { name: /^(?!config-navigation|breadcrumb)/ });
cy.findbyrole('button', { name: 'add' }).click();

and our tests are scaffolded like this


description('testing feature a', { testIsolation: false }, () => {

   test('should do this', () => {

   });   

  test('should also do this', () => {
  
  });
   
});

What you did:

Upgraded to the latest version of the library

What happened:

image

Reproduction repository:

Problem description:

Suggested solution:

@ddrakeatside
Copy link

Also have same issue -- occurred after setting e2e.testIsolation to false.

image

@NicholasBoll
Copy link
Contributor

Looking at the source code compared to the dist code, I don't see an immediate problem. My guess based on the error is the this keyword not being defined in a specific context. It passed tests, meaning the non-transformed code passed.

Is this error while running Chrome, Firefox, or Electron?

@jazpearson
Copy link
Author

The error reported was originally in Chrome, but i tested in Firefox and Electron was able to reproduce there, too.

@jazpearson jazpearson changed the title Cypress test errors after upgraing to 9.0.0 Cypress test errors after upgraing to 9.0.0 and using testIsolation: false Dec 15, 2022
@matt-vendia
Copy link

I'm getting the same error - I patched the lib locally with the following change and no more errors:

// type: this.get('prev').get('chainerId') === this.get('chainerId') ? 'child' : 'parent',
type: this.get('prev') && this.get('prev').get('chainerId') === this.get('chainerId') ? 'child' : 'parent',

@tgdevereux
Copy link

I'm hitting this issue also, after upgrading to Cypress 12.3.0, and setting testIsolation to false (patching the lib locally like Matt suggested above in 'testing-library/cypress/dist/index.js:41:1' did address the error)

@GiovaniBiagi
Copy link

Having the same issues here! If anyone has a workaround that they can share, I'd appreciate it.

@GiovaniBiagi
Copy link

Updating, downgrading version to 8.0.0 solved my problem

@solita-thaan
Copy link

Also running into this same issue when upgrading to 9.0.0

@JamyGolden
Copy link
Contributor

JamyGolden commented Jul 13, 2023

I'm busy adding "cypress/testing-library" to an existing project and I've run into this issue too. Things work fine inside a single it test function, but as soon as I have a second it, I get this error.

Using:

  • testing-library/cypress version 9.0.0
  • cypress version 12.7.1

@leonardobumbeers
Copy link

It's been fixed on cypress-testing-library v10.0.1 🎉
https://github.com/testing-library/cypress-testing-library/releases/tag/v10.0.1

@jazpearson We can close this issue!

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

9 participants