[CUS-12449] add-on for swiping in the given direction with pause.#386
[CUS-12449] add-on for swiping in the given direction with pause.#386ManojTestsigma wants to merge 1 commit intodevfrom
Conversation
📝 WalkthroughWalkthroughIntroduces a new Maven module Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (6)
swipe_actions/src/main/java/com/testsigma/addons/ios/SwipeInsideElement.java (2)
66-69: 💤 Low valueEdge coordinates may land outside element bounds.
Using
rect.x + rect.widthandrect.y + rect.heightcomputes coordinates that are technically 1 pixel outside the element. For an element atx=10, width=100, the rightmost pixel inside is109, but this yields110. 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
resolveCoordinatesis 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 winMixed test frameworks: both JUnit Jupiter and TestNG are declared.
Having both
junit-jupiter-api(test scope) andtestng(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 winJUnit Jupiter 5.8.0-M1 is a milestone (pre-release) version.
Consider using a stable release (e.g.,
5.10.xor5.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 valueSame edge coordinate note applies here.
Line 45 uses
rect.y + rect.height, which is 1 pixel past the bottom edge. See comment inSwipeInsideElement.javafor 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 tradeoffNear-complete duplication with the iOS counterpart.
This class is almost identical to
ios/ScrollInsideElementWithDuration.java, differing only in the parent class (AndroidActionvsIOSAction) andApplicationType. 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
📒 Files selected for processing (6)
swipe_actions/pom.xmlswipe_actions/src/main/java/com/testsigma/addons/android/ScrollInsideElementWithDuration.javaswipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementFromMiddleToBottom.javaswipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementFromMiddleToTop.javaswipe_actions/src/main/java/com/testsigma/addons/ios/ScrollInsideElementWithDuration.javaswipe_actions/src/main/java/com/testsigma/addons/ios/SwipeInsideElement.java
| <!-- 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> |
There was a problem hiding this comment.
🧩 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:
- 1: https://www.selenium.dev/downloads/
- 2: https://github.com/SeleniumHQ/selenium/releases/tag/selenium-4.43.0
- 3: SeleniumHQ/selenium@dd0f534
🌐 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:
- 1: https://mvnrepository.com/artifact/io.appium/java-client
- 2: https://github.com/appium/java-client/
- 3: https://github.com/appium/java-client/releases
- 4: https://github.com/appium/java-client/releases/tag/v10.1.0
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.
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