Closed amoshydra closed 2 months ago
TouchStart and TouchEvent should start at coordinate x: 0 and y: 0 when x: 0 and y: 0 is provided in readSwipe
x: 0
y: 0
readSwipe
cy.mount(<Canvas />); cy .get("body") .realSwipe("toRight", { x: 0, y: 0, }) ;
However when a 0 value is provided to either x or y, position is computed to be undefined as the values are falsey and intepreted as not provided.
x
y
undefined
https://github.com/dmtrKovalenko/cypress-real-events/blob/8b8a509bb6643c2e0dda93966c219653a53c704a/src/commands/realSwipe.ts#L101-L104
Reproduce repository: https://github.com/amoshydra/repro-dmtrKovalenko-cypress-real-events-i-swipes/blob/real-swipe-with-x-or-y-be-0/src/components/input/Canvas.cy.tsx
The video preview shows 3 tests with the following calls:
.realSwipe("toRight", { x: 0, y: 1, })
.realSwipe("toRight", { x: 1, y: 0, })
.realSwipe("toRight", { x: 1, y: 1, })
https://github.com/dmtrKovalenko/cypress-real-events/assets/8733840/3e43a617-da2c-4192-8eef-1a5ae75428f3
0
options.touchPosition
Proposal : https://github.com/dmtrKovalenko/cypress-real-events/pull/642
:tada: This issue has been resolved in version 1.13.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Expected
TouchStart and TouchEvent should start at coordinate
x: 0
andy: 0
whenx: 0
andy: 0
is provided inreadSwipe
Current
However when a 0 value is provided to either
x
ory
, position is computed to beundefined
as the values are falsey and intepreted as not provided.https://github.com/dmtrKovalenko/cypress-real-events/blob/8b8a509bb6643c2e0dda93966c219653a53c704a/src/commands/realSwipe.ts#L101-L104
Reproduce:
Reproduce repository: https://github.com/amoshydra/repro-dmtrKovalenko-cypress-real-events-i-swipes/blob/real-swipe-with-x-or-y-be-0/src/components/input/Canvas.cy.tsx
The video preview shows 3 tests with the following calls:
https://github.com/dmtrKovalenko/cypress-real-events/assets/8733840/3e43a617-da2c-4192-8eef-1a5ae75428f3
Possible solution
x
andy
areundefined
or0
.x
ory
is provided, automatically fill the undefinedx
ory
as 0.options.touchPosition
should be used only when bothx
andy
are undefined.Proposal : https://github.com/dmtrKovalenko/cypress-real-events/pull/642