Skip to content

feat: add native mobile swipe#14014

Merged
christian-bromann merged 7 commits intomainfrom
ws/add-swipe
Dec 30, 2024
Merged

feat: add native mobile swipe#14014
christian-bromann merged 7 commits intomainfrom
ws/add-swipe

Conversation

@wswebcreation
Copy link
Member

@wswebcreation wswebcreation commented Dec 29, 2024

This PR adds a Mobile Native swipe command and contains the following

  • add new swipe for native apps method
  • add docs
  • update scrollIntoView to make it depended on the swipe
  • update UTs for scrollIntoView
  • update and fix formatter and template

Usage

it('should execute a default swipe', async () => {
    await browser.swipe();
});

it('should execute a swipe with options', async () => {
    await browser.swipe({
        direction: 'left',                  // Swipe from right to left
        duration: 5000,                     // Last for 5 seconds
        percent: 0.5,                       // Swipe 50% of the scrollableElement
        scrollableElement: $('~carousel'),  // The element to swipe within
    })
});

@todo: add UT's

Proposed changes

Types of changes

  • Polish (an improvement for an existing feature)
  • 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 (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

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 the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Backport Request

//: # (The current main branch is the development branch for WebdriverIO v9. If your change should be released to the current major version of WebdriverIO (v8), please raise another PR with the same changes against the v8 branch.)

  • This change is solely for v9 and doesn't need to be back-ported
  • Back-ported PR at #XXXXX

Further comments

Reviewers: @webdriverio/project-committers

- add new swipe for native apps method
- add docs
- update `scrollIntoView` to make it depended on the `swipe`
- update UTs for `scrollIntoView`
- update and fix formatter and  template

@todo: add UT's
@wswebcreation wswebcreation added PR: New Feature 🚀 PRs that contain new features PR: Polish 💅 PRs that contain improvements on existing features labels Dec 29, 2024
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 29, 2024

Open in Stackblitz

eslint-plugin-wdio

npm i https://pkg.pr.new/webdriverio/webdriverio/eslint-plugin-wdio@14014

@wdio/appium-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/appium-service@14014

@wdio/allure-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/allure-reporter@14014

@wdio/browser-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/browser-runner@14014

@wdio/browserstack-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/browserstack-service@14014

@wdio/cli

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cli@14014

@wdio/concise-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/concise-reporter@14014

@wdio/cucumber-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cucumber-framework@14014

@wdio/config

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/config@14014

@wdio/dot-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/dot-reporter@14014

@wdio/firefox-profile-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/firefox-profile-service@14014

@wdio/globals

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/globals@14014

@wdio/jasmine-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/jasmine-framework@14014

@wdio/json-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/json-reporter@14014

@wdio/junit-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/junit-reporter@14014

@wdio/lighthouse-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/lighthouse-service@14014

@wdio/local-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/local-runner@14014

@wdio/logger

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/logger@14014

@wdio/mocha-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/mocha-framework@14014

@wdio/protocols

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/protocols@14014

@wdio/repl

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/repl@14014

@wdio/reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/reporter@14014

@wdio/runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/runner@14014

@wdio/sauce-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sauce-service@14014

@wdio/shared-store-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/shared-store-service@14014

@wdio/smoke-test-cjs-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-cjs-service@14014

@wdio/smoke-test-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-reporter@14014

@wdio/smoke-test-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-service@14014

@wdio/spec-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/spec-reporter@14014

@wdio/static-server-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/static-server-service@14014

@wdio/sumologic-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sumologic-reporter@14014

@wdio/testingbot-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/testingbot-service@14014

@wdio/types

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/types@14014

@wdio/utils

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/utils@14014

@wdio/webdriver-mock-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/webdriver-mock-service@14014

webdriver

npm i https://pkg.pr.new/webdriverio/webdriverio/webdriver@14014

webdriverio

npm i https://pkg.pr.new/webdriverio/webdriverio@14014

commit: 96bd4e9

@wswebcreation wswebcreation marked this pull request as ready for review December 30, 2024 09:01
Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

I am very excited about this 🤩 some questions.

@wswebcreation
Copy link
Member Author

I am very excited about this 🤩 some questions.

Thanks @christian-bromann , your feedback always makes my day!

I've now limited the swipe for native apps, but will think about a way for web and hybrid. The reason why that is different is related to the addresbar on Chrome and Safari for coordinate swipes. Same for hybrid apps where you don't know where the webview starts. That makes swiping on those apps complicated and flaky

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Awesome stuff 🙌

@christian-bromann christian-bromann removed the PR: Polish 💅 PRs that contain improvements on existing features label Dec 30, 2024
@christian-bromann christian-bromann merged commit ba09aeb into main Dec 30, 2024
@christian-bromann christian-bromann deleted the ws/add-swipe branch December 30, 2024 17:43
@christian-bromann
Copy link
Member

removed the PR: Polish 💅 label now

This is ultimately a new feature. We can't label a PR with two labels at the moment :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: New Feature 🚀 PRs that contain new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants