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

Error message in cypress shows the whole DOM when an element is not found

Open misoguy opened this issue 8 years ago • 1 comments

  • dom-testing-library version: 3.12.3
  • cypress-testing-library version: 2.3.3
  • cypress version: 3.1.2

What you did:

Made a test fail to find an element with cy.getByText

What happened:

Error message is showing the whole DOM which clutters the log

Problem description:

It seems like there is a boolean check for cypress environment in the source code here but it's not working.

Suggested solution:

Changing this line to const inCypress = global.Cypress works on my local.

I'm not sure if this line worked before but window is undefined in cypress 3.1.2. Maybe cypress doesn't expose the window variable anymore.

I could change it to const inCypress = (typeof window !== 'undefined' && window.Cypress) || global.Cypress to keep it backward compatible.

I'll have a new PR addressing this issue with the above code changes if it was intended to hide the DOM for cypress environment.

misoguy avatar Nov 19 '18 22:11 misoguy

:tada: This issue has been resolved in version 3.12.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

kentcdodds avatar Nov 21 '18 16:11 kentcdodds