cypress icon indicating copy to clipboard operation
cypress copied to clipboard

Auto scroll is turned off sometimes

Open bukharov opened this issue 3 years ago • 24 comments

Current behavior

As you can see in the video below, auto scroll turns off at 27s mark and then stays off for the rest of the spec:

https://user-images.githubusercontent.com/49371/115434222-74d32500-a1d6-11eb-9f63-6b0037c46cff.mp4

It's not consistent, it happened locally more often than in CI, but the recording above is from CI.

Desired behavior

I'd like it to stay on, as there's no way to see the commands without it.

Versions

Cypress 7.1.0

bukharov avatar Apr 20 '21 16:04 bukharov

That's pretty weird. I don't see where this code would have been updated at all recently, so I don't think this would be a regression. Also it seems like in the code that this should only toggle if you click on it?

Providing a way to reproduce this reliably would be helpful, without that this will be pretty difficult to track down.

jennifer-shehane avatar Apr 21 '21 18:04 jennifer-shehane

It's in CI so no one clicked on it :trollface:

bukharov avatar Apr 21 '21 19:04 bukharov

I've noticed this as well during recordings from our test runs in CI. It's making it difficult (if not impossible) to really tell what's going on the video because the command log doesn't scroll and so we can't see what command is being executed at the time of failure.

EDIT: I guess I should also say that we are using Cypress 7.2.0.

todd-m-kemp avatar Apr 30 '21 18:04 todd-m-kemp

I have seen the same behavior on our CI also and we use cypress 8.7.0 on Gitlab. It's not happening to all tests runs but this is an example and I cannot reproduce it locally :

https://user-images.githubusercontent.com/15849558/151545305-a6a41337-70ff-468a-b8e5-fa021ebc6769.mov

This is the reason that we add this plugin to see what's going on when a test fails: https://github.com/bahmutov/cypress-failed-log

Can we ensure somehow this scrollbar tries always to go to the bottom? Is there any test for that?

jpourdanis avatar Jan 28 '22 12:01 jpourdanis

After upgrading to cypress 9.4.1 we still see this behavior on Gitlab Pipelines

jpourdanis avatar Feb 14 '22 13:02 jpourdanis

We do indeed have extensive tests around the scrolling behavior, and as noted, this isn't something we've seen in cypress' own tests. Which isn't to say that your issue isn't real, just that without a publicly visible case demonstrating it, we're pretty limited in our ability to figure out what's going on.

If you can reproduce the behavior in a public repo, I'm definitely willing to spend some time looking into it.

BlueWinds avatar Feb 17 '22 17:02 BlueWinds

I'm seeing this happen regularly in our CI tests, which makes the screenshots and videos useless. We're on Cypress 9.5 in Gitlab, though I see the behavior in Jenkins as well. We use 'npx cypress run' with Electron.

Elli143 avatar Mar 30 '22 20:03 Elli143

I'm watching the behavior of the scroll across our different tests, and one thing that I notice is that it seems to freeze when there are several requests being made at once, especially if they are resolving at different times, and particularly if there are enough requests that either the lagging request (above) or the new one (below) scrolls out of view for a moment.

I'm looking at the video that jpourdanis posted and the same behavior seems to occur in his video - the scroll stops immediately after several requests at once suddenly push the remaining tests out of view.

