Jumps the page scroll position to the very top using window.scrollTo(0, 0). This is an absolute position step - it always resets to the top regardless of how far down the page is currently scrolled. Use it as a setup or teardown action when a scenario needs to verify elements near the top of the page after performing actions further down.
Unlike the incremental scroll up step, this step does not require knowing the current scroll offset. It is the fastest way to reset vertical position to the origin. No pixel argument is accepted. The optional words the and of the page are all interchangeable - any combination is matched.
Accepted phrasings
When I scroll to top
When I scroll to the top
When I scroll to the top of the page
When we scroll to top
When we scroll to the top
When scrolling to top
When scrolling to the top of the page
And I scroll to top
Examples
When I scroll to top
And we scroll to the top
When scrolling to the top of the page
And I scroll to top
In a real scenario
Scenario: The back-to-top link is visible after scrolling and returns the user to the top
Given I am an anonymous user
When I go to "/news"
And I scroll to the bottom of the page
Then I should see "Back to top"
When I click "Back to top"
And I scroll to top
Then the "site header" should be visible