feat(browser-event): support drag event #321
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces the "drag" action type across various modules to enhance the UI interaction capabilities. The changes include updates to type definitions, action handlers, and tests to support the new drag functionality.
Enhancements to Action Types and Handlers:
packages/midscene/src/ai-model/ui-tars-planning.ts
: Added theDragAction
interface and updated theActionType
type to include 'drag'. Implemented handling for the 'drag' action type in thevlmPlanning
function. [1] [2] [3] [4]packages/web-integration/src/types.ts
: Added 'Drag' to thePlanningAction
type.Updates to Mouse Event Handling:
packages/web-integration/src/appium/page.ts
: Added adrag
method to handle drag actions using the mouse. [1] [2]packages/web-integration/src/bridge-mode/agent-cli-side.ts
: Addeddrag
to the mouse event handlers.packages/web-integration/src/bridge-mode/common.ts
: AddedDrag
to theMouseEvent
enum.packages/web-integration/src/bridge-mode/page-browser-side.ts
: Updated theChromeExtensionPageBrowserSide
class to handle the 'drag' mouse event.packages/web-integration/src/chrome-extension/page.ts
: Added adrag
method to simulate drag actions using Chrome DevTools Protocol.Task Execution Enhancements:
packages/web-integration/src/common/tasks.ts
: Added support for executing drag actions in thePageTaskExecutor
class.Interface and Test Updates:
packages/web-integration/src/page.ts
: Updated theMouseAction
interface andAbstractPage
class to include thedrag
method. [1] [2]packages/web-integration/src/playground/static-page.ts
: Added adrag
method to theStaticPage
class.packages/web-integration/src/puppeteer/base-page.ts
: Added adrag
method to handle drag actions for both Puppeteer and Playwright.packages/web-integration/tests/ai/bridge/temp.test.ts
: Added a new test file to test the drag event functionality.Package Configuration:
packages/web-integration/package.json
: Updated the test scripts to include a temporary test for the drag event.