cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.85k stars 3.17k forks source link

ResizeObserver Error only occurs when using webpage in Cypress #20341

Open lmiller1990 opened 2 years ago

lmiller1990 commented 2 years ago

Current behavior

Some components (for CT) and websites (for E2E) throw a ResizeObserver error when visited/mounted in Cypress' AUT, but not when accessed regularly. This seems to be a Chrome specific issue. Sometimes, this causes my test to fail when running in Cypress.

This now-closed PR contains more info about the error and some discussion.

Desired behavior

Do not error in Cypress.

Test code to reproduce

https://github.com/lmiller1990/resize-observer-error

See README.md for details. This is an example using Cypress 9.x. Same error in CT and E2E.

Cypress Version

9.x, probably older

Other

Google "ResizeObserver Cypress", this issue has been around for a long time, at least since 4.x.

iomedico-beyer commented 1 year ago

I use this workaround for now, but is there any way to silence the message completely (until investigated/resolved)? It kind of polutes the output/videos.

codaDevDan commented 1 year ago

I get this only when using electron in run mode (cypress run). Many of the threads on this topic suggest some variation of this workaround:

Cypress.on('uncaught:exception', err => !err.message.includes('ResizeObserver loop limit exceeded')).

They do not seem to have any effect. To be clear, this error never happens in 'open' mode or when using our webapp. It also does not happen when using cypress run -b chrome, in which case the tests pass.