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

Broken position after viewing snapshots with elements with transform #25056

Open
kaluger-roman opened this issue Dec 8, 2022 · 1 comment
Open
Labels
E2E Issue related to end-to-end testing topic: snapshot Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: bug

Comments

@kaluger-roman
Copy link

kaluger-roman commented Dec 8, 2022

Current behavior

Elements with css property transform lose their position after cypress interactions (i.e. get, trigger("mousedown") etc).

state before interactions
image

state after interactions

image

as you can see, the block moved to the corner.

But if we look into console and disable/enable transform property checkbox on that element, it would be displayed properly

image

Desired behavior

Elements shouldn't loss their actual position

Test code to reproduce

simple react component

const App = () =>  (
   <div id="test" style={{ transform: "translate(50px, 150px)", background: "red", width: "100%", height: "100vh" }}>
    dfdfd
  </div>
  )

cypress test

describe("Movements story", () => {
    it("One node movement", () => {
      cy.visit("http://0.0.0.0:3000")
      cy.wait(5000)
      cy.get("#test").trigger("mousedown")
    })
  })

Cypress Version

12.0.1

Node version

16.17.0

Operating System

macOS 12.3.1

Debug Logs

No response

Other

No response

@kaluger-roman kaluger-roman changed the title Interactions with elements with transform Broken position after interactions with elements with transform Dec 8, 2022
@kaluger-roman kaluger-roman changed the title Broken position after interactions with elements with transform Broken position after interactions with elements with transform Dec 8, 2022
@emilyrohrbough
Copy link
Member

emilyrohrbough commented Dec 29, 2022

I dug into this a bit and was able to reproduce the behavior you are seeing with Cypress 12.2.0 using this reproduction: https://github.com/cypress-io/cypress-test-tiny/tree/issue-25056.

The updated page from the .trigger('mousedown') seems like correct behavior given the transform style is on an element with height of 100vh and width of 100%. By default, the .trigger('mousedown') will click the center of the element and it will scroll the element into view to do so. You can use the scrollBehavior: false trigger option (i.e. .trigger('mousedown', { scrollBehavior: false })) to prevent the page from scrolling.

I am however noticing a different issue with snapshots with this example when the query command (.get()) and/or when the .trigger() action command when the logs are hovered or pinned in the Command Log. I am observing the snapshot is applied and the styles are not correctly restored when the log is unhovered/unpinned. See:

Screen.Recording.2022-12-29.at.10.12.06.AM.mov

@emilyrohrbough emilyrohrbough changed the title Broken position after interactions with elements with transform Broken position after viewing snapshots with elements with transform Dec 29, 2022
@emilyrohrbough emilyrohrbough added type: bug topic: snapshot help wanted E2E Issue related to end-to-end testing labels Dec 29, 2022
@emilyrohrbough emilyrohrbough removed their assignment Jan 30, 2023
@nagash77 nagash77 added Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed routed-to-e2e labels Apr 19, 2023
@jennifer-shehane jennifer-shehane added good first issue Good for newcomers and removed help wanted labels Oct 4, 2023
@jennifer-shehane jennifer-shehane removed the good first issue Good for newcomers label Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing topic: snapshot Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: bug
Projects
None yet
Development

No branches or pull requests

5 participants