question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Cypress hangs when detecting element visibility with Shadow DOM enabled

See original GitHub issue

Current behavior:

It is the same or similar as #7679 (fixed in #7692), except this is with experimentalShadowDomSupport: true and using Ionic (which heavily uses Shadow DOM).

Essentially when Cypress attempts to detect visibility of an Ionic component where there’s a modal backdrop visible, it seems to go into an endless loop of that same find element code path.

Note: Also, notice how it thinks the ion-button is invisible. I think this is a separate regression/issue because I’ve seen this in other tests for Ionic popovers/toasts where it thinks it’s not visible when they really are.

Desired behavior:

Interacting with Ionic components shouldn’t cause Cypress to hang.

I think that while loop may be due for a “max loop” check because it seems like we really don’t want Cypress to totally hang under any circumstances. For example, this bug is causing my CI to generate 7GB video files, unless I force-stop the build/workflow.

Test code to reproduce

https://github.com/kamranayub/junk-bug-cypress-ionic-hang

  1. npm install
  2. npm run cypress:open
  3. Run the spec
  4. Notice how Cypress hangs when the popover is shown

It tests against this URL: https://ionic-react-demo.stackblitz.io/app/account and clicks the top right button, then tries to detect visibility.

Versions

  • Cypress 4.9.0
  • Chrome 83
  • Windows 10

Workaround

I think I can safely disable the experiment and rewrite my tests that were using .shadow(). 4.7.0 works with the experiment disabled. 4.8.0 had the other regression with clicking specifically.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jennifer-shehanecommented, Jun 24, 2020

@kamranayub Thanks for providing a reproducible example!

I can recreate this from the code provided below (or repo above).

  • 4.9.0: cy.get() hangs when experimentalShadowDomSupport is true
  • 4.9.0: cy.get() does not hang when experimentalShadowDomSupport is false
  • 4.8.0: cy.get() hangs when experimentalShadowDomSupport is false or true
  • 4.7.0: cy.get() never hangs

cypress.json

{
  "experimentalShadowDomSupport": true
}
it('works', () => {
  cy.visit('https://ionic-react-demo.stackblitz.io/app/account');
  // wait for StackBlitz to boot up server
  cy.get('ion-button', { timeout: 60 * 1000 }).click()
  cy.get('ion-popover').should('be.visible')
})

0reactions
cypress-bot[bot]commented, Jul 7, 2020

Released in 4.10.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v4.10.0, please open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debug the Element Visibility Problems in Cypress
Tip: to stop debugging the visibility function execute undebug(Cypress. dom. isVisible) in the DevTools console.
Read more >
Changelog - Cypress Documentation
Whether enabled or disabled, this changes how Cypress cleans up the browser context before each test and you may experience test errors with...
Read more >
Unable to get the element from shadow dom using Cypress
I have been trying to fill a login page using Cypress and the fields are listed under a shadow DOM. I can get...
Read more >
Swiper Changelog
Bug Fixes. core: animate preloader in visible slides if watchSlidesProgress is enabled (8174b5a); core: more checks for when swiper is destroyed (de47f09), ...
Read more >
prefers-reduced-motion - CSS: Cascading Style Sheets | MDN
The prefers-reduced-motion CSS media feature is used to detect if the user has requested that the system minimize the amount of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found