-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
cy.get() method unnecessarily scrolling elements/window #2353
Comments
I can definitely understand the confusion - as it has been difficult to find the best place to document this behavior. During snapshot (where you are hovering/clicking on the command after it has run), Cypress automatically scrolls the element into view just so that you can see it and work with it in your debugger tools more easily. However, this is not the actual behavior of what happened while the test was running (also why your tests are not being affected on a functional level). If you want to see the actual scrolling behavior in action, we recommend using |
@jennifer-shehane thank you for taking the time to respond to my issue. I tried both the My apologies if I am mistaken; I can't fathom how what I am experiencing would be desired behaviour. Video screenshot exhibiting html element being scrolled. Video screenshot exhibiting widget frame being scrolled. Paused test exhibiting html element being scrolled. (note in this picture, the countdown widget is displaying correctly) Paused test exhibiting widget being scrolled unnecessarily out of view. Paused test exhibiting widget being further scrolled unnecessarily. |
Ok, yes, what you are seeing is scrolling behavior during the action commands ( This is how actions are currently implemented (see scrolling behavior when interacting with elements). Although - it has been expressed that some users do what to disable to automatically scrolling specifically as outlined here: #871 You should be able to pass |
@jennifer-shehane Ah okay Thank you. I had run into this before and I thought it was something I had ruled out for this issue (I tried it before submitting this), but I must have missed something, because I just added I think it was confusing because in the snapshots, it appears as though the scroll is explicitly occurring during the I would highly support #871 as I am seriously abusing Again, thank you for your time! I'm loving Cypress and excited for you guys to launch! |
I found this issue after experiencing a very similar behavior. I've got a button that's perfectly in view, but when the test tries to click it, it first scrolls it out of view and then complains that is not possible to interact with it. It scrolls it out of view because apparently cypress scrolls the button to the top of the view port, but in that area we have a fixed top bar, and the button and everything else below that top bar scrolls underneath it. So cypress effectively puts the button behind this top bar, and then tries to click it, when the button was visible in the first place. So I too foresee abusing |
I'm facing the very same situation here, as described by @gnapse ! Here, some samples:
Could we just have an option to turn off this behavior? I mean, it is not possible to click in an element that is out of view, then why scrolling it to the top of the viewport, if we already know it IS THERE, visible. |
@felipenmoura Please see this issue #871 |
In Cypress 6.1.0, there’s a new If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix. |
Current behaviour:
I am noticing Cypress seems to scroll an element/window while using the
get()
method.After immediately preceding click everything looks normal.
get()
scrolls the html element even though+
icon is visible.Actual
click()
does not cause scroll.The next
get()
causes the widget frame element to scroll even though target is visible.Again,
type()
does not scrollThe next
get()
scrolls the widget frame again.Subsequent calls to
get()
don't cause unusual scrolling when the element is on the same Y axis. (please pardon the different image, taken on a different run)Again
get()
causes the widget frame to scroll even though the target button is visible.This behaviour doesn't seem to influence the tests on a functional level; the tests pass or fail as expected and elements are clickable or not clickable as expected. It seems to be a visual thing only, but it is awkward and provides confusing feedback while you are writing or running the tests.
Desired behavior:
Unscrollable elements/window should not be scrolled in order to get elements that are already visible.
Steps to reproduce:
Unfortunately I cannot offer a reproducible code snippet at this time. I am happy to provide more info if needed.
Versions
Cypress package: Version: 3.1.0
Cypress binary: Version: 3.1.0
MacOS High Sierra: Version 10.13.6
Chrome: Version 68.0.3440.106 (Official Build) (64-bit)
The text was updated successfully, but these errors were encountered: