Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress stops execution (hangs) entering infinite loop on element focus within test #28746

Open
REZ-bdoty opened this issue Jan 18, 2024 · 8 comments
Labels
good first issue Good for newcomers stage: ready for work The issue is reproducible and in scope type: bug

Comments

@REZ-bdoty
Copy link

Current behavior

When running a test and interacting with elements in shadow dom Cypress will hang on execution.
In open mode this is hit or miss. Sometimes it will work. Other times it will stop execution.
Example
In headless mode this will happen every time (Debug.log is in attached project).

This happens in every browser.
This happens in Cypress 12.x and 13.x

Desired behavior

Cypress executes all tests in open and/or headless mode.

Test code to reproduce

Example project file has Readme.md.
Cypress-Bug.zip

Cypress Version

13.6.3

Node version

20.11.0

Operating System

Windows 10 22H2 (OS Build 19045.3803)

Debug Logs

cy_debug.log is in the attached project.

Other

IncludeShadowDom is set to true in cypress.config.ts.

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Jan 19, 2024

I've been looking at this. It appears there's a situation where an uncaught exception is thrown in an infinite loop. It does happen in 12.0 and 13.6.3, so doesn't appear to be a recent regression.

Thanks so much for the reproduction! I'm sure we'll be able to track something down.

http://g.recordit.co/gLqt05IQ0U.gif

@jennifer-shehane jennifer-shehane added the stage: ready for work The issue is reproducible and in scope label Jan 19, 2024
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Jan 19, 2024

Narrowed down the bug in this repo: https://github.com/jennifer-shehane/Cypress-Bug

Cypress gets stuck in a loop firing the focus event. You can add a debugger here and observe it: https://github.com/cypress-io/cypress/blob/bump-testing-library/packages/driver/src/cy/focused.ts#L47

@jennifer-shehane jennifer-shehane added the good first issue Good for newcomers label Jan 19, 2024
@jennifer-shehane jennifer-shehane changed the title Cypress stops execution (hangs) when using shadow. Cypress stops execution (hangs) entering infinite loop on focus Jan 19, 2024
@jennifer-shehane
Copy link
Member

@REZ-bdoty This infinite hanging happens whenever you click to focus on that 'URL' input. You could skip that action for now in your tests if you want to perform other tests outside of that focus/click behavior until a fix it out.

@jennifer-shehane jennifer-shehane changed the title Cypress stops execution (hangs) entering infinite loop on focus Cypress stops execution (hangs) entering infinite loop on element focus within test Jan 22, 2024
@DarienYang
Copy link

DarienYang commented Jan 23, 2024

Got similar issue here, we are using cypress 13.6.3 and chrome 120.
Every time when I click a dropdown to expand all the items it works fine, but when I try to click any dropdown item Cypress stoped respond and hangs infinitely.

The script works fine in cypress 12.17.1

image

@tiago80673
Copy link
Contributor

I'm trying to help/close this issue.

I found out @jennifer-shehane repo doesn't hang in headless mode with--browser firefox, but hangs with --browser electron.
Also, in open mode, it only hangs using electron. Firefox seems to be working ok.

Could it be related only to electron? Where should I start looking?

edit: Tried with latest version and it doesn't hang anymore, but a fix for the issue wasn't mentioned in the ChangeLog of any of the new versions. Maybe someone should investigate what changes between the versions might have resolved the issue.

@jennifer-shehane
Copy link
Member

I couldn't get the repro project to run anymore, it runs into an error.

If the error is not present on the most recent version of Cypress, we can close this.

@REZ-bdoty
Copy link
Author

I will see if the latest version fixes the issue in our main project.

To run the local server; change directory to WYSIWYG and run yarn dev before executing the cypress tests.

@REZ-bdoty
Copy link
Author

REZ-bdoty commented Apr 1, 2024

This continues to reproduce with versions 13.6.5, 13.6.6, and 13.7.0.
I am not able to verify 13.7.1 as this version introduces an issue where the Shadow DOM inputs lose focus before typing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers stage: ready for work The issue is reproducible and in scope type: bug
Projects
None yet
Development

No branches or pull requests

4 participants