I can confirm it is not related to test order or number of tests in a file (so whether there are tests shown below the logs does not matter, I've seen it happen on the first and last tests and when there is only one test in the spec file).

Elli143 avatar Mar 30 '22 23:03 Elli143

Also seeing it with same context. I posted this in issue https://github.com/cypress-io/cypress/issues/8646 a few weeks ago.

Hi, This behavior also happens in our environment. We are using cypress 9.3.1 with cypress-cucumber-preprocessor. It happens with cypress open and cypress run. It also happens on our CI/CD pipeline which is a problem because we can't rely on the screenshot or the video to troubleshoot because it doesn't show the error which is at the end of the scroll. I tried to make a video of it. I have it available if you want. It is weird because it appears to happen at the same place in a test, but it does not happen on every run. In the video I recorded, it seems to happen right after a page load when there are a lot of backend requests. I ran it with a spec file where only one test runs and it happens approx 2 times out of 3. I don't understand the used case where one would like the cypress command log to not auto-scroll. Maybe this toggle should be removed along with the feature.

dlabrecque-uzinakod avatar Mar 31 '22 00:03 dlabrecque-uzinakod

I agree with @dlabrecque-uzinakod. How useful is this feature? Perhaps the fix to this issue is to remove the feature completely?

bukharov avatar Mar 31 '22 12:03 bukharov

The reason we have this feature is for users reviewing video artifacts in CI to debug what happened in a failing test. It makes a lot of sense for those workflows. I have a 100% reproduction with this repository https://github.com/JessicaSachs/rune-scrape

Video here: https://www.loom.com/share/61ff11e54ae6457c93b8d2191aa31b65 best listened to at 1.5x 🐢

JessicaSachs avatar Apr 04 '22 20:04 JessicaSachs

@JessicaSachs I understand, but what would be the use case for disabling auto scroll? I suppose my comment's a bit ambiguous. The suggestion was to remove the toggle and keep in always on.

bukharov avatar Apr 05 '22 00:04 bukharov

Thanks @JessicaSachs for the video. If the scroll bar for the commands log even slightly moves away from the bottom while auto-scrolling is enabled, it gets disabled. Knowing this, I believe the defect happens (in our case) when several backend calls are being made, hence filling the commands log rather quickly and then responses are received and the corresponding command lines are modified. In this context, the height of some lines in the commands log may be modified moving the scroll bar just slightly away from the bottom and it disables the auto-scroll. Is there a way to modify the onScrollBarMove event if such an event exists and make it accept a certain margin before triggering off the auto scroll? Or as discussed, just remove the feature.

dlabrecque-uzinakod avatar Apr 28 '22 20:04 dlabrecque-uzinakod

A starting point for the implementation of this might be, when in headless mode, to not do this scroll handling, since any scrollbar movement was definitely not caused by the user wanting to pause autoscrolling to look at something - they can't see the browser.

marktnoonan avatar Apr 28 '22 20:04 marktnoonan

Marking https://github.com/cypress-io/cypress/issues/22772 as a duplicate of this issue. Seems related to auto-scroll stopping mid-spec

astone123 avatar Jul 14 '22 20:07 astone123

After upgrading to v10 we are now encountering this issue as well. It happens both in the runner and in CI which makes it particularly irritating.

https://user-images.githubusercontent.com/79444261/180376746-43547634-e463-46d0-bd56-b98bde2a1974.mov

.

steve78GA avatar Jul 22 '22 06:07 steve78GA

Hi folks, I have a build that removes the "temporarily disable auto scrolling" feature for non-interactive mode. The reason I didn't fully remove that feature, is that in open mode, when tests are running, I think users pretty often will actually scroll the reporter manually while tests run, and it's fair to expect that to work. Removing that would probably cause some frustration, so it might be more suitable as a configuration or something eventually.

But there's a big caveat. I could not reproduce this issue at all, no matter what I tried. I let @JessicaSachs's tests run over and over and even though this happened for her in the video she shared, I never once saw the autoscroll fail or turn off on its own.

So I have no idea if the code I changed actually addresses this problem. It's a hunch.

Preview builds of the Cypress binary for linux and mac can be found in the comments here: https://github.com/cypress-io/cypress/pull/23053#commitcomment-80006665

@steve78GA or @JessicaSachs, maybe one of you who can reproduce can try the altered binary and confirm if, using cypress run --headed, this problem still happens for you.

marktnoonan avatar Aug 02 '22 13:08 marktnoonan

Hello, any updates? I have the same problem, and I noticed that basically the scroll turns off after about 1 minute of running the test

ngandymovpr avatar Aug 03 '22 14:08 ngandymovpr

Hi @ngandymovpr as mentioned in in my comment yesterday, there are some builds that you can install that attempt to fix this problem. Installation instructions for mac and linux are there, let me know if you need Windows and I'll make a fresh build.

I cannot actually reproduce this issue with the examples provided so far, so I need somebody who experiences it to validate that it is fixed in those builds (at least, for run mode). Would you be up for trying that? Or, can you provide a reproducible example repo I could try this preview build against?

I'm reluctant to merge a PR that we haven't confirmed fixes the problem. But I want to fix it because I agree it's a problem.

marktnoonan avatar Aug 03 '22 14:08 marktnoonan

@marktnoonan, I have this problem on Windows. Please make a Windows build. I can validate it pretty quickly, it happens to me every day in CI. I don't have a reproducible example myself. It happens randomly.

DannyBunny avatar Aug 03 '22 22:08 DannyBunny

Hi @marktnoonan we were experiencing this issue in our team as well and raised it with cypress support as well.

I have tried your custom build and so far in my pipelines it seems to HAVE FIXED the problem.

I say it seems to have fixed it, because it wasn't always a problem so I will hopefully be able to confirm that it definitely fixed it later today.

Thanks for picking this up!

Tom5om avatar Aug 04 '22 01:08 Tom5om

Thanks @Tom5om that's promising!

@DannyBunny here is the Windows version for you to check: https://github.com/cypress-io/cypress/pull/23053#commitcomment-80290518

Update, if that link isn't working, try this: https://github.com/cypress-io/cypress/commit/2eb2f82b23cc0fc086254e64a61cd91ea04488d7#commitcomment-80290518

marktnoonan avatar Aug 04 '22 13:08 marktnoonan

@marktnoonan, unable to run. Getting an error: Timed out waiting for the browser to connect. Retrying... EPERM: operation not permitted, unlink 'C:\Users\danny.z\AppData\Roaming\Cypress\cy\production\browsers\chrome-stable\run-23320\CypressCache\Cache_Data\data_1' Error: EPERM: operation not permitted, unlink 'C:\Users\danny.z\AppData\Roaming\Cypress\cy\production\browsers\chrome-stable\run-23320\CypressCache\Cache_Data\data_1'

DannyBunny avatar Aug 05 '22 15:08 DannyBunny

Thanks @DannyBunny, and shoot it looks like I started my branch during the hot second that develop wasn't working on Windows, branch is updated and the Windows build should appear in the comments for this commit: a28d6f8 (#23053)

Will check back on Monday.

EDIT: the links don't seem to always include the commit comments, so here is the command for windows:

npm install https://cdn.cypress.io/beta/npm/10.4.0/win32-x64/marktnoonan/16098-a28d6f80e953126cd3144dc756a4df26633227e0/cypress.tgz

marktnoonan avatar Aug 05 '22 21:08 marktnoonan

Any news about this, It's happening to me even when I run the test in my local machine. The auto scroll stops working after some time. This is really annoying when it happens on CI because it leaves me with NO LOGS to see what cypress is doing. THis makes IMPOSIBLE to review the failures.... I have cypress version 10.4.0

cposada23 avatar Aug 16 '22 13:08 cposada23

@cposada23 since you can reproduce, can you verify one of these builds fixes the problem (using cypress run, no change expected in cypress open)

I've tried a bunch to reproduce it and had several others trying as well but we have not at any luck.

Linux: npm install https://cdn.cypress.io/beta/npm/10.4.0/linux-x64/marktnoonan/16098-a28d6f80e953126cd3144dc756a4df26633227e0/cypress.tgz

Windows: npm install https://cdn.cypress.io/beta/npm/10.4.0/win32-x64/marktnoonan/16098-a28d6f80e953126cd3144dc756a4df26633227e0/cypress.tgz

Mac: npm install https://cdn.cypress.io/beta/npm/10.4.0/darwin-x64/marktnoonan/16098-2eb2f82b23cc0fc086254e64a61cd91ea04488d7/cypress.tgz

Mac (ARM): npm install https://cdn.cypress.io/beta/npm/10.4.0/darwin-arm64/marktnoonan/16098-2eb2f82b23cc0fc086254e64a61cd91ea04488d7/cypress.tgz

@Tom5om are you able to confirm if the problem was truly fixed for you? @ngandymovpr would you be able to try one of these builds?

marktnoonan avatar Aug 16 '22 14:08 marktnoonan

Yes @marktnoonan I have implemented this build in my pipelines and have not seen the issue since

Tom5om avatar Aug 16 '22 22:08 Tom5om

I had the same issue for one of my specs with Cypress 10.3.0. There it occurred in about 50% of the times. Since I installed your Build, I have done 15 more runs and have not seen this behavior again.

leonard2901 avatar Aug 17 '22 12:08 leonard2901

@marktnoonan can we get it merged, it's impacting us too. Thank you

kevingorry avatar Aug 18 '22 13:08 kevingorry

Thanks @leonard2901 and @Tom5om, that seems like plenty validation that this was the issue.

@kevingorry this thread should automatically update when the PR is merged, it will need a test as well, which @viniciuspietscher has offered to pick up to get the PR over the finish line. This will likely make it into the next Cypress release at the end of the month.

marktnoonan avatar Aug 18 '22 13:08 marktnoonan