Visitar URL original
feat: add drag command for drag-and-drop gestures (#1203) by AfzalivE · Pull Request #3453 · mobile-dev-inc/Maestro · GitHub
Skip to content

feat: add drag command for drag-and-drop gestures (#1203) - #3453

Open
AfzalivE wants to merge 19 commits into
mobile-dev-inc:mainfrom
AfzalivE:feat/1203-drag-drop
Open

AfzalivE wants to merge 19 commits into
mobile-dev-inc:mainfrom
AfzalivE:feat/1203-drag-drop

Conversation

@AfzalivE

@AfzalivE AfzalivE commented Jul 21, 2026 •

Copy link
Copy Markdown

Proposed changes

Branched from from #2978

Implements a new 'drag' command that enables drag-and-drop gestures and
item reordering in mobile apps.

Closes #1203

Supported syntax

  • drag from/to by element id or text
  • drag from/to by percentage coordinates
  • drag from point with offset
  • configurable duration and press duration (for longpress before drag)

Example usage

# Drag by element text
- drag:
    from:
      text: ".*Item 3.*"
    to:
      text: ".*Item 1.*"
    duration: 3000
    pressDuration: 1000

# Drag by percentage coordinates
- drag:
    from: "50%, 30%"
    to: "50%, 70%"
    pressDuration: 1000

# Drag with offset
- drag:
    from: "50%, 30%"
    offset: "0%, 40%"
    pressDuration: 1000

Status

Platform Status
Android ✅ Fully working
iOS + React Native ✅ Fully working
iOS + Flutter ⚠️ Known issue (see below)
Web (CDP/Selenium) ✅ Implemented

iOS + Flutter limitation

There is a known bug in Flutter's ReorderableListView + item Semantics where element coordinates become invalid after the first drag operation. This is a Flutter/iOS accessibility bug tracked in flutter/flutter#100946, not a Maestro issue. Created flutter/flutter#189686 to fix this.

Testing

Does this need e2e tests?

Added.

Issues fixed

Closes #1203

@Fishbowler Fishbowler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As well as the failing e2e test, also spotted that the new test isn't running

boorad and others added 17 commits July 28, 2026 11:37
Implements a new 'drag' command that enables drag-and-drop gestures and
item reordering in mobile apps.

Supported syntax:
- drag from/to by element id or text
- drag from/to by percentage coordinates
- drag from point with offset
- configurable duration

Status:
- Android: fully working
- iOS + React Native: fully working
- iOS + Flutter: known bug where element coordinates become invalid
  after first drag (Flutter accessibility issue, not Maestro)

See DRAG_ISSUE_FLUTTER_IOS.md for detailed investigation of the
Flutter+iOS issue.
# Conflicts:
#	.gitignore
- Remove unused 'steps' variable in AndroidDriver.drag()
- Extract duplicate drag implementation from WebDriver and CdpWebDriver
  to shared SeleniumGestures.performDrag() utility
- Add DRAG_LONG_PRESS_DURATION_MS constant (1000ms) for clarity
- Rename drag_test.yaml to drag_text.yaml (element selector based)
- Add drag_pcts.yaml (percentage coordinate based)
- Add clearState to both tests for consistent starting state
- Add warning about percentage-based tests being device-specific
Move the long-press regression into the command suite so PR checks
exercise pressDuration. Adjust the percentage target to match the CI
layout.
@AfzalivE
AfzalivE force-pushed the feat/1203-drag-drop branch from 40a8001 to 3b774d5 Compare July 28, 2026 15:37
AfzalivE added 2 commits July 28, 2026 14:22
A shell swipe starts a second pointer stream, cancelling the held
pointer before movement. Emit interpolated motion events directly so
custom press durations remain one DOWN, MOVE, and UP sequence.
@AfzalivE

AfzalivE commented Jul 28, 2026 •

Copy link
Copy Markdown
Author

drag_long_press was failing on Android because I assumed that having two consecutive DOWN events would be fine but actually, a second DOWN event cancels the first one so the long-press and swipe were separate.

On Android, draganddrop command does long-press for the duration of the long-press timeout already (ref) but Flutter's LongPressDraggable allows modifying the long-press delay, which won't be accounted for via draganddrop hence the motionevent based drag when pressDuration is specified.

@AfzalivE

Copy link
Copy Markdown
Author

@Fishbowler Fixed the failing test and included the new one. Sorry for the delay, had a work trip last week.

@AfzalivE

AfzalivE commented Sep 1, 2026

Copy link
Copy Markdown
Author

Btw, the ReorderableListView semantics bugfix for Flutter got merged 🎉

@Fishbowler Fishbowler added the awaiting maestro 3.0 Driver work: on hold until after Maestro 3.0 label Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting maestro 3.0 Driver work: on hold until after Maestro 3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Hold and swipe/drag to reorder items

3 participants