From 62b0e432922fbd546d84232bbca59ff099bd9519 Mon Sep 17 00:00:00 2001 From: ShreySinha02 Date: Sun, 15 Dec 2024 16:28:16 +0530 Subject: [PATCH 1/3] fix issue #4238 Typescript types for dragAndDrop are incorrect --- types/web-element.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/web-element.d.ts b/types/web-element.d.ts index 6505b388d..a5196ce82 100644 --- a/types/web-element.d.ts +++ b/types/web-element.d.ts @@ -360,10 +360,13 @@ export type ScopedElementRect = { readonly height: number; }; -export type DragAndDropDestination = { +export type DragAndDropDestination = +{ readonly xOffset: number; readonly yOffset: number; -}; +} +|{readonly x: number; readonly y: number;} +|WebElement export interface ElementFunction extends Pick< From ec0c4eb2d127a5b0222ff7c7b1382efc131e1e14 Mon Sep 17 00:00:00 2001 From: ShreySinha02 Date: Wed, 18 Dec 2024 11:31:33 +0530 Subject: [PATCH 2/3] added test --- types/tests/webElement.test-d.ts | 3 ++- types/web-element.d.ts | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/types/tests/webElement.test-d.ts b/types/tests/webElement.test-d.ts index 6bd10a5e6..c0634a295 100644 --- a/types/tests/webElement.test-d.ts +++ b/types/tests/webElement.test-d.ts @@ -191,7 +191,8 @@ describe('new element() api', function () { expectType>(elem.submit()); expectType>(elem.setProperty('type', 'text')); expectType>(elem.setAttribute('role', 'button')); - expectType>(elem.dragAndDrop({xOffset: 150, yOffset: 500})); + expectType>(elem.dragAndDrop({x: 150, y: 500})); + expectType>(elem.dragAndDrop(elem.webElement)); expectType>(elem.moveTo(100, 100)); expectType>(elem.clickAndHold()); expectType>(elem.doubleClick()); diff --git a/types/web-element.d.ts b/types/web-element.d.ts index a5196ce82..aab8bce8f 100644 --- a/types/web-element.d.ts +++ b/types/web-element.d.ts @@ -361,10 +361,6 @@ export type ScopedElementRect = { }; export type DragAndDropDestination = -{ - readonly xOffset: number; - readonly yOffset: number; -} |{readonly x: number; readonly y: number;} |WebElement From a3742eff342743296b07789cd81c2d46605e9f05 Mon Sep 17 00:00:00 2001 From: ShreySinha02 Date: Wed, 18 Dec 2024 15:55:12 +0530 Subject: [PATCH 3/3] link fix --- types/web-element.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/web-element.d.ts b/types/web-element.d.ts index aab8bce8f..76f7d65b0 100644 --- a/types/web-element.d.ts +++ b/types/web-element.d.ts @@ -361,8 +361,8 @@ export type ScopedElementRect = { }; export type DragAndDropDestination = -|{readonly x: number; readonly y: number;} -|WebElement + | {readonly x: number; readonly y: number;} + | WebElement export interface ElementFunction extends Pick<