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

Command for scrolling into the page #313

Closed
MathRobin opened this issue Nov 30, 2016 · 4 comments
Closed

Command for scrolling into the page #313

MathRobin opened this issue Nov 30, 2016 · 4 comments

Comments

@MathRobin
Copy link

@MathRobin MathRobin commented Nov 30, 2016

Hi, thanks for cypress, it's a great tool.

For the moment I use the trick that when click on an element, the page will scroll. Not really the more natural thing. Is it possible to get something like cypress.scrollTo?

It could be very useful to test parallax and other UX features

@brian-mann
Copy link
Member

@brian-mann brian-mann commented Nov 30, 2016

Although we could probably create a more robust solution for this, you can already easily achieve this using native DOM API's. There is already a scrollIntoView method on any Element.

cy.get("button").then(function($btn){
  $btn.get(0).scrollIntoView()
})

We'll keep this issue open because it's come up before and we likely should just add our own cypress command which gives you more options about how the element is scrolled into view.

@ddeath
Copy link

@ddeath ddeath commented May 30, 2017

@brian-mann should it work with cypress run ? Can not make the test pass with that code on cli. When running in cypress open everything is just fine...

@RandallKent
Copy link
Member

@RandallKent RandallKent commented Jul 7, 2017

The code for this is done, but this has yet to be released. We'll update the issue and reference the changelog when it's released.

@RandallKent RandallKent closed this Jul 7, 2017
@brian-mann brian-mann added this to the 0.20.0 milestone Sep 14, 2017
@brian-mann
Copy link
Member

@brian-mann brian-mann commented Sep 14, 2017

Fixed in 0.20.0

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Dec 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants