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

Implement in realClick, realSwipe, realTouch the support for percentages regarding x and y #51

Open
silversonicaxel opened this issue Apr 19, 2021 · 2 comments

Comments

@silversonicaxel
Copy link
Contributor

It should be possible to interact with those commands also with percentages

as an example

cy.get("body").realClick({ x: `10%`, y: `12%` })

cy.get("body").realSwipe({ x: `10%`, y: `12%` })

cy.get("body").realTouch({ x: `10%`, y: `12%` })

or to keep intact the current x and y it could be

cy.get("body").realClick({ xPercent: `10%`, yPercent: `12%` })

cy.get("body").realSwipe({ xPercent: `10%`, yPercent: `12%` })

cy.get("body").realTouch({ xPercent: `10%`, yPercent: `12%` })
@dmtrKovalenko
Copy link
Owner

What is the use case?

@silversonicaxel
Copy link
Contributor Author

I actually need it for the Click, so maybe it could be ignored for Swipe, maybe it could make sense for Touch.

My use case is the following: I've a slider that occupies all the horizontal space of its container, it could be fullWidth.
The slider handle can move on the slider bar with a drag and drop effect, or with a click to trigger anywhere in this horizontal slider bar.

I would love to decide the percentage because, having my e2e tests running on different viewports, the pixel definition is not really precise for many scenarios. And the percentage fits this perfectly.

Unless if you have a better approach with the current implementation, I'm open to a good solution. Thanks @dmtrKovalenko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants