Skip to content

[CUS-12449] add-on for swiping in the given direction with pause.#386

Open
ManojTestsigma wants to merge 1 commit intodevfrom
CUS-12449
Open

[CUS-12449] add-on for swiping in the given direction with pause.#386
ManojTestsigma wants to merge 1 commit intodevfrom
CUS-12449

Conversation

@ManojTestsigma
Copy link
Copy Markdown
Contributor

@ManojTestsigma ManojTestsigma commented Apr 30, 2026

please review this addon and publish as PUBLIC

Addon name : swipe actions
Addon accont: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira: https://testsigma.atlassian.net/browse/CUS-12449

fix

This does swipe inside the element in the given direction.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added new Android scroll gesture action supporting directional scrolling with configurable duration within target elements.
    • Added multiple new iOS gesture actions: directional swiping, middle-to-top scrolling, middle-to-bottom scrolling, and duration-based swipe gestures—all constrained within target elements.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

📝 Walkthrough

Walkthrough

Introduces a new Maven module swipe_actions with a build definition and five new custom action classes for Android and iOS platforms. The actions perform constrained touch swipe/scroll gestures within element bounds, supporting directional scrolling with configurable durations and initial positions.

Changes

Cohort / File(s) Summary
Build Configuration
swipe_actions/pom.xml
Maven module definition targeting Java 11 with dependencies on Testsigma SDK, JUnit Jupiter, Lombok, TestNG, Selenium, Appium, and Jackson. Configures shaded artifact packaging and source JAR attachment.
Android Actions
swipe_actions/src/main/java/com/testsigma/addons/android/ScrollInsideElementWithDuration.java
New Android action performing directional swipe within element bounds. Parses duration (positive integer) and direction parameters, validates inputs, calculates start/end coordinates via resolveCoordinates helper, and executes W3C PointerInput sequence via AppiumDriver.
iOS Actions
swipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementFromMiddleToBottom.java, ScrollInsideElementFromMiddleToTop.java, ScrollInsideElementWithDuration.java, SwipeInsideElement.java
Four new iOS actions implementing various swipe/scroll patterns: middle-to-bottom, middle-to-top, duration-based directional scrolling, and general directional swiping. All compute element bounds, derive start/end coordinates, and execute W3C PointerInput sequences with ~2-second durations. Include direction validation and element-not-found error handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #303: Modifies mobile action implementations to use W3C PointerInput/Sequence-based touch actions instead of deprecated TouchAction API, following the same architectural pattern as this PR.

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰 A swipe within the element's frame,
With directions and durations all the same,
From Android hops to iOS bounds so keen,
The smoothest pointer actions ever seen!
W3C sequences make testing bright,
Swipe-swipe-swipe, everything's right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: adding an addon for swiping in a given direction with pause functionality, which is reflected across all the new action classes in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch CUS-12449

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (6)
swipe_actions/src/main/java/com/testsigma/addons/ios/SwipeInsideElement.java (2)

66-69: 💤 Low value

Edge coordinates may land outside element bounds.

Using rect.x + rect.width and rect.y + rect.height computes coordinates that are technically 1 pixel outside the element. For an element at x=10, width=100, the rightmost pixel inside is 109, but this yields 110. While touch gestures typically have tolerance, consider subtracting 1 (or adding a small inset) for strict within-bounds behavior.

Suggested fix with 1-pixel inset
             int left    = rect.x;
-            int right   = rect.x + rect.width;
+            int right   = rect.x + rect.width - 1;
             int top     = rect.y;
-            int bottom  = rect.y + rect.height;
+            int bottom  = rect.y + rect.height - 1;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@swipe_actions/src/main/java/com/testsigma/addons/ios/SwipeInsideElement.java`
around lines 66 - 69, The edge coordinate calculations in SwipeInsideElement
(where left/right/top/bottom are computed from
rect.x/rect.y/rect.width/rect.height) can produce coordinates one pixel outside
the element; update the computation to inset the bounds (e.g., right = rect.x +
rect.width - 1 and bottom = rect.y + rect.height - 1 or apply a small
configurable inset) so all generated touch points are strictly inside the
element, and adjust any dependent calculations in the same class/method to use
these inset values.

111-129: ⚖️ Poor tradeoff

resolveCoordinates is duplicated across multiple action classes.

This exact method is repeated in ScrollInsideElementWithDuration (both iOS and Android). Consider extracting it to a shared utility class to reduce duplication and simplify future maintenance.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@swipe_actions/src/main/java/com/testsigma/addons/ios/SwipeInsideElement.java`
around lines 111 - 129, The resolveCoordinates method is duplicated across
SwipeInsideElement and the ScrollInsideElementWithDuration implementations (iOS
and Android); extract the logic into a single shared utility class (e.g.,
ElementSwipeUtils.resolveCoordinates) as a public static method that accepts
(String dir, int left, int right, int top, int bottom, int cx, int cy) and
returns the int[]; then replace the duplicate implementations in
SwipeInsideElement and both ScrollInsideElementWithDuration classes to call
ElementSwipeUtils.resolveCoordinates(...) and remove the redundant methods.
swipe_actions/pom.xml (2)

36-46: ⚡ Quick win

Mixed test frameworks: both JUnit Jupiter and TestNG are declared.

Having both junit-jupiter-api (test scope) and testng (compile scope) increases complexity. If TestNG is required by the Testsigma SDK at runtime, consider adding a clarifying comment. Otherwise, remove the unused framework.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@swipe_actions/pom.xml` around lines 36 - 46, The pom currently declares both
junit-jupiter-api and testng which mixes test frameworks; either remove the
unused <artifactId>testng</artifactId> dependency or explicitly document and
constrain it (e.g., change its scope to test or add a clarifying comment) if a
runtime component like the Testsigma SDK requires TestNG. Locate the dependency
blocks for junit-jupiter-api and testng and either delete the testng dependency
or set its scope to test and add a comment explaining why TestNG is needed to
avoid confusion.

17-17: ⚡ Quick win

JUnit Jupiter 5.8.0-M1 is a milestone (pre-release) version.

Consider using a stable release (e.g., 5.10.x or 5.11.x) for production code.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@swipe_actions/pom.xml` at line 17, The POM currently pins
junit.jupiter.version to a pre-release milestone (junit.jupiter.version =
5.8.0-M1); update that Maven property to a stable JUnit Jupiter release (for
example set junit.jupiter.version to a current stable like 5.10.x or 5.11.x),
then ensure any junit-jupiter dependencies use that property so the build uses
the stable release instead of the milestone.
swipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementFromMiddleToBottom.java (1)

42-45: 💤 Low value

Same edge coordinate note applies here.

Line 45 uses rect.y + rect.height, which is 1 pixel past the bottom edge. See comment in SwipeInsideElement.java for the suggested fix pattern.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@swipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementFromMiddleToBottom.java`
around lines 42 - 45, The endY calculation in
ScrollInsideElementFromMiddleToBottom (where startX, startY, endX, endY are
computed) uses rect.y + rect.height which is one pixel past the bottom edge;
change the endY computation to use the bottom edge minus one (e.g., rect.y +
rect.height - 1 or rect.getMaxY() - 1) so the swipe target is inside the element
rather than just outside it.
swipe_actions/src/main/java/com/testsigma/addons/android/ScrollInsideElementWithDuration.java (1)

1-145: ⚖️ Poor tradeoff

Near-complete duplication with the iOS counterpart.

This class is almost identical to ios/ScrollInsideElementWithDuration.java, differing only in the parent class (AndroidAction vs IOSAction) and ApplicationType. If the SDK permits, consider extracting shared logic (duration parsing, coordinate resolution, swipe execution) into a common base class or utility to reduce maintenance burden.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@swipe_actions/src/main/java/com/testsigma/addons/android/ScrollInsideElementWithDuration.java`
around lines 1 - 145, This class duplicates logic from
ios/ScrollInsideElementWithDuration.java; extract the shared behavior (duration
parsing, resolveCoordinates, pointer/sequence swipe construction and common
logging/result handling) into a single reusable base or utility (e.g.,
ScrollInsideElementBase with methods parseDuration(TestData),
resolveCoordinates(...), and performSwipe(AppiumDriver,
startX,startY,endX,endY,durationSeconds)) and have
ScrollInsideElementWithDuration extend that base (or call the utility) while
keeping only platform-specific bits (the parent action type and ApplicationType
annotation) in the Android and iOS subclasses; update references to elementName,
direction, duration, and driver to use the base/utility methods (retain method
names resolveCoordinates, execute entrypoint in subclasses that delegates to the
base).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@swipe_actions/pom.xml`:
- Around line 47-58: Update the Selenium and Appium dependency versions in the
POM: change org.seleniumhq.selenium:selenium-java from 4.33.0 to 4.43.0 and
io.appium:java-client from 9.4.0 to 10.1.1, then run a build and smoke tests to
ensure these updated artifacts (selenium-java and java-client) remain compatible
with the Testsigma SDK and adjust any import/usage changes surfaced by the newer
APIs.

---

Nitpick comments:
In `@swipe_actions/pom.xml`:
- Around line 36-46: The pom currently declares both junit-jupiter-api and
testng which mixes test frameworks; either remove the unused
<artifactId>testng</artifactId> dependency or explicitly document and constrain
it (e.g., change its scope to test or add a clarifying comment) if a runtime
component like the Testsigma SDK requires TestNG. Locate the dependency blocks
for junit-jupiter-api and testng and either delete the testng dependency or set
its scope to test and add a comment explaining why TestNG is needed to avoid
confusion.
- Line 17: The POM currently pins junit.jupiter.version to a pre-release
milestone (junit.jupiter.version = 5.8.0-M1); update that Maven property to a
stable JUnit Jupiter release (for example set junit.jupiter.version to a current
stable like 5.10.x or 5.11.x), then ensure any junit-jupiter dependencies use
that property so the build uses the stable release instead of the milestone.

In
`@swipe_actions/src/main/java/com/testsigma/addons/android/ScrollInsideElementWithDuration.java`:
- Around line 1-145: This class duplicates logic from
ios/ScrollInsideElementWithDuration.java; extract the shared behavior (duration
parsing, resolveCoordinates, pointer/sequence swipe construction and common
logging/result handling) into a single reusable base or utility (e.g.,
ScrollInsideElementBase with methods parseDuration(TestData),
resolveCoordinates(...), and performSwipe(AppiumDriver,
startX,startY,endX,endY,durationSeconds)) and have
ScrollInsideElementWithDuration extend that base (or call the utility) while
keeping only platform-specific bits (the parent action type and ApplicationType
annotation) in the Android and iOS subclasses; update references to elementName,
direction, duration, and driver to use the base/utility methods (retain method
names resolveCoordinates, execute entrypoint in subclasses that delegates to the
base).

In
`@swipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementFromMiddleToBottom.java`:
- Around line 42-45: The endY calculation in
ScrollInsideElementFromMiddleToBottom (where startX, startY, endX, endY are
computed) uses rect.y + rect.height which is one pixel past the bottom edge;
change the endY computation to use the bottom edge minus one (e.g., rect.y +
rect.height - 1 or rect.getMaxY() - 1) so the swipe target is inside the element
rather than just outside it.

In
`@swipe_actions/src/main/java/com/testsigma/addons/ios/SwipeInsideElement.java`:
- Around line 66-69: The edge coordinate calculations in SwipeInsideElement
(where left/right/top/bottom are computed from
rect.x/rect.y/rect.width/rect.height) can produce coordinates one pixel outside
the element; update the computation to inset the bounds (e.g., right = rect.x +
rect.width - 1 and bottom = rect.y + rect.height - 1 or apply a small
configurable inset) so all generated touch points are strictly inside the
element, and adjust any dependent calculations in the same class/method to use
these inset values.
- Around line 111-129: The resolveCoordinates method is duplicated across
SwipeInsideElement and the ScrollInsideElementWithDuration implementations (iOS
and Android); extract the logic into a single shared utility class (e.g.,
ElementSwipeUtils.resolveCoordinates) as a public static method that accepts
(String dir, int left, int right, int top, int bottom, int cx, int cy) and
returns the int[]; then replace the duplicate implementations in
SwipeInsideElement and both ScrollInsideElementWithDuration classes to call
ElementSwipeUtils.resolveCoordinates(...) and remove the redundant methods.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 01b5127b-3786-4971-a8ac-b6cb2c5c2df6

📥 Commits

Reviewing files that changed from the base of the PR and between b42105a and 6c18324.

📒 Files selected for processing (6)
  • swipe_actions/pom.xml
  • swipe_actions/src/main/java/com/testsigma/addons/android/ScrollInsideElementWithDuration.java
  • swipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementFromMiddleToBottom.java
  • swipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementFromMiddleToTop.java
  • swipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementWithDuration.java
  • swipe_actions/src/main/java/com/testsigma/addons/ios/SwipeInsideElement.java

Comment thread swipe_actions/pom.xml
Comment on lines +47 to +58
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.33.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>9.4.0</version>
</dependency>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

latest Selenium Java version April 2026

💡 Result:

The latest version of Selenium Java as of April 30, 2026, is 4.43.0, released on April 10, 2026. This is confirmed by the official Selenium downloads page listing it as the stable version and the GitHub release page providing the selenium-java-4.43.0.zip asset with significant downloads.

Citations:


🌐 Web query:

Appium java-client latest version 9.4.0 April 2026

💡 Result:

As of 2026-04-30, the latest released version of the Appium Java client (artifact io.appium:java-client) is 10.1.1 (with 10.1.0 released 2026-03-11).

Citations:


Update to latest Selenium and Appium versions in use.

Selenium 4.33.0 is outdated; the latest stable version as of April 2026 is 4.43.0 (released April 10, 2026). Similarly, Appium java-client 9.4.0 is significantly behind the latest version 10.1.1 (released March 11, 2026). Update both dependencies to their latest versions and verify compatibility with the Testsigma SDK.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@swipe_actions/pom.xml` around lines 47 - 58, Update the Selenium and Appium
dependency versions in the POM: change org.seleniumhq.selenium:selenium-java
from 4.33.0 to 4.43.0 and io.appium:java-client from 9.4.0 to 10.1.1, then run a
build and smoke tests to ensure these updated artifacts (selenium-java and
java-client) remain compatible with the Testsigma SDK and adjust any
import/usage changes surfaced by the newer APIs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant