-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
visible-automation + click automation (#6829)
* visible-automation + click automation * fix client test * fix test client * fix test client * fix ie client tests * 1 * fix tests * fix client * fix legacy tests * coalse * lint
- Loading branch information
1 parent
e43cdd7
commit f9a6786
Showing
60 changed files
with
1,418 additions
and
789 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...der/built-in/dedicated/chrome/cdp-client/automations/click/create-mouse-click-strategy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { MouseEventArgs } from '../../../../../../../../shared/actions/automations/visible-element-automation'; | ||
import { MouseClickStrategyBase } from '../../../../../../../../shared/actions/automations/click/mouse-click-strategy-base'; | ||
import * as clientsManager from '../../clients-manager'; | ||
|
||
const BUTTON = 'left'; | ||
const CLICK_COUNT = 1; | ||
|
||
class CDPMouseClickStategy<E> extends MouseClickStrategyBase<E> { | ||
public constructor () { | ||
super(); | ||
} | ||
|
||
public async mousedown (options: MouseEventArgs<E>): Promise<void> { | ||
const { Input } = clientsManager.getClient(); | ||
|
||
await Input.dispatchMouseEvent({ | ||
type: 'mousePressed', | ||
x: options.point?.x ?? -1, | ||
y: options.point?.y ?? -1, | ||
button: BUTTON, | ||
clickCount: CLICK_COUNT, | ||
}); | ||
} | ||
|
||
public async mouseup (element: E, options: MouseEventArgs<E>): Promise<MouseEventArgs<E>> { | ||
const { Input } = clientsManager.getClient(); | ||
|
||
await Input.dispatchMouseEvent({ | ||
type: 'mouseReleased', | ||
x: options.point?.x ?? -1, | ||
y: options.point?.y ?? -1, | ||
button: BUTTON, | ||
clickCount: CLICK_COUNT, | ||
}); | ||
|
||
return options; | ||
} | ||
} | ||
|
||
export default function createMouseClickStrategy<E> (): MouseClickStrategyBase<E> { | ||
return new CDPMouseClickStategy<E>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.