cypresse2e-testingtesting-librarycypress-testing-library

which version of @testing-library/cypress is compatible with cypress version 9.5.3?


I am trying to install @testing-library/cypress with cypress@9.5.3 already installed in my project.

It gives me a could not resolve dependency error. It expects cypress@^12.0.0

I cannot update the cypress dependency. How do I find the right @testing-library/cypress version for cypress@9.5.3 ?


Solution

  • v8.0.7 says the following in package.json:

    "peerDependencies": {
      "cypress": "^2.1.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0"
    },
    

    And it works with a simple test:

    import '@testing-library/cypress/add-commands'
    
    it('uses testing library to find heading', () => {
      cy.visit('http://example.com');
      cy.findByRole('heading')
        .should('have.text', 'Example Domain')
    })
    

    The next version is v9.0.0 which shows peer dependency of cypress@12.0.0, and crashes when used with cypress@9.5.3