cypress-testing-library icon indicating copy to clipboard operation
cypress-testing-library copied to clipboard

Cannot set property message of [object DOMException] which has only a getter

Open vaclavGabriel opened this issue 4 years ago • 11 comments

Versions:

  • cypress-testing-library version: 8.0.1
  • node version: 12.22.6
  • npm version: 6.14.15

What you did: I tried to get an element using the cy.findByRole command

What happened: TypeError: Cannot set property message of [object DOMException] which has only a getter

TypeError: Cannot set property message of [object DOMException] which has only a getter
    at modifyErrMsg (http://localhost:3002/__cypress/runner/cypress_runner.js:172545:15)
    at $Cy.retry (http://localhost:3002/__cypress/runner/cypress_runner.js:164808:33)
    at onFailFn (http://localhost:3002/__cypress/runner/cypress_runner.js:148305:21)
From previous event:
    at $Cy.verifyUpcomingAssertions (http://localhost:3002/__cypress/runner/cypress_runner.js:148312:105)
From previous event:
    at tryFn (http://localhost:3002/__cypress/runner/cypress_runner.js:165332:61)
    at whenStable (http://localhost:3002/__cypress/runner/cypress_runner.js:165371:14)
    at http://localhost:3002/__cypress/runner/cypress_runner.js:164858:18

image

Problem description: I am getting the error above when using findByRole from Cypress Testing Library

Suggested solution: Rollback to the version 7.0.7 helps

vaclavGabriel avatar Oct 29 '21 13:10 vaclavGabriel

any update on above issue ?

MAfzalKhan1997 avatar Nov 30 '21 14:11 MAfzalKhan1997

I'm having the same issue

MathiasCarranza04 avatar Jan 30 '22 21:01 MathiasCarranza04

same here 😢

nilesh-powar-InfoTrack avatar Feb 08 '22 05:02 nilesh-powar-InfoTrack

any solutions?

1986stas avatar Apr 12 '22 14:04 1986stas

seeing this as well when using react-app-rewired and craco with a create react app application. very strange.

schester44 avatar Jul 19 '22 18:07 schester44

I had the same issue. I rolled back to v7.0.7, which indeed solves it, but of course I'd rather use the latest version. It doesn't look like there's much developer activity here, though :(

RuudMeeuwsen avatar Jan 09 '23 13:01 RuudMeeuwsen

Same issue discovered with this Cypress version:

Cypress package version: 12.2.0 Cypress binary version: 12.2.0 Electron version: 21.0.0 Bundled Node version: 16.16.0

oussbenma avatar Jan 13 '23 15:01 oussbenma

Cypress 12.14.0 Node 16.20.1

Still encounter this issue today. so I removed all the test and found:

  1. describe('Description', () => {}) => this works fine
  2. describe('Description', () => { it('should works fine', () => {}) }) => this is failed with the above error

Still not sure what is blocking this test

darrylsepeda avatar Jul 31 '23 09:07 darrylsepeda

Having this issue in Firefox, but in Electron it works fine:

Cypress 12.17.4 Firefox 117.0.1 Electron 106

setage avatar Oct 03 '23 12:10 setage

Same issue when upgrading from @testing-library/react: 14.1.2 to higher.

Node 20.11 Cypress: 13.6.6 Typescript 5.2

JakubAdapt avatar Mar 08 '24 09:03 JakubAdapt