Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove appium commands #12209

Merged
merged 1 commit into from Feb 12, 2024
Merged

feat: remove appium commands #12209

merged 1 commit into from Feb 12, 2024

Conversation

wswebcreation
Copy link
Member

@wswebcreation wswebcreation commented Feb 11, 2024

The latest appium-uiautomator2-driver 3.0.0 released removed the following commands

  • touchDown
  • touchLongClick
  • touchMove
  • touchUp

They were already deprecated and will now be removed

Alternatives

touchDown

// See https://webdriver.io/docs/api/browser/action/
await driver
  // a. Create the event
  .action('pointer')
  // b. Move finger into start position
  .move(x,y) // This can also be written as .move({ x:x, y:y }) which allows you to add more options
  // c. Finger comes down into contact with screen
  .down() // This can also be written as .down({ button:0 }) which allows you to add more options
  // d. Perform the action, in this flow the finger will stay on the screen, this is normally not a good flow because you are "stuck"
   .perform()

touchUp

// See https://webdriver.io/docs/api/browser/action/
// A touchUp is normally the followup from a `touchDown`
await driver
  // a. Create the event
  .action('pointer')
  // b. Move finger into start position
  .move(x,y) // This can also be written as .move({ x:x, y:y }) which allows you to add more options
  // c. Finger comes down into contact with screen
  .down() // This can also be written as .down({ button:0 }) which allows you to add more options
  // d. Pause for a little bit, playing with the pause will make this a "normal" or a longer click action
  .pause(100)
  // e. Finger gets up, off the screen
  .up() // this can also be written as .up({ button:0 }) which allows you to add more options
  // f. Perform the action
  .perform();

touchLongClick

// See https://webdriver.io/docs/api/browser/action/
// The alternative of the `touchLongClick` can be compared with the replacement of the `touchUp` but with a longer pause
await driver
  // a. Create the event
  .action('pointer')
  // b. Move finger into start position
  .move(x,y) // This can also be written as .move({ x:x, y:y }) which allows you to add more options
  // c. Finger comes down into contact with screen
  .down() // This can also be written as .down({ button:0 }) which allows you to add more options
  // d. Pause longer, take for example 1000ms which is 1 second or more
  .pause(3000)
  // e. Finger gets up, off the screen
  .up() // this can also be written as .up({ button:0 }) which allows you to add more options
  // f. Perform the action
  .perform();

touchMove

// See https://webdriver.io/docs/api/browser/action/
// We add an extra `move`
await driver
  // a. Create the event
  .action('pointer')
  // b. Move finger into start position
  .move(from.x, from.y) // This can also be written as .move({ x:from.x, y:from.y }) which allows you to add more options
  // c. Finger comes down into contact with screen
  .down() // This can also be written as .down({ button:0 }) which allows you to add more options
  // d. Pause for a little bit
  .pause(100)
  // e. Finger moves to end position
  // IMPORTANT. The default duration, if you don't provide it, is 100ms. This means that the movement will be so fast that it:
  // - might not be registered
  // - might not have the correct result on longer movements.
  // Short durations will move elements on the screen over longer move coordinates very fast.
  // Play with the duration to make the swipe go slower / faster
  .move({ duration: 1000, x: to.x, y: to.y })
  // f. Finger gets up, off the screen
  .up() // this can also be written as .up({ button:0 }) which allows you to add more options
  // g. Perform the action
  .perform();

Proposed changes

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

Reviewers: @webdriverio/project-committers

- touchDown
- touchLongClick
- touchMove
- touchUp
@erwinheitzman
Copy link
Member

@wswebcreation I think it would be great if we could share the alternatives in the release notes, this means we will have to manually edit them but I think it adds a lot of value here.

@erwinheitzman erwinheitzman merged commit 7f20f3b into main Feb 12, 2024
8 checks passed
@erwinheitzman erwinheitzman deleted the ws/remove-appium-commands branch February 12, 2024 09:32
@erwinheitzman erwinheitzman added the PR: Breaking Change 💥 PRs that contain breaking changes label Feb 12, 2024
@wswebcreation
Copy link
Member Author

@wswebcreation I think it would be great if we could share the alternatives in the release notes, this means we will have to manually edit them but I think it adds a lot of value here.

Yep, that was also my thought behind putting the alternatives in here :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Breaking Change 💥 PRs that contain breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants