-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Slow Running tests when window doesn't have focus #1909
Comments
@jpetitcolas I was able to reproduce this by removing focus of the mouse from the test runner during a run. Notice the run will be fast as long as the mouse is over the window. Can you confirm this behavior, and see if you can reproduce on 2.1.0 ? |
confirmed bug on all cypress versions
|
We detected that the root cause has to do with a combination of things.
To fix this problem (and others) we need to make the sub focus/blur routes non-async (to the best of our ability) or add checks after async actions to take into account if the In the future, we should consider not actually polyfilling the |
I don't have a full reproduction case or anything ready, so sorry if this is polluting the issue but I will chime in with what I know. We have an issue on one of our repos at work with Cypress and Material-UI which results in erratic behavior when the test runner is not focused. Here is an edited excerpt from our internal report: tl;dr Description When I run cypress tests, it seems now to matter whether or not the Cypress window is focused/in the foreground. If I am on a single laptop screen and tab away from Cypress for too long, and the entire window is obscured/not visible, I start getting test failures. Versions used Steps to reproduce Comments It passed 34 times in a row. I focused away from cypress, then it started failing repeatedly. I wondered if it was because I pressed CMD+TAB, and accidentally sent a TAB command to the focused browser? No -- that wouldn't make subsequent tests fail. I feel like this has something to do with the behaviour of Chromium changing because the window isn't visible, i.e. a rendering optimization in Chromium (or macOS, or the display drivers) that interferes with Cypress' interaction, or maybe exposes a race condition that isn't normally there. Also, since I don't see it happen anywhere but on XXXXXX, maybe a hardware-accelerated animation in MaterialUI's CSS is somehow triggering this behaviour. This is way too vague to report to cypress for now, and I'd like to see if anyone else can reproduce it before going that far. |
@jbinto we're actually aware of the root issue and have already fixed it in a local branch. This will get released with the next patch update. |
…rom under Cypress when window is out of focus - refactored getting the current focused element to be synchronous - remove the special handling of force focused or force blurred element state - just always use AUT document.activeElement - clean up tests
Released in |
Could this issue be related with this? |
Not sure it it is a bug, or a misunderstanding from mine.
Current behavior:
When testing a MaterialUI component, I got some trouble with hot reloading. If I refresh my browser with
F5
, my code behaves correctly:Yet, if test is relaunched using hot reload, select list takes a long time before closing:
Desired behavior:
I would expect the behavior to be the same between fresh refresh or hot reload.
Steps to reproduce:
I created a repository to reproduce the issue: https://github.com/jpetitcolas/cypress-bug
Clone it, then launch the React app and open Cypress:
Then, comment or uncomment the following line to let browser to hot reload.
Versions
The text was updated successfully, but these errors were encountered: