Skip to content

Commit 9cb6884

Browse files
Jesús GonzálezdmtrKovalenko
authored andcommitted
fix(realMouseMove): keep mousedown button pressed while moving
Issue: #752 Issue Link: #752
1 parent 91df596 commit 9cb6884

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/commands/mouseMove.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ScrollBehaviorOptions,
66
} from "../getCypressElementCoordinates";
77
import { getModifiers } from "../getModifiers";
8+
import { mouseButtonNumbers } from "../mouseButtonNumbers";
89

910
export interface RealMouseMoveOptions {
1011
/**
@@ -26,6 +27,12 @@ export interface RealMouseMoveOptions {
2627
altKey?: boolean;
2728
ctrlKey?: boolean;
2829
metaKey?: boolean;
30+
/**
31+
* Keeps a mouse button down while moving the mouse
32+
* @default 'none'
33+
* @example cy.realMouseMove(x, y, { keepMouseDownButton: 'left' })
34+
*/
35+
keepMouseDownButton?: keyof typeof mouseButtonNumbers;
2936
}
3037

3138
/** @ignore this, update documentation for this function at index.d.ts */
@@ -58,6 +65,7 @@ export async function realMouseMove(
5865
x: x * basePosition.frameScale + basePosition.x,
5966
y: y * basePosition.frameScale + basePosition.y,
6067
modifiers: modifiers,
68+
button: options.keepMouseDownButton,
6169
});
6270

6371
log.snapshot("after").end();

0 commit comments

Comments
 (0)