Skip to content

ScrollTop value leaks between test cases #31158

Open
@ZeroOneJs

Description

@ZeroOneJs

Current behavior

Please note that the scrollTop value logged in the console from the video may not always be 0. In my first test, I executed scrollIntoView, and in the second test, I logged the scrollTop value. However, I observed that it isn't always 0, even though the second test merely mounted the component without any other actions.

2025-02-22.12.14.14.mov

Desired behavior

Both tests should have scrollTop set to 0 initially.

Test code to reproduce

https://github.com/zero-one-code/cypress-demo.git

  1. Open the project and run:
pnpm i
pnpm test
  1. In the scrollTop test, refresh the page multiple times.

  2. Observe that the second test's scrollTop sometimes incorrectly retains the value from the first test.

Cypress Version

v14.0.3

Node version

v18.20.4

Operating System

macOS 15.3.1

Debug Logs

No response

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CTIssue related to component testing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions